Using Ping Sensor to set Laundry state until triggered again?

I’ve got a door sensor that doesn’t work with Home Assistant, however it does respond to ping for 2-3 seconds when activated, then goes offline.

I’ve currently got the sensor installed on my washer, when I open the lid it fires a binary sensor using ping in HA and shows as “On” for a moment then goes back to “Off” as soon as the sensor goes back to sleep.

I’d like to set some sort of persistent status/variable when the binary sensor is triggered that will persist until the next time it gets triggered again, in essence the first time it triggers it sets the variable to “On” (even though the binary sensor will go back to “Off” within a couple seconds) the next time the binary sensor is triggered it sets the variable to “Off”, the end goal being to know when the washer is in use…so long as no one opens the door an extra time :slight_smile:

Could anyone steer me in the right direction? Any help is appreciated, thanks!

Smells like crappy Tuya Wifi sensor, isn’t it :wink:
I assume you checked the Tuya and LocalTuya integrations and they don’t work for you?

If so, I’d suggest to change your sensor.
Hammering your network with pings every seconds is hardly a proper long-term solution

haha, you called it! I couldn’t turn them down at $12 for 2 on clearance at Walmart!

I didn’t look into LocalTuya because it doesn’t list the sensors as supported but I have read some comments where people seemed to get it working, I’ll dig into that more, so thank you :slight_smile:

I am still curious though, what functionality in HA would allow me to set a variable/persistent state and toggle it each time a sensor is triggered. I totally get using PING isn’t a reliable/standard method for doing this (though it’s worked surprisingly well so far), but I think knowing how to do this is going to help me with other integrations as well.

I just can’t find a good example of a binary sensor firing, setting a state to then when it’s fired again TOGGLING the state to the opposite.