olicooper / esphome-nspanel-lovelace-native

Custom ESPHome component for NSPanel utilising the TFT firmware of the project 'joBr99/nspanel-lovelace-ui'
Other
34 stars 6 forks source link

timercard: no start / stop button? #4

Closed kiddyfurby closed 4 months ago

kiddyfurby commented 4 months ago

from a cardGrid entry pointing to a timer.xxx entity, I can bring up popupTimer but there's no way to start / stop / pause the timer per appdaemon backend does.

olicooper commented 4 months ago

Firstly, thanks for testing this firmware on your nspanel! This repo is in beta at the moment, which means some cards are not implemented yet - and the timer card is one of them which is why it doesn't work yet. Please refer to the readme for a list of currently supported cards. I will try to add support soon, please check back for updates.

olicooper commented 4 months ago

I have added support for timers, but I think Home Assistant or ESPHome is broken because I am not receiving timer attribute updates. The timer won't work until this is fixed.. I have opened an issue here: https://github.com/esphome/issues/issues/5742

kiddyfurby commented 4 months ago

Thank you!!

Home assistant do not send timer updates, to display the remaining time, even in lovelace, requires some third party module (i.e. https://github.com/rianadon/timer-bar-card) that tries to keep an in-browser timer synchronous to HA time.

The appdaemon based backend did something similar afaik.

olicooper commented 4 months ago

I don't think it is quite the same.. I don't need live updates, only the finishes_at attribute state is required for the remaining time calculation which is present when you start the timer. HA doesn't send the update to the panel though.

At the moment the alarm card will immediately close because the panel isn't getting attribute updates for the timer entity (editable,duration,remaining,finishes_at), so it can't render the page. Once the esphome / home assistant issues are fixed it should work but I will try to look for another solution too.

olicooper commented 4 months ago

The timer should now work if you want to try it? It turns out I had an incorrect if else statement which stopped the subscriptions working!

kiddyfurby commented 4 months ago

Right away!!

kiddyfurby commented 4 months ago

The timer screen would still close immediately. when I trigger the timer from HA, I do get the following log line [18:38:54][D][nspanel_lovelace:1305]: HA update: timer.extractor state='active'

olicooper commented 4 months ago

Have you pulled the latest code? There should be multiple HA updates for the timer

kiddyfurby commented 4 months ago

Start / pause / finish now works!

Can't believe I screwed that up. I did esphome clean but somehow was still not on the latest commit. Snapped the commit sha in the yaml and we're in business.

Adjusting the timer didn't work - I was able to tap on the minute, and the +/- shows, and I was able to + the minute but the new minute value is not "saved", I believe the following is the relevant log. my timer was set to 0:20:00 in HA to start with, using the nspanel I adjusted it to 00:10:00, but when I tap on the minute number again (to save the new time and start the timer), the value is not saved and the timer is started.

[18:59:19][D][nspanel_lovelace:397]: Screen CMD: event,buttonPress2,uuid.18,timer-start,00:10:0
[18:59:19][D][nspanel_lovelace:1232]: Call HA: timer.start
[18:59:19][D][nspanel_lovelace:1266]: HA update: timer.extractor remaining='0:20:00'
[18:59:19][D][nspanel_lovelace:1266]: HA update: timer.extractor finishes_at='2024-05-02T19:19:19+00:00'
[18:59:19][D][nspanel_lovelace:1266]: HA update: timer.extractor state='active'
[18:59:19][D][nspanel_lovelace:227]: Render HA update
olicooper commented 4 months ago

Nice! No problem, I will look in to it 👍

kiddyfurby commented 4 months ago

Yes, I could "save" the timer time now with 8285a7e Thank you!