#I think this is the right place to ask I

1 messages ยท Page 1 of 1 (latest)

tender heart
#

@cosmic yacht yeah all the kasa devices are integrated in HA. I'd rather do these integrations/automations/whatever-its-called inside HA as I may have a mix of different vendors in the future. right now I just have a handful of Kasa switches/plugs.

#

(started a thread because I might have a bunch more questions as this is the first real "customization" I'm doing in HA)

cosmic yacht
#

Then if you want to create an automation when your sensor goes off, go to Setting, automation, create new
For trigger pick State.

Inside the trigger

  • Entity: Your motion sensor (It should be a binary_sensor like detected or cleared basically)
  • And for "to" (meaning a change of state to a new state) pick "off" or "Clear"
#

That basically

#

This will trigger when your sensor goes off..

#

Then put everything you want in the "Action" part of the automation

tender heart
#

For the action should I trigger a "scene"?

cosmic yacht
#

Depends what you want to do

#

Entirely up to you

tender heart
#

So, I took a screenshot but I can't see how to attach (this discord is different?)

cosmic yacht
#

You said "I'd like to turn on more lights when that sensor goes off."
I would start by picking "Call Service" as action
Then "Light: Turn on"
And pick your light

tender heart
#

(I think attachments might not work becasue I'm new to the server)

cosmic yacht
#

Correct

tender heart
#

So, what I did was create an automation with a trigger of "patio turning on" that actions "turn on other light"

#

I'd like to do the same thing when the sensor turns off... do I need a second action for that?

#

err automation

cosmic yacht
#

Send me your automation by doing the floowing: Top of the screen (Top Right) click on the "three dots"
Then Edit in YAML

#

And send me the blob of text

tender heart
#
alias: backyard-motion
description: Turn on both patio and string lights when there is motion on the patio.
trigger:
  - platform: state
    entity_id:
      - light.switch_patio
    to: "on"
condition: []
action:
  - type: turn_on
    device_id: 65b54b65b3009ffb402620a01acd6950
    entity_id: 7f153d26fdcebb53179b00b475e593ce
    domain: light
    brightness_pct: 100
mode: single
#

hrmm, I'd like for that to use an entity name instead of id, it'd be easier to read.

cosmic yacht
#

So .. I do not know exaclty all your devices, but your trigger is NOT ABOUT MOTION here

#

IT's triggered when a specific light turning on

#

Is that what you want?

tender heart
#

yeah, so, I don't think the kasa device exposes "motion"

cosmic yacht
#

ok, but this one "works" eg. it does what you wnat?

tender heart
#

is there a way to list the entity "states" or things it exposes?

#

yeah, when I turn on the patio the other light turns on

#

so it does the "on" portion how I'd expect

cosmic yacht
#

Exactly.. when** YOU** turn on the patio. expected

#

But the "Motion" part.... does not work right?

tender heart
#

yeah, I'm away from home, I'll see when I move in front of it in a little bit. I'd suspect it works the same though becasue the device doesn't expose a "motion" state, it just turns on or off based on motion or timeout

cosmic yacht
#

Aaaaah ok ok I see
Sorry it's always the same thing when helping users, devices are different

#

So this light.switch_patio is actually alrady motion triggered

#

And you use the state of the light as a proxy for motion.

tender heart
#

yeah, its independently (in its own software) motion triggered, and HA "sees" the state of on/off

#

yeah, you've got it

#

I would attach a screenshot of the entity if I could

cosmic yacht
#

ok/ And you're ok with that.. meaning that patio light will always be driven by motion

tender heart
#

yeah, it also has a physical trigger that can be pressed

#

so basically I'm attempting to "slave" the state of the patio lights "on" or "off" to another entity that I want to mirror that same state

cosmic yacht
#

๐Ÿ‘ All clear, now I can answer your questions ๐Ÿ™‚

#

So YES. Two automations
ONe for turning on, one for turning off

#

Note that it's not the only way.. it's the simplest way for a beginner

#

LAter on you will leanr how to create complex automation that does different thgins based on diffenret triggers

#

But you can definitly start by just 2 automations.

When patio turns on : Turn on other stuff
When pation turns off: Turn off other stuff

#

Aaand that's it

tender heart
#

ok so that makes sense, easy to do, what is the more compelx method

#

I guess, can I use a condition to govern the action?

cosmic yacht
#

I can show you the more complex part

#

Gimme a sec

#

You can paste this into a new automation.
Do the same process.
Go in "YAML mode"
Paste this
And then go back in "Visual Editor" mode

#
alias: backyard-motion
description: Turn on and off lights based on Patio state
trigger:
  - platform: state
    entity_id:
      - light.switch_patio
    to: "on"
    id: motion_triggered
  - platform: state
    entity_id:
      - light.switch_patio
    to: "off"
    id: motion_cleared
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - motion_triggered
        sequence:
          - type: turn_on
            device_id: 65b54b65b3009ffb402620a01acd6950
            entity_id: 7f153d26fdcebb53179b00b475e593ce
            domain: light
            brightness_pct: 100
      - conditions:
          - condition: trigger
            id:
              - motion_cleared
        sequence:
          - type: turn_off
            device_id: 65b54b65b3009ffb402620a01acd6950
            entity_id: 7f153d26fdcebb53179b00b475e593ce
            domain: light
mode: single

tender heart
#

(one sec switching to moving home) will attempt in about 15 minutes.

cosmic yacht
#

Basically I am combining the two, with a few complexity (But nothing too complex neither)

  • For each trigger I am defining an id motion_triggered or motion_cleared
  • Then the action is a new bloc called choose when depending on the trigger that triggered the automation (either motion_triggered or motion_cleared) I do different stuff (Turning on or off)
#

NOte that I litteraly created this manually with your device names... so chances are it;s not going to work, but the structure is here.