homeassistant-homeconnect icon indicating copy to clipboard operation
homeassistant-homeconnect copied to clipboard

Use information about running programs to imrpove process sensor

Open emilp333 opened this issue 6 years ago • 6 comments

The program process in “unavailable” if there is no program running or if the process is below 1%. I think it should report 0% or off instead of unavailable.

emilp333 avatar Dec 05 '18 13:12 emilp333

Sorry, I forgot to repy to this issue.

I tend to think that when no information about progress is available to the component, "unavailable" is an appropriate status, no? Since the progress is reported only at certain intervals, this could also apply e.g. when HA is started while a program is running, until progress is reported/changed for the first time.

DavidMStraub avatar Feb 05 '19 14:02 DavidMStraub

If the program have started it should be 0%. I think the component needs to trigger certain updates of other sensors when program is started and finished.

emilp333 avatar Feb 06 '19 08:02 emilp333

The problem is that triggering the start of a program does not mean the program actually starts. For instance, it could be that the "remote start" on the device is deactivated. So I think it is consistent if the progress starts to be 0% once the API event stream reports that the program is actually running. I think this is not a problem though as this should happen immediately after the program starts (in theory). Not sure this is what you meant.

DavidMStraub avatar Feb 06 '19 09:02 DavidMStraub

When by washing machine is switched on again and returns to my network, all entities still remains unavailable. Is there a change to update the adapter right after wake up again and returned to the network? 'Unavailable' for each entities doesn't look quite nice in the UI.

FlavorFx avatar Nov 22 '19 20:11 FlavorFx

I countered that by implementing a template sensor that leverages the switch and the attributes it populates while in operation:

mr_coffee_current_progress:
    friendly_name: 'Progress'
    entity_id: switch.mr_coffee
    unit_of_measurement: '%'
    value_template: >
      {% if state_attr('switch.mr_coffee', 'active_program') %}
        {{ state_attr('switch.mr_coffee', 'program_progress') }}
      {% else %}
        0
      {% endif %}
    icon_template: >
      {% if state_attr('switch.mr_coffee', 'active_program') %}
        {% if is_state_attr('switch.mr_coffee', 'program_progress', 100) %}
          mdi:progress-check
        {% else %}
          mdi:progress-clock
        {% endif %}
      {% else %}
        mdi:progress-check
      {% endif %}

SeraphimSerapis avatar Jan 23 '20 08:01 SeraphimSerapis

Hi David,

Sorry for not updating this in a proper time. What I mean is that I think your component should be more smart than only publishing exactly what comes from the API. I mean right now its kind of only provides API sensors.

You should use the information in the API and then build logic around it. If a program starts it will tell you that but it will not send an update about the progress until it reaches 1%. But the component knows that the program started and could update the progress by itself to 0%. Same goes when a program has finished.

What I'm saying is that I think this component deserves to be more than API sensors. It should read the events and do some logic as well. It does not makes sense to build extra template sensors when this could be built in to the component.

emilp333 avatar Jan 23 '20 10:01 emilp333