Major delays with event and trigger state, is that normal?

Im using a smart life 3 gang light switch, no delays when i turn this on and off via home assistant. No delays when i link other devices to it like a smart life plug. The problem comes when i try and control them via node red.

When using a event state or trigger state node and link the switch to it with the Entity ID, it can take anywhere between 10 seconds and more often than not, up to 30 seconds. Is this just the nature of node red or smart life. Surely event and trigger states are doing the same as the switches from home assistant and should be instant?

Gav

No one else getting these kind of delays with the trigger and state nodes?

Maybe you can post your flow so we can better understand what you are doing ? But I think polling of smart life devices is slow. Sending a command is usually fast, almost instant. I suspect that the HA backend doesnt receive event information from smartlife, and instead just polls every x seconds. I cant really test that anymore as I flashed my smartlife devices to tasmota, so now I have full local control and instant response.

I am only experiencing 2-3 secs delays when triggering hue lights with hue motion sensors…RPi3 latest HA version

But those Hue sensors work locally, right? They dont depend on a cloud roundtrip afaik. Certainly not if you plug a zigbee adapter in your pi.

Tuya / smartlife devices with stock firmware can only be accessed via their cloud. HA can send commands to Tuya cloud, and in fairness, this usually works fairly fast. But AFAIK tuya devices dont offer a proper API that can listen for events, so HA doesnt get notified of any events. Instead it just polls regularly to ask what the state is.

I realized still have one stock firmware tuya smart socket. If I turn it on via HA, it knows its new state almost instantly, as HA initiated the state change and presumably gets confirmation. But if I press the button on the smart switch itself, it takes a fairly long time before HA knows the new state. 5 and 15 seconds in two tests just now.

For some things, this may be fine, but for motion detection or light switches this is unworkable IMO. Im using dirt cheap 433 MHz RF motion sensors and RF switches, and a sonoff RF bridge that I flashed with tasmota. Response is now pretty much instantaneous. And it works even if my internet connection does not.

Gavin, I would check if your smart life device is listed here:

Probably here in fact:

If it is, consider flashing your devices to tasmota firmware. That way you no longer need (nor can use) smart life app and cloud, you get direct local control over MQTT.

R5fan, i think you’ve hit the nail on the head here with it polling regularly for its state. Would explain why its slow sometimes and fast others. Also annoying, but somewhat comforting to hear that if you press the switch on the device you’re getting similar results.

My device is listed in the link you provided, been a little reluctant to start flashing hardware but it makes sense and i wont truly be happy with it unless its responsive. Will look into this now.

Also here is my flow. It all works ok for google or the schedule to open and close the blinds. In-case anyone is wondering what the 2 sec delay is for, it seemed to need this to turn on a power socket which powered the blinds, could leave the power unit on all the time but the hum annoyed me.

Thanks for the reply and info, helped allot!

Flashing these devices is not that complicated, especially if they can be flashed using tuya-convert (so you dont need to open the device and connect a serial programmer and potentially even have to do any soldering.)
However, its irreversible, and getting the hang of using tasmota / mqtt with HA may be challenging if like me initially, you know nothing of it.

So a few things for you to consider; first, maybe buy some cheap tuya device and convert it to tasmota to experiment with. I have a bunch of 7 euro RGBWW bulbs, and they actually work quite well once flashed and configured, and Im sure you’;ll find some use for it once you got the hang of it.

Secondly; is it a good idea to have switches that work via wifi ? If you only have one smart switch, then, meh, maybe, but as you expand I think its needlessly complicated, expensive and problem prone. Another way is using 433 or 866 Mhz RF switches. These have several advantages; they are really cheap, can be battery powered (they dont consume any energy at all until you press them) and have better range while not depending on wifi. You can buy wall mounted switches like this one: https://www.amazon.de/SONOFF-Wall-Switch-Button-Transmitter/dp/B07MRJHR55 or key fobs or something inbetween https://www.amazon.de/gp/product/B07SPZ3H8N. And you may already have a bunch of RF remotes at home from various devices.

To make that work, you do need a bridge that will receive (and possibly send) RF signals and convert that to mqtt over wifi. The sonoff RF bridge: https://www.amazon.de/gp/product/B07K7NNKCR/ Which can and should be flashed to tasmota. Id consider buying that, using that as your first tasmota test device, and a basis for further expansion. Like motion sensors and door sensors. I use these motion sensors:
https://www.banggood.com/DIGOO-DG-HOSA-433MHz-PIR-Detector-Wireless-Motion-Detecting-Human-Body-Sensor-Compatible-with-HOSA-MAHA-2G-3G-Security-Alarm-System-p-1163105.html
Tiny, they can be mounted anywhere, cheap as chips, battery operated (8 months now still going strong) and they work really well.

You could also use zigbee or z-wave instead, that has some advantages (mesh networking with certain devices) and some disadvantages (price, compatibility). On hindsight, I wish I had gone for zigbee for my light bulbs instead of wifi, as I have over 20 tasmota flashed wifi bulbs now and managing that is becoming a chore, and I dread the day I need to replace one; but for remote switches, door sensors and motion sensors, Im totally happy with my cheap sonoff / RF stuff.

Just spotted your last post but already followed your previous advice and took the plunge, started flashing the devices. Its not that tricky now that I’ve done it, but looking at it initially was very daunting. Results are fantastic, After doing it i found that i could remove the delay nodes also. So everything is pretty instant and always responsive.

Definitely going to check out the motion sensors you’ve recommended, that’s been something i’ve been considering for my next project, updating my alarm system and making it also turn off lights around the house when the family leave them on. The fact that they last and i wont need wires all over sounds like a good way forward.

Cheers!

Thats what I used them for. Turning lights off and as cheap alarm. Mind you, they are motion sensors, not presence detectors, so you cant rely on them to tell the difference between someone sitting on the couch and no one being there. So I use them to turn on lights when its dark and motion is detected. When you sit in the couch, depending on sensor placement, just waggling your feet is often enough to trigger them, but to keep the lights on in places like the living room, I have (RF) switches that trigger scenes. And those dont turn off automatically (except when alarm is armed, or at night 10 mins after tv is turned off and a few other criteria). But for the most part, its automatic and it feels like an incredible luxury just walking through the house and lights going on wherever you need them, and turning off a bit later.

One last tip; if you are going to buy that sonoff bridge, I highly recommend you also upgrade the RF firmware to the one you will find described on the tasmota pages. That is a little trickier than just flashing tasmota, iirc you do need a serial programmer, but if you dont do it, the rf bridge only sends an MQTT message when the motion sensor stops triggering (or like 2 seconds after a door sensor was triggered). That makes the system a little sluggish if you walk in to a room and the lights take a few seconds to come on. It works, but its a bit annoying when entering a room in the dark and having to wait even just 2 seconds for lights to turn on. With the other RF firmware its practically instantaneous.

1 Like