HADailySensor
HADailySensor copied to clipboard
sensor availability not checked ?
I have a max sensor based on the DSMR voltage sensor. This is not available when HADailySensor is starting and thus gives an error.
Logger: custom_components.daily.sensor Source: custom_components/daily/sensor.py:156 integration: Daily Sensor ([documentation](https://github.com/jeroenterheerdt/HADailySensor), [issues](https://github.com/jeroenterheerdt/HADailySensor/issues)) First occurred: 16:00:21 (6 occurrences) Last logged: 16:00:27 unable to convert unavailable to float. Please check the source sensor (sensor.electricity_meter_voltage_phase_l1) is available.
Adding an availability template to each daily_sensor would prevent this.
what is an availability template?
It checks for the availability of the sensor, refer https://www.home-assistant.io/integrations/template/ The section on "STATE BASED SENSOR CHANGING THE UNIT OF MEASUREMENT OF ANOTHER SENSOR" is the clearest I suppose. Also a lot of comments on this concept on Tweakers.net (assume you are dutch) and the HA-forum.
code snippet (spacing and code tags are not really working here for some reason; template:
- sensor:
- name: "fan speed percentage" unique_id: "IDsensor_fan_speed_percentage" state_class: measurement unit_of_measurement: "%" icon: mdi:fan state: > {{ state_attr('fan.itho_wifi_nrg_21a4','percentage') }} availability: >- {{ states( 'fan.itho_wifi_nrg_ssss' ) not in [ 'unknown', 'unavailable'] }}
or availability: "{{ states('fan.itho_wifi_nrg_ssss') | is_number }}"
Right,but that's of course not how it works in python when writing an integration. But I think I get now what you're after.
Thanks a lot Jeroen, Will test it later on.
Logger: homeassistant Source: custom_components/daily/sensor.py:155 integration: Daily Sensor (documentation, issues) First occurred: 20:07:49 (172 occurrences) Last logged: 20:08:49
Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/daily/sensor.py", line 72, in
Mm, not really happy after the restart. You want me to make a new Issue?
Same for me...