I can get the binary sensors to work, but when there is no binary sensor ID and ONLY sensor ID’s my code is not working.
This works.
- alias: Hall Way Light
trigger:
- platform: state
entity_id: binary_sensor.aeotec_zwa005_trisensor_sensor_2
to: 'on'
action:
- service: switch.turn_on
entity_id: switch.ge_unknown_type_4952_id_3130_switch
# OFF
- alias: Turn Hall Way #OFF 1 minutes after last movement
trigger:
- platform: state
entity_id: binary_sensor.aeotec_zwa005_trisensor_sensor_2
to: 'off'
for:
minutes: 1
action:
service: switch.turn_off
entity_id: switch.ge_14288_duplex_receptacle_switch, switch.ge_14288_duplex_receptacle_switch_2,
switch.ge_unknown_type_4952_id_3130_switch
This does not work
- alias: Bathroom Fan
trigger:
- platform: state
entity_id: sensor.ge_26931_smart_motion_switch_burglar_5 #<- This should be your motion sensor
to: 'on'
action:
- service: switch.turn_on #or light.turn_off
entity_id: switch.ge_26931_smart_motion_switch_switch_5
#OFF
- alias: Bathroom Fan
trigger:
- platform: state
entity_id: sensor.ge_26931_smart_motion_switch_burglar_5 #<- This should be your motion sensor
to: 'off'
for:
minutes: 5
action:
- service: switch.turn_off #or light.turn_off
entity_id: switch.ge_26931_smart_motion_switch_switch_5 # or light.your_light # <- this should be your light entity_id
Check the state of sensor.ge_26931_smart_motion_switch_burglar_5 in the developer tools that you want to trigger from.
Its state may be “ON” or “TRUE” or something else - you need to match that test exactly in your trigger - binary sensors are a little more forgiving as the system knows they can only be on or off.
If you want to tease out a binary sensor from your sensor, you could use a binary template sensor
As already mentioned a sensor is not on or off. The burglar sensor will have a variable integer number, depending on what event is being detected. The meaning of the values is explained in the docs, along with an example binary template.
the sensors: and something here: statements seems redundant - remove it and try!
Also - is the value ‘8’ text or an integer? if an integer (number), you dont want quotes around it in your test.
Best is to test that logic in the template editor section of developer tools by removing the outer quotes from the value template formula and see if you get the true/false you are expecting evaluated from the formula
in the configuration.yaml, automtions.yaml, sensors.yaml or binary_sensors.yaml?
no, they aren’t redundant.
those lines are required for a template binary sensor.
removing either of those will cause an error.
All states are strings. So the quotes are required or you will get an incorrect result from the template because ‘8’ (a string value of the state of the sensor) will never equal 8 (an integer).
Even at that it would cause the template to fail but it wouldn’t cause an error in the config checker.
you have three threads going about the same problem and had three people all give you the same answers and then told all three people that they fixed it.
please. please keep all of the questions about the same problem all in one thread. That way you don’t waste peoples time giving you answers you’ve already gotten somewhere else.
I’m not even sure what you are trying to accomplish using a binary_sensor?
again, read the docs on the binary sensor. I don’t think the “delay_off” means what you think it means and the use of a binary_sensor is likely not what you want to be using.
I am using binary_sensor: template because this device does not put out the regular entity_id that says binary sensor so I have to create a template.
Ex.
Regular Automation file
- alias: Turn on couch light when there is movement
trigger:
platform: state
entity_id: binary_sensor.aeotec_zwa005_trisensor_sensor_2
to: 'on'
action:
service: switch.turn_on
entity_id: switch.ge_14288_duplex_receptacle_switch, switch.ge_14288_duplex_receptacle_switch_2
vs config file where template is created
binary_sensor:
- platform: template
sensors:
bathroom_fan_motion:
friendly_name: "second_ bathroom_ fan_ motion"
device_class: motion
delay_off:
minutes: 2
value_template: "{{ is_state('sensor.ge_26931_smart_motion_switch_burglar_5', '8')