I’m really struggling to get this timer to accept a number of minutes from a input_number slider. Any help most appreciated.
This is the full error I receive when invoking timer.start automation
unsupported operand type(s) for +: 'datetime.datetime' and 'NoneType'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 133, in handle_call_service
connection.context(msg),
File "/usr/src/homeassistant/homeassistant/core.py", line 1236, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1261, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
self._platforms.values(), func, call, service_name, required_features
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 348, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 370, in _handle_service_platform_call
await getattr(entity, func)(**data)
File "/usr/src/homeassistant/homeassistant/components/timer/__init__.py", line 175, in async_start
self._end = start + self._duration
TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'NoneType'
my config
## hot water boost
input_number:
boost:
name: boost
initial: 30
min: 30
max: 120
step: 10
mode: slider
timer:
boost:
name: boost
#### my automations
- alias: Timer start
trigger:
platform: state
entity_id: input_boolean.boost
to: 'on'
action:
- service: timer.start
data_template:
entity_id: timer.boost
duration: "{{ states('input_number.boost') | int * 60}}"
# - service: switch.turn_on
# entity_id: switch.water_boost_timer_switch_switch
- alias: Timer cancel
trigger:
platform: state
entity_id: switch.water_boost_timer_switch_switch
to: 'off'
action:
entity_id: timer.boost
service: timer.cancel
- alias: Timer stop
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.boost
action:
entity_id: switch.water_boost_timer_switch_switch
service: switch.turn_off