I have a float switch hooked up to GPIO14 on my Sonoff Basic to detect flooding in my crawlspace. How it currently works is I have the switchmode set to “1” and when the float lever activates, it turns the relay on. I set it up this way originally because it was the least amount of work to get it working. The problem I’m running into is the unit occasionally reboots itself and triggers the switch mode, thus sending an alert (alert is based on: MQT: stat/crawlspace/RESULT = {“POWER”:“ON”})
What I would like to do is fire a MQTT-based message based on the switch itself being in the “ON” state and not the relay state but I’m unsure how to configure this. Any suggestions?
I think this is the information I am trying to capture and send errors on. I want to send a pushbullet alert when the switch1 state changes to “on” but I don’t care about the relay state.
Ok, I’m getting closer. I set the telemetry check to 10 seconds so it sends me the state of the switch every 10 seconds. The trick, now, is in setting up the correct payload. If I set no payload to my automation, then the alert triggers every 10 seconds. I don’t want/care about the timestamp in the telemetry payload, just the state of Switch1. How can I filter out they payload to only check for Switch1 state in order to fire off the correct alert?
Not quite what you were asking, but a slightly different way to fix your problem.
I have alerts that are defined like this
alert_garage_door_large:
name: Large Garage is open
done_message: Large Garage is closed
entity_id: binary_sensor.garage_large_open
state: ‘on’
repeat: 10
can_acknowledge: True
skip_first: True
With skip_first set to true, it doesn’t send the alert when the switch changes state. In this case, after 10 mins, it sends the alert. If you set repeat to 2, it would send after two mins, and shouldn’t send on a reset. It would sends another message when the binary goes back to off.
BTW, binary_sensor.garage_large_open is over mqtt
I think the easiest way for me to solve this problem is to be able to only have the trigger check if a certain part of the payload is true. This is what the payload looks like right now:
The only payload portion I’m interested in is "Switch1" : "ON" but the trigger isn’t firing when I just put that into the payload section on my automation