royto / logbook-card

Logbook card for Home Assistant UI Lovelace
GNU General Public License v3.0
197 stars 9 forks source link

Consider value of an atribute instead of entity state #90

Closed zelial closed 10 months ago

zelial commented 11 months ago

I have a climate entity which is set to state 'auto' all the time. But when it starts to heat its 'hvac_action' attribute gets set to heating. I'd like to see the intervals of it being turned on (=heating) in the card, but because the state itself never changes, nolog entries are shown.

Describe the solution you'd like Allow setting an attribute (attributes?) and its values as the deciding factor for showing/not showing a log entry.

Describe alternatives you've considered Attributes can we used to provide additional info for log entries that do get displayed and and can be used to further filter out (hide) log entries that would have been shown, but AFAIK can't be used to trigger the displaying of a log entry.

royto commented 11 months ago

Have you considered creating of a sensor from the climate entity based on this attribute ?

You can do it using yaml with a template something like

template:
  - sensor:
    - name: climate_mode #name it like you want ...
      #replace `my_climate` by your entity name 
      state: "{{ state_attr('climate.my_climate', 'hvac_action') }}" 
      unique_id: c0b35ff264f5d00dfbcf135fd560e375

or directly from the UI

image

zelial commented 10 months ago

Thank you, haven't thought of that. Template sensors work for me, but I still think attribute-based decision would make a nice feature for the logbook-card.

royto commented 10 months ago

Home assistant saves history on state change but not on attributes changes so that's why I suggested to create a sensor based on the attribute.

So if only the attribute change, there is no history on the changes done. So, to me, it is not possible to consider using attributed based value

zelial commented 10 months ago

I see, thanks for looking into it. I'm closing this issue as it can't be implemented.