Drakulix / googlehome

Google Home Integration for Home-Assistant
Apache License 2.0
29 stars 3 forks source link

Expose 'status' of alarms/timers in the sensor #9

Closed fluffysfriends closed 3 years ago

fluffysfriends commented 3 years ago

I have a ide for a new feture. To my knowledge the addon track only if there is a set alarm not if the alarm is active or not. My ide is that the addon will make this check

Drakulix commented 3 years ago

When you say 'active', do you mean, if the alarm is currently going off?

There is no way to check that. This information is not exposed by the google home api.

My personal solution to this problem is to check if the state transitions to a new value and if the previous state was close enough to 'now'. That way deleted alarms will not trigger any automations.

fluffysfriends commented 3 years ago

I have the lenovo smart clock as my google home device. and on this device i can set multiple alarms. And i can set them to active or in active eg. If the alarm will go off at a specife time or not. Example if I set the alarm to go of 08:30 on a monday and only monday. The next alarm i will set is for 09:30 on fridays. I want to keep them set but that the addon will only see them on there specfi time and date

Drakulix commented 3 years ago

Well that is how the underlying api works.

The documentation even mentions, that you can only query 'active' timers: https://rithvikvibhu.github.io/GHLocalApi/#operation/GetAlarmsandTimers

So you can leave your other alarms set, but the integration will always show only the next active alarm, that will actually ring.

fluffysfriends commented 3 years ago

If i understand this correct I looking for the status alternativ and check if the alarm is ringing

Drakulix commented 3 years ago

If i understand this correct I looking for the status alternativ and check if the alarm is ringing

Oh interesting! Total overlooked that status part. Looks reasonable, I will try to implement that soon. But this will require a breaking release.

Drakulix commented 3 years ago

Status is exposed as of v0.4.0