How to deal with randomly failed commands?

Everything about esp8266 and more.

Moderator: leecollings

Post Reply
EDsteve
Posts: 26
Joined: Thursday 13 October 2016 11:43
Target OS: Linux
Domoticz version:
Contact:

How to deal with randomly failed commands?

Post 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 3390 times
DutchHans
Posts: 229
Joined: Friday 03 April 2015 20:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany (near dutch border)
Contact:

Re: How to deal with randomly failed commands?

Post by DutchHans »

What about a wifi repeater... Solves your problem I guess...

Cheers, Hans
SweetPants

Re: How to deal with randomly failed commands?

Post 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?
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: How to deal with randomly failed commands?

Post 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 ?
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
EDsteve
Posts: 26
Joined: Thursday 13 October 2016 11:43
Target OS: Linux
Domoticz version:
Contact:

Re: How to deal with randomly failed commands?

Post 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 :(
EDsteve
Posts: 26
Joined: Thursday 13 October 2016 11:43
Target OS: Linux
Domoticz version:
Contact:

Re: How to deal with randomly failed commands?

Post by EDsteve »

This seems to be a working solution:
viewtopic.php?f=28&t=9670&start=40#p170082
fargle
Posts: 67
Joined: Tuesday 27 March 2018 17:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to deal with randomly failed commands?

Post 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 2855 times
Last edited by fargle on Wednesday 01 August 2018 14:07, edited 1 time in total.
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: How to deal with randomly failed commands?

Post 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.
fargle
Posts: 67
Joined: Tuesday 27 March 2018 17:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to deal with randomly failed commands?

Post 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.
marcojpolet
Posts: 63
Joined: Thursday 04 February 2016 20:18
Target OS: -
Domoticz version:
Contact:

Re: How to deal with randomly failed commands?

Post 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
Dlanor
Posts: 67
Joined: Sunday 22 March 2015 16:18
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

How to deal with randomly failed commands?

Post 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.
Domoticz| Zigbee | SONOFF
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests