mtabbut
(Matt)
1
Has anyone made a 3 way sensor? I am looking for a way to make a sensor that displays one of 3 states based on inputs from 2 binary sensors.
Example logic:
Sensor 1 on, sensor 2 off = state 1
Sensor 1 off, sensor 2 on = state 2
Sensor 1 off, sensor 2 off = state 3
You need a template sensor
- platform: template
sensors:
your_three_state_sensor:
friendly_name: 'Three Is The Best Number'
value_template: >
{% if states.binary_sensor.sensor_1.state == 'on' and states.binary_sensor.sensor_2.state =='off' %}
state 1
{% elif states.binary_sensor.sensor_1.state == 'off' and states.binary_sensor.sensor_2.state =='on' %}
state 2
{% elif states.binary_sensor.sensor_1.state == 'off' and states.binary_sensor.sensor_2.state =='off' %}
state 3
{% else %}
Boom !
{% endif %}
You’re welcome 
- platform: template
sensors:
solar_angle:
friendly_name: "Name"
value_template: "{% if (states.sensor.one.state == 'on' and states.sensor.two == 'off') %}state 1{% elif (states.sensor.one.state == 'off' and states.sensor.two == 'on') %}state 2{% elif (states.sensor.one.state == 'off' and states.sensor.two == 'off') %}state 3{% endif %}"