Template for Z-Wave Switch + Hue Combination


I am attempting to combine a Hue Light that is connected to a z-wave switch into a single control for Home Assistant. I have currently done it this way [1]. However, when HA starts, I get the following error when I boot:

2018-04-24 12:15:53 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.mantle_light fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 204, in async_update_ha_state
  yield from self.async_device_update()
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 325, in async_device_update
yield from self.async_update()
File "/usr/lib/python3.5/asyncio/coroutines.py", line 210, in coro
 res = func(*args, **kw)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/template.py", line 263, in async_update
if 0 <= int(brightness) <= 255:
ValueError: invalid literal for int() with base 10: ''

This smells to me like a side effect of zwave not being up when my template first attempts to load. Is there a way I can delay the loading of a template until a subsystem is ready (or until a entity returns a particular value)?

  • Ben

[1] https://github.com/bmenchaca/homeassistant-config/blob/master/config/lights.yaml

1 Like

you can set a default value for brightness : brightness | default (0) for example. That might remove the error