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

RainBird throws exception when script calls "Switch: Turn off" on any of the provided switches #115297

Closed
ThomasBergholdWieser opened this issue Apr 9, 2024 · 3 comments · Fixed by #115421
Assignees

Comments

@ThomasBergholdWieser
Copy link

The problem

I have a script that lets me turn off all scripts and switches currently configured for the rainbird integration. This call however fails and throws an exception. I have reproduced the issue using a very simple script. This script was created using the visual editor and exported by using the "edit as yaml" functionality, and copy pasted.

What version of Home Assistant Core has the issue?

core-2024.4.2

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

rainbird

Link to integration documentation on our website

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

Diagnostics information

home-assistant_2024-04-09T17-55-57.847Z.log

Example YAML snippet

alias: Stop Rainbird (Test)
sequence:
  - service: switch.turn_off
    data: {}
    target:
      entity_id:
        - switch.rain_bird_sprinkler_1
mode: single

Anything in the logs that might be useful for us?

Stop Rainbird (Test): Error executing script. Unexpected error for call_service at pos 1: 1
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 507, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/rainbird/switch.py", line 126, in async_turn_off
    self.coordinator.data.active_zones.remove(self._zone)

Additional information

Sometimes, the first call doesn't throw an exception. I cannot reproduce the circumstances under which it doesn't, but most of the time (99%), the exception will be thrown.

@home-assistant
Copy link

home-assistant bot commented Apr 9, 2024

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

Code owner commands

Code owners of rainbird 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 rainbird 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)


rainbird documentation
rainbird source
(message by IssueLinks)

@allenporter
Copy link
Contributor

Thank you for the report. Is part of the error message truncated? The last line about what exception is thrown is missing, but i assume its KeyError

@allenporter
Copy link
Contributor

I was able to reproduce this in a test by simply turning off a switch that is already off.

@allenporter allenporter modified the milestone: 2024.4.3 Apr 12, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants