- id: '1598780714813'
alias: Shed Door CLOSED
description: ''
trigger:
- entity_id: binary_sensor.shed_door
from: 'on'
platform: state
to: 'off'
condition: []
action:
- data:
message: The shed door is closed
service: notify.mobile_app_oneplus_a5000
- data:
entity_id: media_player.living_room_speaker
message: shed door CLOSED
service: tts.google_say
mode: single
- id: '1598780714814'
alias: Shed Door OPEN
description: ''
trigger:
- entity_id: binary_sensor.shed_door
from: 'off'
platform: state
to: 'on'
condition: []
action:
- data:
message: The shed door is OPEN
service: notify.mobile_app_oneplus_a5000
- data:
entity_id: media_player.living_room_speaker
message: shed door OPEN
service: tts.google_say
mode: single
Yeah he PMāD me too.
I know how frustrating doing something for the first time can be especially when you donāt feel you are making any progress.
I hope he has some light at the end of that tunnel.
Back to mqtt, why is it so different (yaml syntax wise) from everything else ?
We had tink, Tom and me and we were bumbling fools (no surprise for me, but Tom and Tink ???) itās a bit ādifferentā
Thinking about it, Iām not sure what the ānormalā sensors: header key is for as it does look redundant but repeating - platform: mqtt, seems downright stupid
I think a degree of harmonisation across platforms is required.
What do you think about a WTH ?
Well, thatās annoying, getting shut off for replying too many times. I actually had to wait an hour this morning before I could post. Anyway, hereās where we stand - after many different config attempts, the binary sensor still does not work. The messages get sent by the rf-wifi bridge but nothing ever happens in hass. Iāve monitored the state of the device while opening and closing the door, it never changes (and I know it changes state almost in real-time as Iāve tried it with other devices.) For the hell of it, and to reset, I went back to using MQTT. MQTT works fine to sound the alarm when the door has been open for a set period of time, I just canāt figure out how to preempt the alarm if the door is closed before the set time elapses. I have a couple other binary sensors (water detector and pir detector) that I may mess with but that would break existing automations that actually work, so Iām hesitant. Thanks to all, by the way, your efforts and ideas are appreciated!
Yes, I did try the latest, but that reply was where I hit 20 and couldnāt respond.
When I set the automation up with mqtt as the trigger, the alarm goes off when I open the door.
- id: '1598911158887'
alias: freezer door open too long
description: freezer door open too long
trigger:
- payload: 'ON'
platform: mqtt
topic: /tele/rf_wifi_bridgeB2EB97/motion3
condition: []
action:
- device_id: 917e9ebbae3a44148d8716f7faecae93
domain: switch
entity_id: switch.water_detector_alarm_switch
type: turn_on
mode: single
Actually itās not that MQTT is different. Itās the template stuff (binary, non-binary, etc) that is different from everything else.
Whenever you code multiples of any other thing in HA (fans, covers, lights, switches, etc) that is not a template you always have a main header and each item is listed individually with its own ā- platform:ā line.
Iām not sure why the template platform syntax is different.
Progress! Now the state changes when I open and close the door, so the binary_sensor part seems to be working. (I did exactly the same as Iāve done before in testing it, so no idea why, but happy for it at any rate.) The automation still doesnāt work though.
- id: '1598911158887'
alias: freezer door open too long
description: freezer door open too long
trigger:
- entity_id: binary_sensor.freezer_door
from: 'OFF'
platform: state
to: 'ON'
condition: []
action:
- device_id: 917e9ebbae3a44148d8716f7faecae93
domain: switch
entity_id: switch.water_detector_alarm_switch
type: turn_on
mode: single
Seems pretty simple and straightforward, and yet it doesnāt work. If this is outside the scope of this post I can repost under a more descriptive or appropriate topicā¦
Note - when I execute the automation using the āexecuteā link in automations, the alarm goes off. Not sure if that means anything but thought it worth mentioning for those of you who understand this stuff far better than I.
Because itās using incorrect values in its State Trigger. They should be lowercase on and off not uppercase ON and OFF.
Yes, itās meaningful. Youāve confirmed the action is functional and the problem is the trigger. When you execute an automation manually, it skips the trigger and condition and just runs the action. So you successfully exercised the action, which indicates the automationās problem is its trigger.
That fixed it, and thanks for the explanation, makes sense now. The automation now works as desired. I was thinking about possibly having an automation to turn it off, but itās kinda like water in the basement - I want the alarm to sound until someone (me) does something about it. I lost about $250.00 worth of food because some idiot (me again) did not make sure the freezer door was closed all the way.
No worries, we all make mistakes and you only really have it bed in if thereās a little blood and bruising in getting there.
I bet you have learnt a lot (I know I did, about mqtt) and that will stand you in good stead going forward.
Good luck
Remember to mark one of the posts as your solution, it helps others searching the forum. Usually you mark the post that helped you the most in finding an answer. Iād pick one of finityās
Since I was changing things a lot yesterday and had turned the automation on and off a few times, I just tested it to make sure that turning the automation off would have no effect on the binary sensor, and sure enough, it doesnāt. I turned the automation off and opened the door, and the binary sensor changed state, as expected. It certainly would not make sense for the automation to affect the binary sensor, but I just wanted to make sure I hadnāt done something stupid yesterday.
This topic is about MQTT sensors and really helpful at that, but I was thinking about something else when I read your problem.
If you want to guard your food from spoiling in the freezer, did you consider monitoring its power consumption using a smart plug? My freezer has a very regular duty cycle. If the on-cycle is longer than 40 minutes I know the door is open or something else is wrong. If the off-cycle is longer than an hour, thereās something wrong with the power. I have automations that check both.
A door switch is faster to detect an open door, but your food wonāt spoil instantaneously. A door switch will change the appearance of your freezer and could have reliability problems. Will the sensor trigger if the door is only slightly open?