Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Use information about running programs to imrpove process sensor #5

Open
emilp333 opened this issue Dec 5, 2018 · 6 comments
Open
Labels
enhancement New feature or request

Comments

@emilp333
Copy link

emilp333 commented Dec 5, 2018

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.

@DavidMStraub
Copy link
Owner

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.

@emilp333
Copy link
Author

emilp333 commented Feb 6, 2019

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.

@DavidMStraub
Copy link
Owner

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.

@FlavorFx
Copy link

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.

@SeraphimSerapis
Copy link

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 %}

@emilp333
Copy link
Author

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.

@DavidMStraub DavidMStraub changed the title The program process in “unavailable” if there is no program running or if the process is below 1%. Use information about running programs to imrpove process sensor May 5, 2020
@DavidMStraub DavidMStraub added the enhancement New feature or request label May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants