fonske / clack-reader-v4

GNU General Public License v3.0
8 stars 2 forks source link

Set Initial Value of Buttons #4

Open dfiore1230 opened 3 days ago

dfiore1230 commented 3 days ago

the initial value of the following buttons is unset ("unknown") which causes systems to report the entities as unknown.

  1. Reset Fill Salt
  2. Reset resinclean
  3. Test Button regen stop
  4. Test Button usepulse
  5. Test Button motor run pulse
  6. ESP Restart
  7. ESP Restart (Safe mode)

Myself and many others have a sensor that lists out the unknown entities as a mechanism for troubleshooting.

As a suggestion these buttons should have an initial value, likely being the time of the initialization.

fonske commented 2 days ago

isnt that normal when the button is never pushed?

Do you have a esphome code example of an initial value?

dfiore1230 commented 2 days ago

Well it can be, but presetting a value will enable existing monitoring to work unchanged.

I dont have experience with ESPHOME but i using HA you can set the initial value of a state pretty easily.

Here is an example of a sensor i use to monitor and ensure none of my devices have gone offline - platform: template sensors: unavailable_entities: friendly_name: Unavailable Entities unit_of_measurement: entities icon_template: "{{ 'mdi:check-circle' if is_state('sensor.unavailable_entities','0') else 'mdi:alert-circle' }}" value_template: > {{ states|selectattr('state','in',['unavailable','unknown','none'])|rejectattr('domain','eq','group') |rejectattr('entity_id','in',state_attr('group.ignored_entities','entity_id'))|list|count }} attribute_templates: entities: > {{ states|selectattr('state','in',['unavailable','unknown','none'])|rejectattr('domain','eq','group') |rejectattr('entity_id','in',state_attr('group.ignored_entities','entity_id'))|map(attribute='entity_id')|list }}