#I think this is the right place to ask I
1 messages ยท Page 1 of 1 (latest)
@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)
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
For the action should I trigger a "scene"?
So, I took a screenshot but I can't see how to attach (this discord is different?)
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
(I think attachments might not work becasue I'm new to the server)
Correct
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
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
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.
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?
yeah, so, I don't think the kasa device exposes "motion"
ok, but this one "works" eg. it does what you wnat?
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
Exactly.. when** YOU** turn on the patio. expected
But the "Motion" part.... does not work right?
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
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.
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
ok/ And you're ok with that.. meaning that patio light will always be driven by motion
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
๐ 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
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?
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
(one sec switching to moving home) will attempt in about 15 minutes.
Basically I am combining the two, with a few complexity (But nothing too complex neither)
- For each trigger I am defining an id
motion_triggeredormotion_cleared - Then the action is a new bloc called
choosewhen depending on the trigger that triggered the automation (eithermotion_triggeredormotion_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.