Sensor vs Binary Sensor, Missing Binary Sensor

I’m not using binary sensor template in automation, I don’t think it’s allowed but only can be used in config file. I am using binary sensor(not template) in automation file.

Btw, I cannot find where I copied the example code where there was 1 s?

With this particular device, none of the nodes start with “binary”, they all start with “sensor” because there is a burglar, temp, alarm etc… sensor but NO binary_sensor anything. That is why you have to create a binary_sensor: template.

I’m using binary_sensor in automation Here:

- 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

- alias: Turn off couch light 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

and here

    # MOTION HALLWAY ON 
- 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

But I have to use binary_sensor: template here in config file because none of the entity ids start with binary only sensor

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') }}"

You are completely and almost hopelessly confused.

I only say that because of the history of the conversations we’ve had here and in person. I’ve explained these things to you multiple times in our talks.

So I’m kind of lost on how to proceed… :man_shrugging: But I’ll give it one more try.

in your config you created a template binary_sensor. you called that sensor “binary_sensor.bathroom_fan_motion”. So now you should have that binary_sensor existing in your system and you should see it in your states page.

You configured that binary sensor to be turned on & off by the state of the sensor “sensor.ge_26931_smart_motion_switch_burglar_5” going to and from the state of 8. So you should be able to see the binary_sensor changing states in response to the “sensor.ge_26931_smart_motion_switch_burglar_5” changing states between 8 and something other than 8.

You also put a delay_off in the config for the sensor that causes the “binary_sensor.bathroom_fan_motion” that you created to stay on for an additional two minutes after “sensor.ge_26931_smart_motion_switch_burglar_5” changes state from 8 to some other state.

you now have to use that binary sensor you created (“binary_sensor.bathroom_fan_motion”) in an automation to trigger some desired action. I assume that desired action is to control the operation of an entity that provides power to a bathroom fan. I’m assuming it’s “switch.ge_26931_smart_motion_switch_switch_5”.

I’ve given you all the information you need to try to put all of this together in a working automation. Let’s see if you can go the last few steps and bring it over the finish.

Do you understand any of that?

Oh Gheez! That make complete sense now.

When I created the sensor template, I did not know it created something new in the States page.
I thought (from the examples) all I needed to do was create a binary sensor template telling what that sensor to do in config file and that was it. I wan’t realizing that the template created a binary_sensor bridge that I could then use in automations!

I’m guessing I should delete the “delay_off” in the config file and keep all actions in the automations file.

I see it clear as day now after your thorough and PATIENT explanation!

Thank you for being patient. I believe I am getting the hang of this. It’s actually very simple looking at the way you explained it.

yes, I would remove it.

You’re welcome.

But you’re making it difficult… :wink:

It’s not difficult anymore.
You should write their documentation :slightly_smiling_face:

1 Like

I think I am very close. I tried and re-looked at everything before I sent this message.
Fan still turns off after about 10 seconds. I feel something else is overriding it somewhere?

Here is what I have:
Config:

     # TEMPLATE MOTION FAN SECOND BATHROOM
binary_sensor:
  - platform: template
    sensors:
      second_bathroom_fan_motion: 
        friendly_name: "second_bathroom_fan_motion"
        device_class: motion
        value_template: "{{ is_state('sensor.ge_26931_smart_motion_switch_burglar_5', '8') }}"
        

Automations:
# Motion Fan 2nd Bathroom  FROM TEMPLATE CONFIG FILE
    
- alias: Bathroom Fan
  trigger:
    - platform: state
      entity_id: binary_sensor.bathroom_fan_motion #<- 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: binary_sensor.bathroom_fan_motion #<- This should be your motion sensor
      to: 'off'
      for:
        minutes: 1
  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

States:


I don’t know why this say s “binary_sensor.bathroom_fan_motion” when it’s named “binary.sensor_second_bathroom_fan_motion” everywhere else?

node_15
More state info( may not need all of it but here it is).





I did switch alias in automations to:

- alias: second_bathroom_fan_motion

I did notice this. That is not a happy face. I’m not using it but??
image
image

i assume you have your automations in automations.yaml and not in your configuration.yaml and nowhere else, correct?

if so then post the entire contents of your automations.yaml file.

I believe so. I don’t recall using any other files except config and automations. All my automations are in automations.yaml.

Here is automations.yaml

#- alias: some alias timed lights 
#  initial_state: 'true'
#  trigger:
#    platform: time
#    at: "22:35:00"
#  action:
#    service: switch.turn_on
#    entity_id: switch.light_livingroom_couch
    
    #This works
