home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.43k stars 30.67k forks source link

Jewish Calendar binary sensor not working in automation #102803

Closed hros closed 6 months ago

hros commented 1 year ago

The problem

I want to use the binary sensor Jewish Calendar Issur Melacha in Effect to turn on a light at a specific time only on Saturday and Jewish holidays. The automation has a time trigger and a condition, selecting from the UI "Condition/State":

Entity: Jewish Calendar Issur Melacha in Effect
Attribute: 
State: On
For: 0:00:00

When the condition is not set, the automation works and turns on the light at the specified time of the trigger each day. When I add the condition the light does not turn on on Saturday.

Should I use the binary sensor differently? or is there a problem with the sensor?

What version of Home Assistant Core has the issue?

2023.10.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

jewish calendar

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

alias: Dimmer on at 09:30
description: ""
trigger:
  - platform: time
    at: "09:30:00"
condition:
  - condition: state
    entity_id: binary_sensor.jewish_calendar_issur_melacha_in_effect
    state: "on"
action:
  - service: light.turn_on
    data:
      brightness_pct: 25
    target:
      area_id: room_1
      device_id: 11111111111111111111111111
      entity_id: light.shelly_dimmer_2_1111111111_light_0
mode: single

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

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.

(message by CodeOwnersMention)


jewish_calendar documentation jewish_calendar source (message by IssueLinks)

tsvi commented 1 year ago

I don't know. This looks correct

hros commented 1 year ago

Any tips on how to debug the issue?

Perhaps I'd start by changing the condition to 'Off' so that the light will turn on on weekdays, and I won't have to wait for Saturday to test it

I did see that the "Issur Melacha" sensor entity changes to On on Friday evening

hros commented 1 year ago

The automation didn't work this Saturday (the light did not turn on) The trace, shows "Issur Melacha" is "On"

image

Any idea why this did not work?

Btw, I flipped the condition (Issur Melacha = Off) and the light did turn on on Friday

tsvi commented 1 year ago

The trace shows it should have turned the ligh on. Do doesn't look like an issue with issue melacha. Seems weird. Maybe something else is interfering? Show the trace for Friday? Also can you check that the issue melacha toggles in the logbook when changing from Friday to Shabbat and the other way round?

hros commented 1 year ago

the trace for friday correctly shows the condition stopped the automation:

image

The Logbook for the sensor looks OK:

image

any idea?

tsvi commented 1 year ago

I am not sure I understand the issue. The trace shows on Friday it checks whether issue melacha is on. It is not, which is correct. Therefore it doesn't continue the action. On Saturday, it is on and therefore it continues doing the action stating that it turns on the light. (All this is just from looking at the trace). So that means the issue is not with the issur melacha sensor. Unless I misunderstood you.

hros commented 1 year ago

The automation didn't work this Saturday as well The trace shows the status of the sensor as unavailable:

image

When I searched for the entity issur_melacha.... I saw two entities:

image

You can see that one entity is marked as disabled, and its tooltip shows "restored".

Perhaps that is the cause of the problem. Any idea how to remove dual entities?

hros commented 11 months ago

I removed the double entities. I also changed the wanted state (which is set automatically by the UI) from ON to on (which is set by the sensor). The trace (shown below), shows that the issur melacha condition was met, and that the action was activated. However, the light did not turn on. Oddly, when I run the action from the automation, the light does turn on, so it seems that the action is configured correctly. Any idea?

image
hros commented 11 months ago

I don't know if it has to do with the issur_melacha sensor, but after debugging the issue further, these are my findings:

  1. when the condition is issur_melacha=On the automation does not activate on weekdays (as it should), and the trace shows that it activates the automation on Saturday, however the light does not turn on
  2. If I switch the condition to issur_melacha=Off, the light does turn on on weekdays
  3. looking at the traces of both cases I see that in both cases "Call a service 'Light: Turn on' on Bedroom_Dimmer" is shown in the trace, however only during weekdays (sensor=Off) is the trace followed by the line "light.shelly_dimmer_2_111111111111_light_0) turned on"

Any idea what could be the problem (and solution)?

hros commented 10 months ago

As far as I understand, the state of the sensor is case-sensitive. Looking at the sensor's history, I see the states are printed with initial capital letters:

image

However, when I look at "developer tools=>states," I see that the current state is off without a capital "O":

image

Similarly, the trace of the automation shows the condition was not satisfied because on!=On.

In old issues regarding this sensor, I saw that it was used with True and False. What is the correct way to test this sensor? True/False? On/Off? on/off?

tsvi commented 10 months ago

This is unrelated to the Jewish Calendar integration, rather related to how the automation is written. This issue should be closed.

hros commented 10 months ago

I can confirm the sensor is operating as expected
I created a new automation with exactly the same parameters, and it works as expected

Do you know of a way to extract the internal representation of the two automations to file an HA issue (why two seemingly identical automations behave differently)

kj4qyf commented 9 months ago

I would like to create an automation using the Yurtzaits of my Parents as trigger. The dates are Av 20 and Elul 27. In the Jewish Calendar I see no option to select a specific Hebrew calendar date, but I see that there is a sensor for Rosh Hashana. I tried to use that sensor with an offset of 40 days (Av 20) but I don't know where to find the Rosh Hashana sensor as trigger. I'd like to add that I have never used a sensor as trigger, so I would need some guidance PLS.

issue-triage-workflows[bot] commented 6 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

kj4qyf commented 6 months ago

Not resolved

hros commented 6 months ago

Deleting the automation and recreating it worked for me

It was probably some sort of internal mismatch on home-assistant's database

kj4qyf commented 6 months ago

Deleting the automation and recreating it worked for me

It was probably some sort of internal mismatch on home-assistant's database

That does not really respond to my question.

kj4qyf commented 6 months ago

This was ( is ) my question and it has not yet been resolved. That is why it should not be closes pls.

kj4qyf commented 6 months ago

If you want the close it, then do so, but the issue is not at all resolved and a deleting/re-inclusion has NOTHING to do with my question. Respectfully, you are closing an issue as completed while it is NOT completed. You are acting as law enforcement without even taking the time to read my question.

joostlek commented 6 months ago

His issue is solved so he closed the issue. That's normal. If you have an issue, you open your own issue (given that there isn't a duplicate issue open).

kj4qyf commented 6 months ago

Mijn vraag is niet beantwoord


From: Joost Lekkerkerker @.> Sent: Tuesday, April 16, 2024 5:25 PM To: home-assistant/core @.> Cc: kj4qyf @.>; Comment @.> Subject: Re: [home-assistant/core] Jewish Calendar binary sensor not working in automation (Issue #102803)

His issue is solved so he closed the issue. That's normal. If you have an issue, you open your own issue (given that there isn't a duplicate issue open).

— Reply to this email directly, view it on GitHubhttps://github.com/home-assistant/core/issues/102803#issuecomment-2059947150, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHI6JKHBCFCKT7QXYOOEYZ3Y5WJMTAVCNFSM6AAAAAA6PV4WRCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJZHE2DOMJVGA. You are receiving this because you commented.Message ID: @.***>

joostlek commented 6 months ago

I don't see how your question relates to this issue at all, with the only similarity is using an entity in an automation. If you have a bug, please open a new issue. If it's a question, please use the forums or discord.