timer-bar-card
timer-bar-card copied to clipboard
Bar sometimes doesn't show
I had it working fine overnight but when I woke up today, the card was there, the text and the icon.. it says it's active but there is no bar showing the time... what could be causing this?
https://imgur.com/a/ce7cvKJ
-- Edit Update -- State: active (state mode = idle) Mode: idle (auto mode = N/A, unused) Duration: 404400 second Time remaining: 0 Counter: 0 Attr: {"duration":"112:20:00","editable":false,"finishes_at":"2021-10-14T14:45:00+10:30","remaining":"01:1:28","remainingText":" 1 hour, 1 minute","friendly_name":"Google Leave Time Remaining"}
`type: custom:timer-bar-card
entities:
- entity: sensor.google_leave_time_remaining
name: break...
bar_width: 70%
active_icon: mdi:alarm
bar_height: 10px
text_width: 0px
bar_foreground: green
modifications:
- greater_than: 90
bar_foreground: orange
active_icon: mdi:fire
bar_height: 12px
- greater_than: 95
bar_foreground: red
bar_height: 20px
active_icon: mdi:fire-alert`
It's Halloween time and the ghosts must be messing with you π» π π¦ πΈοΈ
The problem seems to be you haven't configured the start_time or end_time of the timer, so it's going to be relying on the time the entity lasts reports changing. I recommend configuring end_time like this.
I'm not sure what really happened to your timer, because in the screenshot you sent it says the timer was modified 13 hours ago, yet it only has 4 hours remaining!
Anyways, I'm sorry there are so many knobs to read about and tune to get this card working. That's something I will hopefully improve soon.
Do those times both need to be in "2021-10-16T06:50:00+10:30" kind of time?
On Fri, 15 Oct 2021 at 06:32, rianadon @.***> wrote:
It's Halloween time and the ghosts must be messing with you π» π π¦ πΈοΈ
The problem seems to be you haven't configured the start_time or end_time of the timer, so it's going to be relying on the time the entity lasts reports changing. I recommend configuring end_time like this https://github.com/rianadon/timer-bar-card#4-the-entity-has-no-duration-attribute-but-it-has-start-time-and-end-time-finishes_at-attributes .
I'm not sure what really happened to your timer, because in the screenshot you sent it says the timer was modified 13 hours ago, yet it only has 4 hours remaining!
Anyways, I'm sorry there are so many knobs to read about and tune to get this card working. That's something I will hopefully improve soon.
β You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rianadon/timer-bar-card/issues/28#issuecomment-943685091, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5UBEBEZHROFXCWC5DLGVTUG4ZNXANCNFSM5F6NTDFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
That is correct.
will it work with JUST those two variables??
On Sun, 17 Oct 2021 at 10:54, rianadon @.***> wrote:
That is correct.
β You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rianadon/timer-bar-card/issues/28#issuecomment-945026419, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5UBEEXH24GELM3GIVXVR3UHIJSDANCNFSM5F6NTDFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
I can't say for certain, but you should certain add the configuration for end_time:
end_time: { attribute: "finishes_at" }
It looks like the card doesn't give you any start time, but having just a duration (I see the duration attribute which is automatically imported) and an end time will be enough for the timer to accurately calculate the time remaining.
That's not too big of an issue since it's just a JSON restful that i've written to get information out of a script I"ve written external to Home Assistant.. It's just a matter of getting the right data to the right parts of your plugin
On Sun, 17 Oct 2021 at 16:21, rianadon @.***> wrote:
I can't say for certain, but you should certain add the configuration for end_time:
end_time: { attribute: "finishes_at" }
It looks like the card doesn't give you any start time, but having just a duration (I see the duration attribute which is automatically imported) and an end time will be enough for the timer to accurately calculate the time remaining.
β You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rianadon/timer-bar-card/issues/28#issuecomment-945054382, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5UBEBTWVSIX6GNHQLLF7LUHJP4ZANCNFSM5F6NTDFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
I got here, because I had the same issue, but I found the reason (and solution) for my case, so I want to share the info. Pay close attention to your computer system clock!! If it's out of sync, the bar won't show up at all. Nothing wrong with the bar itself, but your computer! I had my homeassistant host, running in a VM, with hyper-v timesync integration service on. And somehow, the time got messed up, running 2 days in the past. I turned off this htper-v "disfeature", and now I rely on NTP sync from ubuntu itself inside the VM. That brought my HA host system time back to its place. and now my Bar show up again. It's actually the second time this happen to me and this card's bar disappears or shows the wrong value, but the first time the clock issue was on the viewer computer, not the HA host. So all of them must be on SYNC!
This should be mentioned in the docs for this card. Since I already run into this problems twice, and it takes a lot of time to figure out what the heck is happening. Probably there are more people going to face similar issues.
@sdrapha I just saw your PR! Thank you for submitting that!
It seems like the issue might be when Home Assistant says the timer is still running but the card computes there's zero time remaining. It would be nice to have the card detect when this happens so it can warn you.
It seems like an approach could be to detect cases where Home Assistant thinks the timer is running but the card thinks the timer finished a long time ago (> 5 hours or so). Do you think this would have detected your incorrect configuration? Thanks!
Yeah, great idea to show a warning instead of failing silently.
Your proposed logic would work on my 2nd scenario I had the issue (when the system clock was 2 days behind);
BUT it would not on the 1st scenario I had the issue (when the system clock was 3 min ahead )
The behaviour on that first scenario was not the bar disapearing, but showing an incorrect time (I had a timer set to 10min but the bar always started from the middle and showing 7min left)
I think your logic to show an error message still make sense, minus the > 5 hour part. since 1min alone maybe enough to disturb everything.
An error message like out of sync would be a nice start I think, it's not self-explanatory but it's short (to fit in UI), and can serve as a hint for further looking at the documentation.
Another aproach, (just brainstorming ideas)
when you have this block of code for example:
if (start_time && duration)
return (Date.parse(start_time) - Date.now()) / 1000 + duration;
the card is comparing a HA given time start_time (which was based on HA system time) VS date.now() which is rendered in the frontend at the viewers device.
So that is why we get glitches when both computers have mismatches in system times.
I'm not sure if it makes sense for pratical reasons, but if date.now() was instead based in a HA entity like sensor.date_time_iso, there would be no mismatch whatsoever.
I know this could complicate things, and all computers SHOULD have their system clocks synced to a NTP server (but not everything run as planned in real life), so this aproach could make the card time mismatch proof, but the other previous aproach (error message) may be desirable to make the user aware there is something wrong with the system clock.
I think your logic to show an error message still make sense, minus the > 5 hour part. since 1min alone maybe enough to disturb everything.
Good point! I'll have a look and see if there's any way to grab what Home Assistant thinks is the current time.
I don't think it would be feasible to sync the clocks well enough to operate purely on the HA time, but I think displaying a warning if these clocks are more than a few seconds off-sync is the way to move forward.
Closing this since the latest release (v1.22) will alert you if the clocks are out of sync.
The approach I ended up taking was checking the current time when Home Assistant sends an update to the browser saying the entity changed. If Home Assistant reports that the time of entity change is significantly different than the current time, the warning is shown.