Solved! Since update endless feedback loop of a switching command between ESP EASY and Domoticz

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Ruprecht
Normal user
Posts: 18
Joined: 04 Nov 2016, 10:02
Location: im Süden von DE

Solved! Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#1 Post by Ruprecht » 28 Jun 2019, 17:25

In our laundry drying room in the basement i have an automatic control of the fan with a sensor (BME280). This is done by a rule in ESP EASY, which turns on a fan automatically when the humidity is above 49%. This switch state of this fan is visible on Domoticz and the fan could be switched also over Domoticz manually. This worked so far as desired by me.

Today I've made an update to ESP EASY Mega 20190626. Now is there a feedback loop between ESP EASY and Domoticz. As soon as I switch on or off the fan manually via Domoticz, ESP EASY immediately returns this switching command as a new switching state to Domoticz and ESP EASY immediately returns this switching state as a new switching state to Domoticz and so on. Also, an on/off delay brought no improvement.

How do I get back the previous state of the controller where my manual command does not trigger an endless feedback loop?

Image

Image

Image

Code: Select all

On System#Boot do
  PCFGPIO,1,0
  PCFGPIO,2,0
  PCFGPIO,3,0
  PCFGPIO,4,0
  PCFGPIO,5,0
  PCFGPIO,6,0
  PCFGPIO,7,0
  PCFGPIO,8,0
  timerSet,1,60
endon

