- platform: rest name: network resource: http://192.168.1.2:61208/api/3/network value_template: N/A json_attributes: - interface_name - time_since_update - cumulative_rx - rx - cumulative_tx - tx - cumulative_cx - cx - is_up - speed verify_ssl: false timeout: 20 scan_interval: 8
- platform: template sensors: horizon_download_speed: value_template: '{{ ((state_attr("sensor.network", "rx") /2 | int) / 1000000) | round (2) }}' unit_of_measurement: "Mbps" - platform: template sensors: horizon_upload_speed: value_template: '{{ ((state_attr("sensor.network", "tx") /2 | int) / 1000000) | round (2) }}' unit_of_measurement: "Mbps" - platform: template sensors: horizon_total_speed: value_template: '{{ ((state_attr("sensor.network", "cx") /2 | int) / 1000000) | round (2) }}' unit_of_measurement: "Mbps"
why are you dividing by 2?
Thanks,
Ken
EDIT: Sorry for the double-notifications, I accidentally deleted this post... adding it back.
It looks like your results are exactly like mine. I noticed that the value provided by the API was roughly twice as much as the real value last time I tested this... so, out of sheer desperation, I tried dividing the value by 2.
There must be something we're missing. It's hard to believe that basic network bandwidth info in the Glances API is completely unusable. I'm sure someone would have noticed this by now if it was really broken. I wasn't able to find any Github issues related to this I just opened a new issue for this on Github:
<div class="table-row" ng-repeat="network in vm.networks track by network.interfaceName">
<div class="table-cell text-left">{{ network.interfaceName | min_size }}</div>
<div class="table-cell" ng-show="!vm.arguments.network_cumul && !vm.arguments.network_sum">{{ vm.arguments.byte ?
(network.rx / network.time_since_update | bytes) : (network.rx / network.time_since_update | bits) }}
</div>
<div class="table-cell" ng-show="!vm.arguments.network_cumul && !vm.arguments.network_sum">{{ vm.arguments.byte ?
(network.tx / network.time_since_update | bytes) : (network.tx / network.time_since_update | bits) }}
</div>
<div class="table-cell" ng-show="!vm.arguments.network_cumul && vm.arguments.network_sum"></div>
<div class="table-cell" ng-show="!vm.arguments.network_cumul && vm.arguments.network_sum">{{ vm.arguments.byte ?
(network.cx / network.time_since_update | bytes) : (network.cx / network.time_since_update | bits) }}
</div> - platform: template sensors: horizon_network_time_since: value_template: '{{ state_attr("sensor.network", "time_since_update") }}' unit_of_measurement: "Mbps"
- platform: template sensors: horizon_download_speed: value_template: '{{ ((state_attr("sensor.network", "tx") | int) / 1000000) / state_attr("sensor.network", "time_since_update") | round (2) }}' unit_of_measurement: "Mbps"
value_template: '{{ ((state_attr("sensor.network", "tx") / state_attr("sensor.network", "time_since_update") | int) / 1000000) | round (2) }}'
value_template: '{{ ((state_attr("sensor.network", "tx") / state_attr("sensor.network", "time_since_update") | int) * 8 / 1000000) | round (2) }}' - platform: rest name: diskio_0 resource: http://192.168.1.2:61208/api/3/diskio value_template: '{{ ( value_json[0] ) }}' json_attributes: - time_since_update - disk_name - read_count - write_count - read_bytes - write_bytes
- platform: template sensors: horizon_c_drive_read_bytes: value_template: '{{ ((state_attr("sensor.diskio_0", "read_bytes") | int) / 1000000) | round (2) }}' unit_of_measurement: 'MB/s' - platform: template sensors: horizon_c_drive_write_bytes: value_template: '{{ ((state_attr("sensor.diskio_0", "write_bytes") | int) / 1000000) | round (2) }}' unit_of_measurement: 'MB/s' - platform: template sensors: horizon_e_drive_read_bytes: value_template: '{{ ((state_attr("sensor.diskio_1", "read_bytes") | int) / 1000000) | round (2) }}' unit_of_measurement: 'MB/s' - platform: template sensors: horizon_e_drive_write_bytes: value_template: '{{ ((state_attr("sensor.diskio_1", "write_bytes") | int) / 1000000) | round (2) }}' unit_of_measurement: 'MB/s'