I’m trying to create an automation that will essentially disable my 6 year old son’s Alexa when he is in time out (which happens too often!). I’m really just throwing every setting at it that I can think of. But just wondering if anyone has any suggestions to improve it. It works, but sometimes he can still get it to talk to him.
I have an input_boolean to turn the automation on/off. And then it will re-trigger itself if he tries to turn the volume back up. Any thoughts or suggestions would be greatly appreciated!
- id: alexa_off
alias: Alexa Off
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.kid_alexa
to: 'off'
- platform: state
entity_id: media_player.kid_echo_dot
condition:
condition: or
conditions:
- condition: state
entity_id: input_boolean.kid_alexa
state: 'off'
- condition: and
conditions:
- condition: state
entity_id: input_boolean.kid_alexa
state: 'off'
- condition: template
value_template: '{{ trigger.to_state.attributes.volume_level | float > 0 }}' # Volume has been raised above 0
action:
- service: media_player.volume_set
entity_id: media_player.kid_echo_dot
data:
volume_level: 0
- delay: '00:00:01'
- service: media_player.volume_mute
entity_id: media_player.kid_echo_dot
data:
is_volume_muted: true
- delay: '00:00:01'
- service: media_player.turn_off
entity_id: media_player.kid_echo_dot
- delay: '00:00:01'
- service: switch.turn_on
entity_id: switch.kid_echo_dot_do_not_disturb_switch
I probably would have went with the same things you have in your automation… next step would be a switched plug and you can kill power to it altogether… as long as it’s somewhat hidden so he can’t just power it back on
Thanks for the feedback, @Bartem! My first idea was to use a smart plug. That would be way easier. But he’s smart enough to just move the Echo to a different outlet.
Oh well that stinks, plugs were off-limits for mine at that age they wouldn’t dare try to plug anything in without help… show him a couple videos or pretend you are getting zapped one time when plugging something in… that may keep him away
Ya know you could make an automation to tell you when he uses it, with the last alexa used sensor and as part of your other automation toggle an input_boolean so it only notifies you if he tries to use it when it is “off”
So, that looks like it is creating a sensor that tells you which Alexa device was last called. It is a step in the right direction, but I don’t think it tells me exactly what I need to know. I am more interested in triggering each time his particular Alexa is called.
I found there is an attribute called last_called_timestamp that changes every time you call Alexa. I think this is what I am looking for. I’m just not sure how to incorporate it into an automation. I would need to know that the value changed or incremented. Thoughts?
So you create the last alexa sensor as mentioned in the link, then make an automation that watches for a state change of media_player.your_kids_echo in the sensor.last_alexa… but also have a condition that watches an input_Boolean which you make that gets toggled when you want to “disable” the alexa so you only get the notification if he is not supposed to be using it
If I understand that sensor correctly, it gives you the last Alexa device that was used. So wouldn’t this be an issue:
Boolean turns on
He calls Alexa
State changes, so automation fires
He calls Alexa again
State is still the same Alexa, so trigger does not fire
That’s why I was thinking the last_called_timestamp attribute might work better for this scenario. I just need to figure out how to recognize when it changes.
I haven’t tested it yet because my son is asleep now. But I THINK this might do the trick. The idea being that if the Last Called Timestamp has incremented, then he has just activated Alexa.
- condition: and
conditions:
- condition: state
entity_id: input_boolean.kid_alexa
state: 'off'
- condition: template
value_template: '{{ trigger.to_state.attributes.last_called_timestamp | float > trigger.from_state.attributes.last_called_timestamp | float }}' # Alexa has been triggered
Lol, 6yo comfy plugging stuff in/out… reminds me of being the tender age of 8, dropping pennies on top of partially pulled out plugs so I could see the arc flash and show off melted pennies to friends.
Wait till they’re school age… if there is still ‘distance learning’, you’ll find the ‘tech methods’ of parenting of limited use. With all the tls secured meetings etc… there’s no real way to ‘keep the tech on task’ without literally looking over their shoulder.
I’ve got it working now. Here is the finished product, if anyone is interested. I’m sure there is still a better way to accomplish this, so I am still open to suggestions if someone has better ideas!