I have an automation condition that is driving me nuts… I’m trying to do a simple AND condition checking the state of two entities and then fire an alert. If I put each entity in by itself, I get the alert, so I know I have the entities right. As a further test, I tried using the same entity_id (shown below) with an AND in it… This doesn’t fire, however if I change the ‘and’ to an ‘or’ it fires. Seems the below should fire either way. My end results, the second entity_id will be another device with a state of ‘on’…
- alias: MediaTVAlert
trigger:
- platform: time
seconds: 15
condition:
condition: and
conditions:
- condition: state
entity_id: media_player.denon_avrs910w
state: 'off'
- condition: state
entity_id: media_player.denon_avrs910w
state: ‘off’
action:
service: notify.ios_qiphone
data:
title: "Media TV Alert"
message: "TV in Media Room has been left on"
data:
push:
thread-id: “MediaTVAlert-1”
you appear to have 2 identical conditions and your whole code is unreadable because you didn’t follow the instructions at the top telling you how to post code.
My bad - fixed the code block… Yes, in the example above I do have two of the same… As mentioned that was for testing and trying to better illustrate that the ‘and’ isn’t working while putting an ‘or’ there instead does work — two exact items ANDed together or the same two items ORed together should yield the same results to me.
End results my condition would look like this once I can figure out the ‘and’ issue:
- alias: MediaTVAlert
trigger:
- platform: time
minutes: 15
condition:
condition: and
conditions:
- condition: state
entity_id: binary_sensor.media_tv_status
state: 'on'
- condition: state
entity_id: media_player.denon_avrs910w
state: ‘off’
action:
service: notify.ios_qiphone
data:
title: "Media TV Alert"
message: "TV in Media Room has been left on"
data:
push:
thread-id: “MediaTVAlert-1”
@DavidFW1960 I want to check these two conditions every 15 minutes to detect if the device was left on.
@sparkydave I tried not having the and condition and got the same behavior. I’ve tried numerous scenarios and testing methods. Sure it’s something simple but I can’t see it.
I’m not sure how else I would do it… I saw some examples of using the platform time as a trigger elsewhere… If I remove the and conditions and have just 1 (either one) it works and fires every 15 minutes as i would expect.
Verified — that got it to fire correctly… Doesn’t help I’ve been doing all my edits vis ssh on my iPad either… seems and ssh session really dicks with tick marks for some reason. Thanks! Don’t know that I would have seen that.