Page 1 of 1

How to deal with randomly failed commands?

Posted: Sunday 06 May 2018 23:09
by EDsteve
Hey,

i am building a mini grow box for pepper which needs specific environment. So basically automated temperature and humidity control.

I am using Sonoff devices (ESP8266) with ESPeasy on it so Domoticz is sending http commands over Wifi to controll the Sonoffs.
The problem is that sometimes the commands can not reach the Sonoff and i am getting this Error:

Code: Select all

Error opening url: http://192.168.1.94/control?cmd=GPIO,12,1
It only happens once a day or so... but that can be enough to kill all my pepper because when the heater don't get the OFF command it will keep on heating and heating while Domoticz thinks it is OFF.

What would you do to prevent my pepper from getting barbecued?
For now i send the command twice with a 15 second delay. But even these two commands don't arrive at the device sometimes.

Should i send the Sonoff state of the relay every minute to Domoticz?
Should i write a "safety-script"? And what kind?
Or is there a better way?

Thanks for the input. I can need it.
ED

Here is example of my blocky code for the time when the lights are off:
OffTopic: Will there ever be If nested inside a If statement in blocky? :/
grow.PNG
grow.PNG (88.83 KiB) Viewed 3391 times

Re: How to deal with randomly failed commands?

Posted: Monday 07 May 2018 7:08
by DutchHans
What about a wifi repeater... Solves your problem I guess...

Cheers, Hans

Re: How to deal with randomly failed commands?

Posted: Monday 07 May 2018 7:54
by SweetPants
1) If you want more/better control, change to dzVentz. There nested if's are support (it's just plane LUA).
2) It's not domoticz 'problem' if your command is not reaching your sensor/switch. Like DutchHans said, maybe a repeater will solve that problem. WiFi is a shared medium, so unless you implement acknwoledgment at a higher level, you will have a change of loosing data. I also use a lot of ESP modules, but write my own sw for it using MQTT. They report back the current state of a sensor/switch every 10 sec, so i can check the state. MQTT also has a retained message posibility that let you re-send the last command if for some reason the module get's disconnected from MQTT broker/WiFi. Maybe ESPeasy has MQTT also so you can use that?

Re: How to deal with randomly failed commands?

Posted: Monday 07 May 2018 11:24
by tontze
oh hm .. i have allways thought sonoffs works a way that they send response when command has been received .. ? Apparently, i have been wrong ?

Re: How to deal with randomly failed commands?

Posted: Monday 07 May 2018 11:42
by EDsteve
Thanks for your replies.

@DutchHans
My Sonoffs are just 5m away from the Wifi repeater (no walls in between). That shouldn't be the reason.

@SweetPants
1. Yeah. I know. I just like the puzzle klicky thing with blocky.... I am not a programmer (yet) :)
2. So MQTT has this option "integrated"? That sounds interesting.
I actually tried a similar approach with the rules in ESPeasy to send the state every minute with this code but no error message and not working either :( Any suggestions about it?

Code: Select all

On System#Boot do
timerSet,1,60
endon

On Rules#Timer=1 do
SendToHTTP Username:[email protected],8080,/json.htm?type=command&param=udevice&idx=123&nvalue=0&switchcmd=[Humidity#Switch]
timerSet,1,60
endon
@tontze
Depends on the software you are using and/or the way you send data i guess. Seems MQTT does it? For sure not in my case over HTTP without extra code :(

Re: How to deal with randomly failed commands?

Posted: Monday 07 May 2018 21:46
by EDsteve
This seems to be a working solution:
viewtopic.php?f=28&t=9670&start=40#p170082

Re: How to deal with randomly failed commands?

Posted: Tuesday 31 July 2018 21:54
by fargle
Given that wifi is inherently unreliable I'm surprised that this hasn't been more of an issue. I'm playing with a Sonoff 4CH unit flashed with ESP Easy. It works pretty well but when I unplug its power, Domoticz acts as if its still connected.
I can switch a relay, and Domoticz lights up the dashboard button. When the relay is switched off, the button shows Off.
But nothing has actually happened because the Sonoff is dead..... the Domoticz indications are wrong.

When the Domoticz controller is enabled in ESPEasy, periodic status messages can be sent, and both these, and also comms failures appear in the Domoticz logs. But I'm not smart enough to know what to do with these to in order to provide dashboard error notifications and message retransmit features in case of failure as happens with ZWave.
Domoticz thinks its working
Domoticz thinks its working
IMG_1272a.jpg (324.98 KiB) Viewed 2856 times

Re: How to deal with randomly failed commands?

Posted: Wednesday 01 August 2018 9:51
by jake
The sonoff devices do report their updated status, at least, when Tasmota is used. I wish it was implemented within domoticz that the status is only updated on the ack. command and not on the publish command.

Re: How to deal with randomly failed commands?

Posted: Wednesday 01 August 2018 14:46
by fargle
jake wrote: Wednesday 01 August 2018 9:51 The sonoff devices do report their updated status, at least, when Tasmota is used.
Yes, ESPEasy also does. But Domoticz currently doesn't do anything with it. Or with error messages.
jake wrote: Wednesday 01 August 2018 9:51 I wish it was implemented within domoticz that the status is only updated on the ack. command and not on the publish command.
Im sure you're right.
These Sonoff and similar ESP devices are great value, and lend themselves to all sorts of applications. But for automated and scheduled remote control as described by the OP, imho they are not ready for prime time yet, at least within Domoticz.

For example, the "retry", timeout reporting and "bad node" features in ZWave technology make for a more reliable system, and I'm sure that similar could be done for wifi links, but I havent seen much interest anywhere in developing this.

Re: How to deal with randomly failed commands?

Posted: Friday 03 August 2018 13:50
by marcojpolet
Hi all,

Regarding a wifi 'failsafe' switching; would the MQTT implementation in Domoticz (in combination with e.g. ESPEasy) would be the right way to go?

Regards,
Marco

How to deal with randomly failed commands?

Posted: Wednesday 22 August 2018 21:34
by Dlanor
I had the same trouble. My devices were located in the shed. Bad respons although the WiFi couverage was reasonable. I have changed the esp easy into ESPurna and added an extra outdoor access point for the devices in the shed. It works flawless at the moment.