Simple Automation problems

So my apologies, first of all. This is my first automation attempt, so I wanted to start simple but for whatever reason it doesn’t seem to be working.

The goal is to get lights to turn on or off based on movement / not detecting movement.

My automation.yaml is as follows:

- alias: 'Lights Off'
  trigger:
    platform: state
    entity_id:  binary_sensor.hallway_motion
    from: 'On'
    to:  'Off'
  action:
    service:  homeassistant.turn_off
    entity_id: light.level_2
  
- alias: 'Lights On'
  trigger:
    platform: state
    entity_id:  binary_sensor.hallway_motion
    from: 'Off'
    to: 'On'
  action:
    service: light.turn_on
    entity_id:  light.level_2

It’s paired with Monoprice 4-1 multisensor which I have configured using a template (thanks to the help of someone else; still don’t understand templating). Whenever I walk by it, I see it detect me, see it’s state change in HA, but the automation doesn’t trigger. What am I missing?

Thanks in advance for your input.

1 Like

Try lower case in your from: ‘on’ and to: ‘off’

1 Like

Ugh I’m an idiot. Thank you. That was it.

I plan on making them more complex (light level based on time of day, etc.) at some point.

Do you by chance know how to get the motion detector (monoprice multi-sensor) to detect motion more frequently? I just tested the “on” automation and I had to walk around a bit near the sensor before it detected me.

Thanks for your help! I truly appreciate it!

No worries. Happens to me too and sometimes you just need a second set of eyes.

Which component is it? I don’t see a Monoprice one. If it’s polling, you can sometimes set a scan_interval in the config. The issue with a lot of low power sensors is they don’t communicate too often in order to save the battery.

Yeah I think it’s what you said - low power to conserve battery. I know the manual stated it won’t communicate with the controller (HA in this case) unless it detected a significant change in one of its sensors. I was hoping there was a way to change the sensitivity or the sensor or something like that.

There is no component for it, which is why I had to use a template to convert it into a binary sensor - I will try scan_interval though and see what happens.

Thanks again!

You shouldn’t have to create a binary sensor, as one is added when you add the multi sensor.

It would be something like “binary_sensor.xxxx_xxxx_multisensor_4in1_sensor” which is the one you want to use for motion.

@Coolie1101 Yeah I saw that one but wasn’t sure what to do with it. So would that entity work with the binary_sensor component documentation? Or, what’s the benefit to using that entity over the one that I’ve made using the template?

If it already creates a binary sensor, it should be more efficient to use that one in your automation than creating a new one with the template binary_sensor. Try it out and see if that solves the latency issue.

I’ll give it a go and see if it helps. Thank you!

Another question re the sensor: I can’t seem to get two of it’s states (alarm type and something else I can’t recall right now) hidden from my front end. I have the entities correct in my customize.yaml but they don’t disappear like the rest of the various sensors did. Any experience with that?

@TortiousTortoise The way I do it is use a default_view in my groups and then list the entities I want to display rather than hiding the ones I don’t want to.

@Jer78 That makes more sense than the way I’m doing it, especially as I get more devices connected. Thanks again. I appreciate all the input and the advice.

You absolutely can adjust the sensitivity on this device, if it’s the same one I’m using (and I think it is).

Go to the Configuration tab in Home Assistant, select Z-Wave, and then scroll down to Z-Wave Node Management. There’s a drop-down list of all of your z-wave nodes, so select your multisensor (mine shows up as “Vision ZP3111 Multisensor 4in1”).

Then scroll down some more to “Node config options” and in the drop-down list where it says “Config parameter,” select “6: Motion Sensor Sensitivity Adjustment.” Then in the box below, enter a number from 1 to 7 (1 is most sensitive, and I have mine set to 2) and click on “SET CONFIG PARAMETER.”

Done. :grinning:

@wixoff Thanks! That was super helpful.

Another dumb question: after I set the parameter and go to a different one, and then reopen the last parameter, it still shows up as what it was originally. Is that just default, or am I not properly updating the device? I made sure to wake it up by walking in front of it.

For example, I went to re-set the sensitivity to 2. I left that parameter, went to the re-trigger duration and set that, then went back to the sensitivity and it was back to it’s original “4” level. Am I doing something wrong?

I honestly don’t know. To be extra conservative, try setting one parameter at a time, hit SET CONFIG PARAMETER, then wake it up.

Sounds good. I just wrote another automation that I can’t seem to figure out what went wrong

- alias: 'Lights On'
  trigger:
    platform: state
    entity_id:  binary_sensor.vision_zp3111_multisensor_4in1_sensor
    from: 'off'
    to: 'on'
  condition:
    condition:  and
    conditions:
      - condition:  sun
        after:  sunset
      - condition:  time
        after:  '18:00:00'
        before: '22:00:00'
  action:
    - service: light.turn_on
      data:
        entity_id:  light.level_2
        brightness_pct: 100

Any thoughts? I’m trying to have the light come on upon motion at a certain brightness if it’s between 6pm and 10pm. I have a separate automation for between 10pm and 7am at a different brightness.

This one also doesn’t seem to be working anymore. I’m confused haha

- alias: 'Lights Off'
  trigger:
    platform: state
    entity_id:  binary_sensor.vision_zp3111_multisensor_4in1_sensor
    from: 'on'
    to:  'off'
    for:
      hours:  0
      minutes:  0
      seconds:  30
  action:
    service:  lights.turn_off
    entity_id: light.level_2

it might be wise to check code and remove extra spaces …

Are all these automations actually on? I note that you don’t have initial_state: 'on' in any of them.

@miguelromao Thanks for pointing that out. I honestly don’t know why the extra spaces got added.

@anon43302295 they used to work without an initial_state when I didn’t have the more complex automations. When it was solely based on motion, both the on and the off automations worked.

Yes, but without initial_state you’re only one slightly imperfect restart away from them all being switched off.