- 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
                        #OFF
- alias: Turn off couch light 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
    
    
    
    #MOTION LIGHT ON on BATHROOM
#- id: 
#- alias: 2nd BATHroom Light. This one TOO
  #trigger:
    #- platform: state
    #- entity_id: sensor.ge_26931_smart_motion_switch_sourcenodeid_4 #<- This should be your motion sensor or binary_sensor
     # to: 'on'
      #for: 
     #   minutes: 2
  #condition:
   #- condition: time
#     after: '20:00:00' # <- motion will only trigger the light on between these times
#     before: '05:00:00'
  #action:
  #- data:
   # - service: switch.turn_on # or switch.turn_on  # or use homeassistant.turn_on
    #- entity_id: switch.ge_26931_smart_motion_switch_switch_4 #light.your_light # <- this should be your light entity_id
    
    
    # MOTION LIGHT ON/OFF After 10 Min BATHROOM
#- id: switch.ge_26931_smart_motion_switch_switch_3
                #ON
- alias: 2nd BATHroom Light. This one TOO
  trigger:
    - platform: state
      entity_id: sensor.ge_26931_smart_motion_switch_burglar_3,sensor.ge_26931_smart_motion_switch_alarm_level_3 #<- 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_3 
        
                 #OFF
- alias: 2nd BATHroom Light. This one TOO
  trigger:
    - platform: state
      entity_id: sensor.ge_26931_smart_motion_switch_burglar_3,sensor.ge_26931_smart_motion_switch_alarm_level_3 #<- This should be your motion sensor
      to: 'off'
      for:
        minutes: 1
  action:
   - service: switch.turn_off  #or light.turn_off
     entity_id: switch.ge_26931_smart_motion_switch_switch_3 # or light.your_light # <- this should be your light entity_id
    
    
# Motion Fan 2nd Bathroom  FROM TEMPLATE CONFIG FILE
    
- alias: second_bathroom_fan_motion
  trigger:
    - platform: state
      entity_id: binary_sensor.second_bathroom_fan_motion #<- 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: second_bathroom_fan_motion
  trigger:
    - platform: state
      entity_id: binary_sensor.second_bathroom_fan_motion #<- This should be your motion sensor
      to: 'off'
      for:
        minutes: 1
  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
    
     
 
        
        
        
        
        
    #This works
    # MOTION HALLWAY ON 
- 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
     
     
     
     # MOTION KITCHEN ON
- alias: Kitchen Light    
  trigger: 
    - platform: state
      entity_id: sensor.aeotec_zw100_multisensor_6_burglar
      to: 'on'
  action:
   - service: switch.turn_on
     entity_id: switch.ge_unknown_type_4952_id_3130_switch_2
     
     # OFF
- alias: Kitchen Light #OFF 1 minutes after last movement
  trigger:
   - platform: state
     entity_id: sensor.aeotec_zw100_multisensor_6_burglar
     to: 'off'
     for:
      minutes: 1
      
  action:
    service: switch.turn_off
    entity_id: switch.ge_unknown_type_4952_id_3130_switch_2  
     
     
     
     
     
# Motion Hall Way online

#- platform: template
#  sensors:
#    Hall_Way_Motion:
#      entity_id: switch.ge_unknown_type_4952_id_3130_switch
#      value_template: >-
#          {%- if is_state("sensor.zooz_zse40_4_in_1_sensor_burglar", "0") -%}
#              No
#          {%- else -%}
#              Yes
#          {%- endif -%}
    
    
    
    # automation:
#  initial_state: 'true'
#  trigger:
#    platform: time
#    at: "09:55:00"
#  action:
#    service: switch.turn_on
#    entity_id: switch.light_livingroom_couch
    
     
     
#automation:
#  - alias: 'Send notification when sun rises'
#    trigger:
#      platform: sun
#      event: sunrise
#      offset: '+00:00:00'
#    action:
#      service: notify.pushbullet     
     
     
#automation:
 # trigger:
  #  platform: time
   # at: "07:15:00"
  #action:
   # service: light.turn_on
    #entity_id: light.bedroom
    #data:
      # 900 seconds = 15 minutes
     # transition: 900

I honestly am having a hard time deciding where to begin on what’s wrong with that code you posted…

A few of those automations will work the way they are written (assuming your entity_id’s are correct) except that the alias’s are duplicated. So that makes it difficult to know in your states page which automation is the ‘on’ or the ‘off’ automation. I assume that the system will just append a “_2” to the second automation that has the same alias as the first. Or it might give an error in the log and not allow the second one to work? I really don’t know since I’ve never (or seen any ) written any like that.

the others can’t work because you are using ‘on’ & ‘off’ in the triggers for entities that don’t ever have a state that is ‘on’ or ‘off’.

And I found some indentation errors too.

I’ve rewritten the automations to at least make them more readable and to fix the duplicated alias issues. Here are those:

these should work ...?

- alias: second_bathroom_fan_motion on
  trigger:
    - platform: state
      entity_id: binary_sensor.second_bathroom_fan_motion
      to: 'on'
  action:
    - service: switch.turn_on  
      entity_id: switch.ge_26931_smart_motion_switch_switch_5
        
- alias: second_bathroom_fan_motion off
  trigger:
    - platform: state
      entity_id: binary_sensor.second_bathroom_fan_motion
      to: 'off'
      for:
        minutes: 1
  action:
    - service: switch.turn_off
      entity_id: switch.ge_26931_smart_motion_switch_switch_5
	 
- 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

- alias: Turn off couch light 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
    
- alias: Hall Way Light on
  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
     
- alias: Turn Hall Way off
  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
     
these can't work because of the wrong states...
     
- alias: Kitchen Light on
  trigger: 
    - platform: state
      entity_id: sensor.aeotec_zw100_multisensor_6_burglar
      to: 'on'
  action:
    - service: switch.turn_on
      entity_id: switch.ge_unknown_type_4952_id_3130_switch_2
     
- alias: Kitchen Light off
  trigger:
   - platform: state
     entity_id: sensor.aeotec_zw100_multisensor_6_burglar
     to: 'off'
     for:
       minutes: 1
  action:
    service: switch.turn_off
    entity_id: switch.ge_unknown_type_4952_id_3130_switch_2  
     
- alias: 2nd BATHroom Light on
  trigger:
    - platform: state
      entity_id: 
        - sensor.ge_26931_smart_motion_switch_burglar_3
        - sensor.ge_26931_smart_motion_switch_alarm_level_3
      to: 'on'
  action:
    - service: switch.turn_on
      entity_id: switch.ge_26931_smart_motion_switch_switch_3 
        
- alias: 2nd BATHroom Light off
  trigger:
    - platform: state
      entity_id:
	- sensor.ge_26931_smart_motion_switch_burglar_3
	- sensor.ge_26931_smart_motion_switch_alarm_level_3
      to: 'off'
      for:
        minutes: 1
  action:
    - service: switch.turn_off
      entity_id: switch.ge_26931_smart_motion_switch_switch_3

as far as the one automation that we had been focusing on I don’t see any reason why that would be turning the light off after 15 seconds instead of 1 minute.

The only thing I can think of is that since the device is a combination switch & motion detector that maybe the switch is set up internally to be turned off 15 seconds after the motion detector goes off. So then it would ignore HA telling it to go off because it will already be off at 1 minute since it has already been turned off by some internal programming at the 15 second point.

you could do a test and change the off delay in HA from 1 minute to 5 seconds and see if that works. If it does then that tells you the automation is working and you need to look into the device programming itself.

Thank you for writing this!
I changed the time from 1 min to .05, .1 and it did nothing.

I did notice something here.
image

And this. BUT the hall way does work correctly

I do recall changing a setting in one of the nodes to 8 seconds, but I can not longer find node_15 in this list and honestly, I am not even sure if I modified this node but it does turn off in 8 seconds.

I might have to call GE and see what they say.

All I know is, I have Airbnb guests arriving mid month February and need to get this working, lol

That’s probably because the code can’t use “.05” or “.1” in the “minutes:” section.

You need to look up the docs and see how to correctly use the “for:” to use seconds.

there is no way for us to know where that dead node came from. From the information you provided there is no “second_bathroom_fan_motion” node. You’ll have to figure out where that is & why it’s dead.

Those are just a list of the entity_id of your automations. Those could change (and should change if you used my code posted above) if you change the alias’s of the automations.

Yeah, good luck with that. You’ve been working on this system for a long time and it’s still kind of in a shambles.

So I copied the code you gave me and switched out entity ids for the light motion in same bath room and created another binary sensor template.

  #TEMPLATE BATHROOM LIGHT MOTION
binary_sensor:
  - platform: template
    sensors:
      second_bathroom_light: 
        friendly_name: "2nd BATHROOM MOTION LIGHT.This ONE"
        device_class: motion
        #delay_off:
         # minutes: 1
        value_template: "{{ is_state('switch.ge_26931_smart_motion_switch_switch_3', '8') }}"
        
     and added to the automations file...

     ### Bathroom lighit motion
- alias: 2nd BATHROOM MOTION LIGHT.This ONE on
  trigger:
    - platform: state
      entity_id: binary_sensor.second_bathroom_light
      to: 'on'
  action:
    - service: switch.turn_on  
      entity_id: switch.ge_26931_smart_motion_switch_switch_3
        
- alias: 2nd BATHROOM MOTION LIGHT.This ONE off
  trigger:
    - platform: state
      entity_id: binary_sensor.second_bathroom_light
      to: 'off'
      for:
        milliseconds: 3000
  action:
    - service: switch.turn_off
      entity_id: switch.ge_26931_smart_motion_switch_switch_3
    And it does not work :frowning:

Then I noticed this error. And that is the node for light in bathroom

I’m perplexed

Do you think I should delete the nodes and start over for these two nodes 14 and 15?

Why did you change the binary sensor template?

the way you have it now it won’t ever be ‘on’ because the state of the switch.ge_26931_smart_motion_switch_switch_3 will never be ‘8’. The state of the switch will only ever be ‘on’ or ‘off’.

I don’t know.

I don’t know what node 14 or node 15 are.

I didn’t change it, I added another one for the light. One for Fan and one for Light.
Config file:

    # TEMPLATE MOTION FAN SECOND BATHROOM
binary_sensor:
  - platform: template
    sensors:
      second_bathroom_fan_motion: 
        friendly_name: "second_bathroom_fan_motion"
        device_class: motion
        #delay_off:
         # minutes: 1
        value_template: "{{ is_state('sensor.ge_26931_smart_motion_switch_burglar_5', '8') }}"
        
        
        
     #TEMPLATE BATHROOM LIGHT MOTION
binary_sensor:
  - platform: template
    sensors:
      second_bathroom_light: 
        friendly_name: "2nd BATHROOM MOTION LIGHT.This ONE"
        device_class: motion
        #delay_off:
         # minutes: 1
        value_template: "{{ is_state('switch.ge_26931_smart_motion_switch_switch_3', '8') }}"

node_14 is light
node_15 is fan

OMG!

This setting in “Manage Your Z wave Network” are what determine the time delay. My light motion (node_14) is set to 5 min delay shut off and that is when it shuts off. I set the fan motion (node_15) to 8 seconds and that’s when it turns off, that was awhile ago.

Problem, I can’t get back into “Manage Your Z wave Network” for node_15 for the fan, it does not display anymore, why?

Do you know where the hard code (file)for these settings are (not GUI from these pics)?


:man_facepalming: :man_facepalming: :man_facepalming:

Dude, I thought we had the whole template binary_sensor/burglar/switch thing figured out?

you completely ignored this:

and I suggested that you look into the node config parameters to see if the cause of the fan turning off early was in there somewhere three days ago.

Here:

and you also completely ignored me when I tried to tell you that the “for:->minute:” options won’t accept fractions.

here:

You keep ignoring things I tell you and start jumping around all over and you aren’t retaining any of the information I’m giving you so we have to keep rehashing the basics over and over again.

TBH, I’m not sure if I can help you.

Btw, I never changed the setting parameters in the GUI for the light. I never changed it to 5 min. That’s where it was when I saw it. However, I did change the parameter for the fan to 8 seconds.

Finity:
the way you have it now it won’t ever be ‘on’ because the state of the switch.ge_26931_smart_motion_switch_switch_3 will never be ‘8’. The state of the switch will only ever be ‘on’ or ‘off’

That is what the example shows, to set it to 8.
This circle here “254” turns to “8” when there is motion. I have seen it change to 8.
image

Finity:
and you also completely ignored me when I tried to tell you that the “for:->minute:” options won’t accept fractions.

I did not ignore you. I found I had to change it to milliseconds

- alias: 2nd BATHROOM MOTION LIGHT.This ONE off
  trigger:
    - platform: state
      entity_id: binary_sensor.second_bathroom_light
      to: 'off'
      for:
        milliseconds: 3000
  action:
    - service: switch.turn_off
      entity_id: switch.ge_26931_smart_motion_switch_switch_3

How about a remote login to my computer again?