MyEnergi Sensors Unavailable #576
Replies: 3 comments 3 replies
-
Following as I would like to know how to handle 'unavailable' states better. Two examples of where my attempt to handle it has not worked:
One suggestion in this thread is to assign the entity values to variables with a default when the float conversion fails and check for that default. https://community.home-assistant.io/t/template-sensor-dealing-with-unavailable-values/109674/3?u=leichat |
Beta Was this translation helpful? Give feedback.
-
My system works perfectly, there is no doubt you have local communication errors, I think there is nothing wrong with the integration at all your just panicking rather than fixing the root cause. |
Beta Was this translation helpful? Give feedback.
-
A couple of techniques. For template sensors you can use 'availability' ... so if any of your inputs are not available, the sensor is also unavailable. eg -
In automations you can avoid triggering to unknown states using not_to -
Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
Looking for help....
I have created a sensor to calculate the home energy consumption for the day by adding and subtracting various Myenergi sensors.
{{ ((states('sensor.myenergi_libbi_xxxx_solar_generation_today') | float +
states('sensor.myenergi_libbi_xxxx_grid_import_today') | float +
states('sensor.myenergi_libbi_xxx_battery_discharge_today') | float) -
(states('sensor.myenergi_libbi_xxxx_grid_export_today') | float +
states('sensor.myenergi_libbi_xxxx_battery_charge_today') | float +
states('sensor.myenergi_eddi_xxxx_energy_consumed_session') | float)) | round(2) }}
Regularly the Myenergi integration fails to get the data from the servers and seems to set the value of the sensors to 'unavailable' which causes the home power calculation error. I presume this is expected behaviour as there will be times when the data can't be collected i.e. routine maintenance on the Myenergi servers.
I could fix the issue by setting default values in the YAML but just wondered if you clever people had a better way as i'm sure some of you are doing the same calculation.
Beta Was this translation helpful? Give feedback.
All reactions