I have 2 binary sensors which are connected to my house alarm, I would like to create a third binary sensor which detects when the alarm is set in night time mode. The two binary sensors operate as follows:
Full set - ON when the alarm is set to away mode
any set - ON when the alarm is set to part, night OR away mode.
I would like a third sensor which turns on when full set is OFF but any set is ON, as this would indicate the alarm is in night mode.
Can anyone help with the config? I have this but its not working
I have tried your config but I get this error in the log, any ideas?
Update for sensor.template_alarm_status fails
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
await self.async_device_update()
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 347, in async_device_update
await self.async_update()
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/sensor/template.py", line 215, in async_update
setattr(self, property_name, template.async_render())
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/template.py", line 140, in async_render
return self._compiled.render(kwargs).strip()
File "/usr/local/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "<template>", line 5, in top-level template code
File "/usr/local/lib/python3.6/site-packages/jinja2/sandbox.py", line 427, in call
return __context.call(__obj, *args, **kwargs)
TypeError: is_state() takes 3 positional arguments but 5 were given
You are doing something wrong. The code i provided does not use is_state with 5 positional arguements. Your old code does, so you must have copied incorrectly or didn’t copy it at all. Try it again, do not try to write this yourself, just copy what I wrote and overwrite what you have.