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

Jewish Calendar entities unknown or unavailable #118930

Closed
theqz opened this issue Jun 6, 2024 · 8 comments · Fixed by #119887
Closed

Jewish Calendar entities unknown or unavailable #118930

theqz opened this issue Jun 6, 2024 · 8 comments · Fixed by #119887

Comments

@theqz
Copy link

theqz commented Jun 6, 2024

The problem

Since about a week, the sensors for times as binary sensors do not work anymore.
It seems to be related to my latitude, as configuring a lower latitude fixes the issue.

Note that at my latitude, most apps are unable to calculate a Alos Hashachar (as well as tefilah times according to MGA).

This issue persists in 2024.6 even after re-configuring the integration using the UI.

What version of Home Assistant Core has the issue?

core-2024.6.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Jewish Calendar

Link to integration documentation on our website

https://www.home-assistant.io/integrations/jewish_calendar

Diagnostics information

home-assistant_jewish_calendar_2024-06-06T05-31-24.217Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:941
First occurred: 07:24:24 (425 occurrences)
Last logged: 07:36:39

Update for sensor.jewish_calendar_t_set_hakochavim fails
Update for sensor.jewish_calendar_upcoming_shabbat_candle_lighting fails
Update for sensor.jewish_calendar_upcoming_shabbat_havdalah fails
Update for sensor.jewish_calendar_upcoming_candle_lighting fails
Update for sensor.jewish_calendar_upcoming_havdalah fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1289, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/jewish_calendar/sensor.py", line 225, in async_update
    self._attr_native_value = self.get_state(
                              ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/jewish_calendar/sensor.py", line 303, in get_state
    times = self.make_zmanim(dt_util.now()).zmanim
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hdate/zmanim.py", line 126, in zmanim
    for key, value in self.utc_zmanim.items()
                      ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hdate/zmanim.py", line 118, in utc_zmanim
    for key, value in self.get_utc_sun_time_full().items()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hdate/zmanim.py", line 347, in get_utc_sun_time_full
    first_light = self._get_utc_time_of_transit(106.1, True)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hdate/zmanim.py", line 328, in _get_utc_time_of_transit
    astral.sun.time_of_transit(
  File "/usr/local/lib/python3.12/site-packages/astral/sun.py", line 343, in time_of_transit
    hourangle = hour_angle(
                ^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/astral/sun.py", line 243, in hour_angle
    HA = acos(h)
         ^^^^^^^
ValueError: math domain error


Logger: homeassistant.components.binary_sensor
Source: helpers/entity_platform.py:600
integration: Binary Sensor (documentation, issues)
First occurred: 07:31:09 (3 occurrences)
Last logged: 07:31:09

Error adding entity binary_sensor.jewish_calendar_issur_melacha_in_effect for domain binary_sensor with platform jewish_calendar
Error adding entity binary_sensor.jewish_calendar_erev_shabbat_hag for domain binary_sensor with platform jewish_calendar
Error adding entity binary_sensor.jewish_calendar_motzei_shabbat_hag for domain binary_sensor with platform jewish_calendar
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 600, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 914, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1354, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/jewish_calendar/binary_sensor.py", line 122, in async_added_to_hass
    self._schedule_update()
  File "/usr/src/homeassistant/homeassistant/components/jewish_calendar/binary_sensor.py", line 142, in _schedule_update
    update = zmanim.zmanim["sunrise"] + dt.timedelta(days=1)
             ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hdate/zmanim.py", line 126, in zmanim
    for key, value in self.utc_zmanim.items()
                      ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hdate/zmanim.py", line 118, in utc_zmanim
    for key, value in self.get_utc_sun_time_full().items()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hdate/zmanim.py", line 347, in get_utc_sun_time_full
    first_light = self._get_utc_time_of_transit(106.1, True)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/hdate/zmanim.py", line 328, in _get_utc_time_of_transit
    astral.sun.time_of_transit(
  File "/usr/local/lib/python3.12/site-packages/astral/sun.py", line 343, in time_of_transit
    hourangle = hour_angle(
                ^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/astral/sun.py", line 243, in hour_angle
    HA = acos(h)
         ^^^^^^^
ValueError: math domain error

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Jun 6, 2024

Hey there @tsvi, mind taking a look at this issue as it has been labeled with an integration (jewish_calendar) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of jewish_calendar can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign jewish_calendar Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


jewish_calendar documentation
jewish_calendar source
(message by IssueLinks)

@tsvi
Copy link
Contributor

tsvi commented Jun 6, 2024

Hi @theqz, thank you for reporting the bug. Could you provide the location where this fails?

@theqz
Copy link
Author

theqz commented Jun 6, 2024

Hi @tsvi , I'm in Amsterdam, Netherlands. Should've said that :)
According to Chabad.org: 1. On this date at this location the sun does not set far enough below the horizon to use the standard calculation, The Chabad custom is to use Chatzot for this time.

Hope that helps!

@theqz
Copy link
Author

theqz commented Jun 6, 2024

Hi @tsvi , I saw that issue but assumed it was fixed in 2024.6 (which is why I waited to report this).
To be complete, Daf Yomi, Holiday (the name of the holiday), Jewish calendar Date, Day of the Omer, Parashat HaShavua, DO work.

Thanks!

@tsvi
Copy link
Contributor

tsvi commented Jun 6, 2024

Ok, looking back this seems the same problem as #51641 and was reported in the libhdate library as well py-libhdate/py-libhdate#96
I will try and see how we can fix it and release an updated library.

@tcmalive
Copy link

tcmalive commented Jun 6, 2024

Not sure if this is related, but with the latest update, it basically created a bunch of new entities all with the same name as the old entities with an "_2" appendix. This caused exactly the issue that you're stating above. all the old entities were unavailable, but still registered and the new entities were working, but all my configs, dashboards, automations... were not pointing to them.
Solution: Remove old entities, change names of new entities by removing the "_2" everything works now.

@tsvi
Copy link
Contributor

tsvi commented Jun 6, 2024

@tcmalive This is unrelated. Unavailable happening is sporadic and depends on the configuration when you wrote your yaml.
This is a different issue.

@rwllr
Copy link

rwllr commented Jun 14, 2024

I think I'm seeing similar in London, UK.
Parsha, Daf Yomi and Omer are working but all other sensors that are zmanin are showing as Unavailable or an error.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants