Using ELK Motion to trigger Zwave Switch

I am new to Home Assistant, but used ISY for years.

I am trying to write a simple Home Assistant program to use my Elk Motion sensor to trigger a light on.

I have the Elk M1 configured/connected with Home Assistant, and my Zwave switches are also ready to be used.

Not sure how I use the Elk Motion.
It is not shown in “Devices”
I can see it as an “Entity” but not sure how to get that in the Automation.

Do I need to do something to allow Home Assistant to see the Elk Motion as a device?

What is the motion detector’s entity_id? Does it begin with sensor or binary_sensor?

Go to Developer Tools > States, scroll through the list of entity_ids until you find the one that’s your motion detector. Tell me what it’s reporting as its current state value.

It is best to avoid devices in automations any time you can.

For triggers and conditions, state or numerical state are most used. For motion, it would most likely be state. From there you can pick the entity.

For actions, services are most used. To turn a light on, light.turn_on would be the right pick (unless it is defined as a switch, then switch.turn_on). There too the entities can be selected, along with service specific other options (e.g. light brightness if it supports that).

Services also support templates, this is a relevant example automation for just your use case:

State = Off

ElkM1 Basement Motion off name: Basement Motion definition: 16 logical_status: 0 physical_status: 3 area: 0 voltage: 0 temperature: -60 triggered_alarm: false index: 1 friendly_name: ElkM1 Basement Motion

I think I am stuck here…

I suggest you use a State Trigger and, for the trigger’s entity, pick binary_sensor.elkm1_basement_motion. In the To field, pick On.

The result will be a State Trigger that triggers when the binary_sensor turns on (i.e. motion detected).

The YAML version will look like this:

  - platform: state
    entity_id: binary_sensor.elkm1_basement_motion
    to: 'on'

Here’s a slightly better version that explicitly indicates it will trigger only for a state-change from off to on (not from any other state such as unavailable).

  - platform: state
    entity_id: binary_sensor.elkm1_basement_motion
    from: 'off' 
    to: 'on'

I can add it.
But I get Malformed intergration when I add the ‘off’ and ‘on’

YAML relies on proper indentation. If something is indented too much, or too little, it takes on a different meaning, typically something that’s incorrect.

Move the last two lines to the left by two spaces so that it looks like this:

platform: state
  - binary_sensor.elkm1_basement_motion
from: 'off' 
to: 'on'

Same thing…

I dunno if this helps
This is what Home Assisant Log shows when I walk around the basement.

Well this works, not sure it is 100% correct.
It is just a change in “state” on the sensor. Not on or off.
When I walk in the room the lights turn on…

The faulty example you posted is not what I had suggested. Compare what you posted to what I suggested, line by line. See the difference?

I hope so; that’s the most basic form of State Trigger. However it’s also the most permissive and will trigger for any kind of state-change as well as any change in the value of any of its attributes.

I agree I need to keep working on it. But I think it proves that my HA and ELK are communicating and working. Now just need to get the coding correct.

And I see what I missed from your other post.
Now this works.

Glad to hear it works now.

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.