Ask for an example code sensor that uses a binary door sensor to open the freezer. and open the lower door to make a sensor to show the results. Example
Close all, pass door_all_close.
Open top but close the bottom door, pass door_open_up .
Close top but open bottom, pass door_open_down .
both open door_open_all
will bring it to show the picture in picture-elements card, but I can’t figure out how to write the code.
-
platform: template
sensors:
-
name: “refrigerator_state”
state: >
{ if is_state {states(‘binary_sensor.door_refrigerator_cool_contact’), ‘off’} and {states(‘binary_sensor.door_refrigerator_freezer_contact’), ‘off’} }
refrigerator_close
{ if is_state {states(‘binary_sensor.door_refrigerator_cool_contact’), ‘on’} and {s}tates(‘binary_sensor.door_refrigerator_freezer_contact’), ‘off’} }
refrigerator_open_down
{ if is_state {states(‘binary_sensor.door_refrigerator_cool_contact’), ‘off’} and {states(‘binary_sensor.door_refrigerator_freezer_contact’), ‘on’} }
refrigerator_open_up
{ if is_state {states(‘binary_sensor.door_refrigerator_cool_contact’), ‘on’} and {states(‘binary_sensor.door_refrigerator_freezer_contact’), ‘on’} }
refrigerator_open_all
{ endif }
-