I can see the sensor on the dashboard, but I don’t get any values. Obviously something seems to be wrong, but I can’t figure out what. Should current_power_w be the name of the field returned by the API?
Though this certainly needs to be handled by whoever maintains the integration code, could this just be an issue with the deprecation (and recent final removal) of device_state_attributes?
The Genius lyrics integration had a similar issue: just required replacing the above with extra_state_attributes.
It was on purpose to separate the Power Consumption from the Switch. From now on, the Power Consumption will not be a property of the switch anymore; you will have to define it as a sensor.
This is how I have defined it:
sensor:
- platform: rest
name: "Washing machine power consumption"
resource: http://172.16.0.52/report
method: GET
unit_of_measurement: W
device_class: energy
state_class: measurement
value_template: "{{ value_json.power }}"
scan_interval: 10
Unfortunately this is not so reliable when if your wifi network is unstable. From time to time it will result in failed reading because timeout or other network related reasons, an that can cause automation re-trigger because of a change in value.
Example:
you have value 0 → you have a timeout(value undefined) → a good reading again with value 0. Since the value is “0” again, the automation will re-trigger if that’s your trigger. Having 0.1 instead 0 as trigger value will not help either.
I would like to see the mystrom integration for switch sensors as they did it when the power was a switch property… that was more reliable than the Rest sensor