home-assistant / home-assistant/core
Can not set duration with switch override in Genius Hub integration
- Dominant language
- Python
- Stars
- 90.5k
- Forks
- 38.6k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 597
Description
### The problem
I had previously worked round this by putting a fix in zone.py but now I am unable to create a custom config for this integration.
When you set a duration in seconds, e.g 36000 the switch override fails with this error
Error: int() argument must be a string, a bytes-like object or a real number, not 'datetime.timedelta'
Full log included:
Previously worked round by adding some code around line 300 in zone.py to test the data type and convert it to the expected data type.
### What version of Home Assistant Core has the issue?
2026.9.1
### 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
Genius Hub
### Link to integration documentation on our website
https://www.home-assistant.io/integrations/geniushub/
### Diagnostics information
_No response_
### Example YAML snippet
```yaml
```
### Anything in the logs that might be useful for us?
```txt
Logger: homeassistant.components.automation.blue_bed_on_at_sunset
Source: helpers/script.py:573
Integration: Automation (documentation, issues)
First occurred: 14:00:07 (4 occurrences)
Last logged: 14:07:22
Blue Bed on at sunset: Error executing script. Unexpected error for call_service at pos 1: int() argument must be a string, a bytes-like object or a real number, not 'datetime.timedelta'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 573, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1081, in _async_step_call_service
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<9 lines>...
)
^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 683, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2961, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 3004, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 914, in entity_service_call
response_data = await _async_handle_entity_calls(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<5 lines>...
)
^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 787, in _async_handle_entity_calls
single_result = await entity.async_request_call(_with_context(entity, coro))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1711, in async_request_call
return await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 782, in _with_context
return await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 866, in _handle_single_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/geniushub/switch.py", line 87, in async_turn_on
await self._zone.set_override(1, kwargs.get(ATTR_DURATION, 3600))
File "/usr/local/lib/python3.14/site-packages/geniushubclient/zone.py", line 300, in set_override
duration = int(duration) if duration else 3600
~~~^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'datetime.timedelta'
```
### Additional information
_No response_
Contributor guide
Research direction
Start in homeassistant/components/geniushub/switch.py at async_turn_on and trace how ATTR_DURATION is passed to self._zone.set_override; the traceback points to geniushubclient/zone.py line 300. Reproduce the switch-override call with a duration such as 36000 seconds, then verify it completes without the datetime.timedelta TypeError and applies the requested duration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 74/100