Skip to content

Commit

Permalink
Fixes #125
Browse files Browse the repository at this point in the history
  • Loading branch information
tschamm committed Dec 4, 2023
1 parent c9bf4ad commit 218452b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions custom_components/bosch_shc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
)
from homeassistant.core import (
HomeAssistant,
ServiceCall,
callback,
)
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
Expand Down Expand Up @@ -157,12 +158,15 @@ def register_services(hass, entry):
}
)

async def scenario_service_call(call):
async def scenario_service_call(call: ServiceCall) -> None:
"""SHC Scenario service call."""
name = call.data[ATTR_NAME]
for scenario in hass.data[DOMAIN][entry.entry_id][DATA_SESSION].scenarios:
if scenario.name == name:
hass.async_add_executor_job(scenario.trigger)
for controller_data in hass.data[DOMAIN].values():
session = controller_data[DATA_SESSION]
if isinstance(session, SHCSession):
for scenario in session.scenarios:
if scenario.name == name:
hass.async_add_executor_job(scenario.trigger)

hass.services.async_register(
DOMAIN,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/bosch_shc/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"iot_class": "local_push",
"issue_tracker": "https://github.com/tschamm/boschshc-hass/issues",
"requirements": ["boschshcpy==0.2.82"],
"version": "0.4.71",
"version": "0.4.72",
"zeroconf": [{ "type": "_http._tcp.local.", "name": "bosch shc*" }]
}

0 comments on commit 218452b

Please sign in to comment.