On Rules#Timer=1 do 

  //Taupunkt aussen   (Berechnung unter 50% Feuchte falsch!)
 TaskValueSet,9,1,[LAussenTemp#Temp]-(100-[LAussenTemp#Feuchte])/5     

  //Taupunkt innen      (Berechnung unter 50% Feuchte falsch!)
 TaskValueSet,9,2,[HeizTFD#Temp]-(100-[HeizTFD#Feuchte])/5                    

  //Lüfter an
  if [HeizLueft#LuefterH]=0 and [HeizTFD#Feuchte]>48 and [Taupunkt#TaupAussen]<[Taupunkt#TaupInnen]
    PCFGPIO,1,1
  endif

  //Lüfter aus
  if [HeizLueft#LuefterH]=1 and [HeizTFD#Feuchte]<44
   PCFGPIO,1,0
  endif 
  if [HeizLueft#LuefterH]=1 and [Taupunkt#TaupAussen]>[Taupunkt#TaupInnen]
   PCFGPIO,1,0
  endif

 timerSet,1,300
endon

Code: Select all

2019-06-28 16:25:42.289 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:42.779 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:43.290 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:43.812 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:43.281 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:43.803 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:44.445 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:44.894 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:44.436 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:44.885 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:45.382 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:45.887 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:45.373 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:45.879 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:46.500 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:46.492 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:47.211 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:47.685 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:47.202 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:47.676 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:48.183 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:48.695 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:48.174 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:48.686 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:49.309 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:49.786 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:49.297 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:49.777 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:50.290 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:50.785 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:50.281 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:50.776 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:51.855 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:51.846 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:52.338 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:52.792 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:52.329 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:52.783 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:53.322 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:53.803 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:53.313 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:53.798 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:54.517 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:54.988 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:54.508 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:54.979 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:55.507 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:55.985 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:55.498 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:55.976 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:56.488 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:56.949 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:56.479 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:56.940 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:57.410 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:57.930 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:57.401 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:57.921 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:58.395 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:58.880 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:58.386 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:58.870 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:59.410 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:59.883 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:25:59.406 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:25:59.878 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:26:00.806 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:26:00.797 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:26:01.296 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:26:01.758 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:26:01.287 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:26:01.749 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:26:02.284 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:26:02.774 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:26:02.275 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:26:02.765 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:26:03.284 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:26:03.757 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:26:03.275 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:26:03.748 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
2019-06-28 16:26:04.287 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:26:04.779 (Heizung) Light/Switch (Lüfter Heizraum (>49% Feuchte))
2019-06-28 16:26:04.278 Status: User: Admin initiated a switch command (40/Lüfter Heizraum (>49% Feuchte)/Off)
Last edited by Ruprecht on 03 Jul 2019, 17:01, edited 1 time in total.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#2 Post by ThomasB » 28 Jun 2019, 18:01

Try disabling the "Send to Controller" option in the PCF8574 plugin.

- Thomas

Ruprecht
Normal user
Posts: 18
Joined: 04 Nov 2016, 10:02
Location: im Süden von DE

Re: Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#3 Post by Ruprecht » 28 Jun 2019, 18:39

That would eliminate my feedback problem, but then I would lose the status display of the fan in Domoticz.

Currently I am solving the feedback problem by deleting the on/off actions in Domoticz. But now the manual control of the fan is not possible.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#4 Post by ThomasB » 28 Jun 2019, 18:59

That would eliminate my feedback problem, but then I would lose the status display of the fan in Domoticz.
The status data can be sent to Domoticz by your ESPEasy rules (use the publish command).

- Thomas

Ruprecht
Normal user
Posts: 18
Joined: 04 Nov 2016, 10:02
Location: im Süden von DE

Re: Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#5 Post by Ruprecht » 02 Jul 2019, 16:54

Again, the same result. It makes no difference whether the status is sent directly from the EspEasy device or Publish Command. Again, Domoticz responds with endless repeating this command.

In the meantime I believe that´s not a mistake but a feature which only did not occur with the old version mega-20180818. Presumably, the mistake sits in front of the screen.

How to program a switch with Domoticz + EspEasy which also displays the actual state if e.g. in the meantime a rule changes the switching state?

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#6 Post by kimot » 02 Jul 2019, 20:14

Disable "send to controller"

In Domoticz On / Off action use your pcfgpio commands.

And in your rules send json htttp command about switch state to Domoticz.


Then if you switch from Domoticz - it sets gpio and do not send back to Domoticz.

If you set switch by rules in ESPeasy- it sets gpio, send status to Domoticz by json http call and Domoticz immediately sends the same gpio command to ESPeasy
and in this time loop ends.

Ruprecht
Normal user
Posts: 18
Joined: 04 Nov 2016, 10:02
Location: im Süden von DE

Re: Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#7 Post by Ruprecht » 03 Jul 2019, 16:58

Thanks for the "thinking help". Now everything works again without loop:

Domoticz
action on:
http://192.168.178.81/control?cmd=event,luefterein
action off:
http://192.168.178.81/control?cmd=event,luefteraus

EspEasy
Send to controller: disabled on this device

Rules:

Code: Select all

On System#Boot do
  PCFGPIO,1,0
  PCFGPIO,2,0
  PCFGPIO,3,0
  PCFGPIO,4,0
  PCFGPIO,5,0
  PCFGPIO,6,0
  PCFGPIO,7,0
  PCFGPIO,8,0
  timerSet,1,60
  SendToHTTP 192.168.178.19,8080,/json.htm?type=command&param=udevice&idx=40&nvalue=0
endon


On Rules#Timer=1 do 

  //Taupunkt aussen   (Berechnung unter 50% Feuchte falsch!)
 TaskValueSet,9,1,[LAussenTemp#Temp]-(100-[LAussenTemp#Feuchte])/5     

  //Taupunkt innen      (Berechnung unter 50% Feuchte falsch!)
 TaskValueSet,9,2,[HeizTFD#Temp]-(100-[HeizTFD#Feuchte])/5                    

  //Lüfter an
  if [HeizLueft#LuefterH]=0 and [HeizTFD#Feuchte]>48 and [Taupunkt#TaupAussen]<[Taupunkt#TaupInnen]
    PCFGPIO,1,1
    SendToHTTP 192.168.178.19,8080,/json.htm?type=command&param=udevice&idx=40&nvalue=1
  endif

  //Lüfter aus
  if [HeizLueft#LuefterH]=1 and [HeizTFD#Feuchte]<43
    PCFGPIO,1,0
    SendToHTTP 192.168.178.19,8080,/json.htm?type=command&param=udevice&idx=40&nvalue=0
  endif 
  if [HeizLueft#LuefterH]=1 and [Taupunkt#TaupAussen]>[Taupunkt#TaupInnen]
    PCFGPIO,1,0
    SendToHTTP 192.168.178.19,8080,/json.htm?type=command&param=udevice&idx=40&nvalue=0
  endif

 timerSet,1,300
endon


On luefterein do
  if [HeizLueft#LuefterH]=0
    PCFGPIO,1,1
    SendToHTTP 192.168.178.19,8080,/json.htm?type=command&param=udevice&idx=40&nvalue=1
  endif
endon


On luefteraus do
  if [HeizLueft#LuefterH]=1
    PCFGPIO,1,0
    SendToHTTP 192.168.178.19,8080,/json.htm?type=command&param=udevice&idx=40&nvalue=0
  endif
endon

voyo
New user
Posts: 2
Joined: 17 Dec 2019, 19:14

Re: Solved! Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#8 Post by voyo » 17 Dec 2019, 19:19

Hello,
I have same issue. And I managed to "fix" it same way.
However - this is not a solution , this is workaround !

This way, makes having domoticz controller completely unless and pointless, same with functionality of
"Send Boot state" and "Send to Controller"

Is this erroneous behaviour fixed correctly in newer firmware versions ?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Solved! Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#9 Post by TD-er » 18 Dec 2019, 09:32

What was the correct working version?
And maybe either one of you can formulate what may be wrong here?

I don't know enough of what Domoticz does here (but I do have it installed here for simple testing), so please give me some pointers.
If we have some proper idea of where to look, then it would be best to have a GitHub issue for it, since finding back issues here on the forum is next to impossible.

voyo
New user
Posts: 2
Joined: 17 Dec 2019, 19:14

Re: Solved! Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#10 Post by voyo » 18 Dec 2019, 22:01

version that I used -
ESP_Easy_mega-20181003_normal_ESP8266_1024.bin
and mega-20190607 (self build, from github)

Both are behaving same, I wanted to try newer version, but looks like it doesn't have much sens if you are not aware of this bug actually...

So, in my case its behaves like this -

Domoticz (newest stable version) is added as controller (HTTP type)
on switch and/or relay tab (a device) there are options to configure data acquisition - "Send to Controller" and IDX.

When this is enabled (acquisition, and domoticz controller) no matter whether it is switch or related relay, it creates a continuous loop of flip-flop:
espeasy is sending status of the device to domoticz, domoticz is somehow switching device to opposite position, and back and forth.

What I think: probably espeasy is actually sending to domoticz not status update of the device, but command to change device status.
Maybe there was some change in domoticz API in the meantime , some time ago ? I'm not sure.
I didn't have time yet to enable some debug and confirm if this is like I think it is.


When I completely disable/remove domoticz controller and data acquisition in espeasy, and instead of this I just use rules with SendToHTTP - it works OK.
But well - this is not the way it should be. Domoticz integration is pointless.

This is rule set that I have (which is my workaround):

Code: Select all

On System#Boot do
  timerSet,1,59
endon

On Rules#Timer=1 do
    SendToHTTP 10.0.0.113,8080,/json.htm?type=command&param=udevice&idx=36&nvalue=0
endon

on button#switch do
  if [button#switch]=1
   gpio,14,1
   SendToHTTP 10.0.0.113,8080,/json.htm?type=command&param=udevice&idx=36&nvalue=0
  else
   gpio,14,0
   SendToHTTP 10.0.0.113,8080,/json.htm?type=command&param=udevice&idx=36&nvalue=1
  endif
 endon 

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Solved! Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#11 Post by TD-er » 19 Dec 2019, 14:24

It is possible Domoticz has changed something, but it may also be something in ESPEasy has changed in relation to the GPIO handling.
Actually some GPIO handling stuff did change around December last year.

przemek63
Normal user
Posts: 13
Joined: 16 Feb 2020, 16:10

Re: Solved! Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#12 Post by przemek63 » 22 May 2020, 23:04

Maybe one of the espeasy developers will comment on this topic?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Solved! Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#13 Post by TD-er » 23 May 2020, 10:24

przemek63 wrote: 22 May 2020, 23:04 Maybe one of the espeasy developers will comment on this topic?
What is the comment you are looking for?

przemek63
Normal user
Posts: 13
Joined: 16 Feb 2020, 16:10

Re: Solved! Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#14 Post by przemek63 » 23 May 2020, 14:58

TD-er wrote: 23 May 2020, 10:24
przemek63 wrote: 22 May 2020, 23:04 Maybe one of the espeasy developers will comment on this topic?
What is the comment you are looking for?
mention of this problem is from last year and from what I see the problem has not been repaired.
So I assumed that project developers don't know about its existence.

I wanted to implement espeasy many times, but the "send to controller" function effectively disrupts the work of the entire system.
If it doesn't work then you could delete it and in exchange increase the space for rules where you could work around the problem.

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Solved! Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#15 Post by Ath » 23 May 2020, 15:27

Sorry to barge into this discussion, but IMHO this is not an issue of ESPEasy, but of the way it is configured.
When both sides trigger the other side on a status change, then only an endless loop can be created. It is impossible for each side to know that only a status update was sent, instead of a normal state change. Unless you add some logic there (on both sides of course...).

Nothing to fix here, other than to not create an endless loop...
/Ton (PayPal.me)

przemek63
Normal user
Posts: 13
Joined: 16 Feb 2020, 16:10

Re: Solved! Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#16 Post by przemek63 » 23 May 2020, 16:59

Ath - Hello,
thank you for saying that. This means that the problem is in my understanding and not in the code.
This is good information for me :)

I would not want to abuse your goodness, but I do not yet understand the logic of what you wrote (maybe because of language differences)

Can I ask for some block example of such a configuration?
this will help in understanding the principle of operation.

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Solved! Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#17 Post by Ath » 23 May 2020, 17:43

Well, I was trying to write that when a status change on one end (Domoticz) causes a status change on the other (ESP), that then is causing a status change on the first end again (Domoticz), you are causing an endless loop, by design.

I have the example of my Sonoff S20 switch(es), that are keeping their status in Domoticz, and also allow to be switched both from the Sonoff and from Domoticz.
The S20 has it's GPIO12 connected to both the relay and the blue LED (high-active!). And also a green led op GPIO13 (low-active!). And I mounted a BME280 in the S20 as well ;) (serial port is turned off, and I had to drill a few air holes in the housing to reduce the warming-up by the ESP, externally mounted is aesthetically, and for electric safety, not acceptable for the wife :shock: )

That is defined in ESPEasy like this:

Screenshot - 23-05-2020 , 17_13_37.png
Screenshot - 23-05-2020 , 17_13_37.png (29.67 KiB) Viewed 28843 times

The relay is connected to a switch device in Domoticz on idx 2167. That works as expected because in Domoticz I have configured an on and off action:

Screenshot - 23-05-2020 , 17_18_20.png
Screenshot - 23-05-2020 , 17_18_20.png (3.2 KiB) Viewed 28843 times

Then, back in ESPEasy, I've set a rule on the button action (a rule is required anyway in a normal build of ESPEasy):

Code: Select all

On Button#State=0 do  // Act on key-down
  if [Relay#State]=0  // Use the relay state to toggle on/off
    gpio,12,1  // On
  else
    gpio,12,0  // Off
  endif
  pulse,13,0,300  // 'Flash' green LED
endon
/Ton (PayPal.me)

puls8
New user
Posts: 9
Joined: 29 Feb 2020, 18:22

Re: Solved! Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#18 Post by puls8 » 23 Aug 2020, 14:29

I ran in the same issue after updating from a end 2019 release to the latest. A easy fix is setting the interval to 1 second. This clearly breaks the loop.

The weird thing is that I have two relays in the same setup and esp, but only one is going into the loop.

puls8
New user
Posts: 9
Joined: 29 Feb 2020, 18:22

Re: Solved! Since update endless feedback loop of a switching command between ESP EASY and Domoticz

#19 Post by puls8 » 22 Oct 2020, 21:51

puls8 wrote: 23 Aug 2020, 14:29 I ran in the same issue after updating from a end 2019 release to the latest. A easy fix is setting the interval to 1 second. This clearly breaks the loop.
Sadly, this does not always work. (At most 90% of the time).


Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests