Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

“Kodesh” sensor turning off and on unexpectedly #5

Open
shayweiss opened this issue Jun 6, 2021 · 2 comments
Open

“Kodesh” sensor turning off and on unexpectedly #5

shayweiss opened this issue Jun 6, 2021 · 2 comments

Comments

@shayweiss
Copy link
Collaborator

I’ve built 2 automations based on this plugin:

  1. Once the “Kodesh” sensor triggers On -> operate a scene that turns on all the lights needed
  2. Trigger: On 00:30 daily, Condition: if Kodesh contact is Open, Action: operate a scene that turns off all the lights needed.

In practice, light turned on as needed on Knissat Shabbat, but didn’t turn off at 00:30…

When I’ve looked at HB logs, I’ve noticed few weird things:

  1. At 00:30 there was nothing happening
  2. At 00:40 the scene of “Turn On” was triggered…

This led me to think that somewhere during evening (maybe at 00:00??) the “Kodesh” sensor was getting Off (hence on 00:30 the automation wasn’t done eventually…) but then around 00:40 “Kodesh” sensor triggered On again, which in turn activated the ”Turn On” scene…

Is that the expected behavior of the sensor?
I couldn’t see any related logs of the plug-in in HB logs - is there any option to activate it?

@shayweiss
Copy link
Collaborator Author

When trying to figure out what's happening, I've added a notification on my iPhone for every time a status is changed in the Contact Sensor, and it looks like indeed this is what happening - on Friday 19:27 (Candle Light Time) sensor status changed to "Open", then, on midnight exactly, sensor status changed to "Close" (why??), then on Saturday 00:42 sensor status changed to "Open" again (why??), and finally on Saturday 20:40 contact status changed back to "Close" (this is Havdalah time):

WhatsApp Image 2021-06-20 at 13 39 07

When trying to look on Homebridge logs - they show the following around midnight:

[07/06/2021, 00:00:06] [JewishCalendar] Shifting the time by -2880 minutes.
[07/06/2021, 00:00:06] [JewishCalendar] Test date is 2021-06-04T21:00:06.778Z
[07/06/2021, 00:00:06] [JewishCalendar] Sunset Tonight: 04/06/2021, 19:42:07
[07/06/2021, 00:00:06] [JewishCalendar] This Year's Hebrew Months:
[07/06/2021, 00:00:06] [JewishCalendar] {
Tishri: 0,
Heshvan: 1,
Kislev: 2,
Tevet: 3,
Shevat: 4,
Adar1: 5,
Adar2: 5,
Nisan: 6,
Iyar: 7,
Sivan: 8,
Tamuz: 9,
Av: 10,
Elul: 11
}

...
...

[07/06/2021, 00:00:36] [JewishCalendar] Shifting the time by -2880 minutes.
[07/06/2021, 00:00:36] [JewishCalendar] Test date is 2021-06-04T21:00:36.784Z
[07/06/2021, 00:00:36] [JewishCalendar] Sunset Tonight: 04/06/2021, 19:42:07
[07/06/2021, 00:00:36] [JewishCalendar] This Year's Hebrew Months:
[07/06/2021, 00:00:36] [JewishCalendar] {
Tishri: 0,
Heshvan: 1,
Kislev: 2,
Tevet: 3,
Shevat: 4,
Adar1: 5,
Adar2: 5,
Nisan: 6,
Iyar: 7,
Sivan: 8,
Tamuz: 9,
Av: 10,
Elul: 11
}

...
...

[07/06/2021, 00:01:06] [JewishCalendar] Shifting the time by -2880 minutes.
[07/06/2021, 00:01:06] [JewishCalendar] Test date is 2021-06-04T21:01:06.790Z
[07/06/2021, 00:01:06] [JewishCalendar] Sunset Tonight: 04/06/2021, 19:42:07
[07/06/2021, 00:01:06] [JewishCalendar] This Year's Hebrew Months:
[07/06/2021, 00:01:06] [JewishCalendar] {
Tishri: 0,
Heshvan: 1,
Kislev: 2,
Tevet: 3,
Shevat: 4,
Adar1: 5,
Adar2: 5,
Nisan: 6,
Iyar: 7,
Sivan: 8,
Tamuz: 9,
Av: 10,
Elul: 11
}

and then around 00:42, the logs are:
[07/06/2021, 00:41:37] [JewishCalendar] Shifting the time by -2880 minutes.
[07/06/2021, 00:41:37] [JewishCalendar] Test date is 2021-06-04T21:41:37.169Z
[07/06/2021, 00:41:37] [JewishCalendar] Sunset Tonight: 04/06/2021, 19:42:07
[07/06/2021, 00:41:37] [JewishCalendar] This Year's Hebrew Months:
[07/06/2021, 00:41:37] [JewishCalendar] {
Tishri: 0,
Heshvan: 1,
Kislev: 2,
Tevet: 3,
Shevat: 4,
Adar1: 5,
Adar2: 5,
Nisan: 6,
Iyar: 7,
Sivan: 8,
Tamuz: 9,
Av: 10,
Elul: 11
}

...
...

[07/06/2021, 00:42:07] [JewishCalendar] Shifting the time by -2880 minutes.
[07/06/2021, 00:42:07] [JewishCalendar] Test date is 2021-06-04T21:42:07.173Z
[07/06/2021, 00:42:07] [JewishCalendar] Sunset Tonight: 05/06/2021, 19:42:38
[07/06/2021, 00:42:07] [JewishCalendar] This Year's Hebrew Months:
[07/06/2021, 00:42:07] [JewishCalendar] {
Tishri: 0,
Heshvan: 1,
Kislev: 2,
Tevet: 3,
Shevat: 4,
Adar1: 5,
Adar2: 5,
Nisan: 6,
Iyar: 7,
Sivan: 8,
Tamuz: 9,
Av: 10,
Elul: 11
}

I do see that the check at [07/06/2021, 00:42:07] (in the "Sunset Tonight" line) only identifies for the 1st time that a day has changed (i.e. Sunset Tonight: 05/06/2021, 19:42:38), whereas all previous checks showed [07/06/2021, 00:41:37] [JewishCalendar] Sunset Tonight: 04/06/2021, 19:42:07

Hope this gives any clue...

@shayweiss
Copy link
Collaborator Author

Well, after playing a bit with some debug logs, it seems like we hit the same problem as described in mourner/suncalc#11.
I see some workaround suggestions there - maybe something similar can be implemented here as well? (BTW - is the latest version of SunCalc used here?)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant