Domoticz-espeasy-relay

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
rmtucker
Normal user
Posts: 57
Joined: 04 Oct 2015, 17:14

Domoticz-espeasy-relay

#1 Post by rmtucker » 17 Dec 2016, 19:57

I have been playing with the relay example in the wiki and realised that there is no feedback to domoticz about the status of the relay.
For instance using the example it works fine, the relay switches on and off when pressing the switch in domoticz.
But if I the esp misses an instruction to turn on or off,domoticz no longer reflects the true state of the relay.
Is there a way to sync them through rules or something?

rmtucker
Normal user
Posts: 57
Joined: 04 Oct 2015, 17:14

Re: Domoticz-espeasy-relay

#2 Post by rmtucker » 19 Dec 2016, 17:00

Having searched this forum and Googling i have still no idea how to get an ack back from the espeasy node.
I see that it can be done with mqtt but i really did not want to learn mqtt.
So basically if i send on/off from domoticz to my boiler relay,There is no ack to say it has received it or not.

NightBird
Normal user
Posts: 24
Joined: 02 Dec 2016, 17:54

Re: Domoticz-espeasy-relay

#3 Post by NightBird » 19 Dec 2016, 17:43

Hi,

if you still have a free contact on your relay, you can use it to pull a GPIO to ground, and create a switch input device.
Monitoring that switch on Domoticz will show you the *true* state of your relay.

If no free contact remains, it's possible to monitor the mains supply across the boiler heater element, but you need some electronics knowledge and few components.
In this case, I could help you with a (simple) schematic, so let me know.

Good luck ;)
ESPEasy running on ESP-12F self-made modules (with various sensors) and talking to Domoticz (hosted on RPi2)

rmtucker
Normal user
Posts: 57
Joined: 04 Oct 2015, 17:14

Re: Domoticz-espeasy-relay

#4 Post by rmtucker » 19 Dec 2016, 17:52

Hi
Thank you for your input on this.
My problem with that idea is that The esp could be unplugged or not working and domoticz will not throw any kind of error because it is a dumb connection.
Yes the feedback switch wouold show off but still no error.

NightBird
Normal user
Posts: 24
Joined: 02 Dec 2016, 17:54

Re: Domoticz-espeasy-relay

#5 Post by NightBird » 19 Dec 2016, 20:09

OK, I see...

Maybe a watchdog-style script on the Domoticz side, which is triggered periodically by the ESP switch info. If your ESP is offline or so, the script will do something, e.g. warn you...
ESPEasy running on ESP-12F self-made modules (with various sensors) and talking to Domoticz (hosted on RPi2)

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: Domoticz-espeasy-relay

#6 Post by Drum » 20 Dec 2016, 10:26

Can Domoticz handle mqtt disconnect msg? I currently don't use Domocitz mecause it was not flexible enough for for my purposes. I am using Mqtt (Mosquitto - Node-Red - Sqlite), I receive a notice when the connection is lost and when reconnected. In theory, Domoticz could use this to let you know it is still connected, but I don't know if it can or ever will.

While using mqtt adds a bit of complexity, it also adds a lot of flexibility through Node-Red.

https://www.domoticz.com/wiki/MQTT

rmtucker
Normal user
Posts: 57
Joined: 04 Oct 2015, 17:14

Re: Domoticz-espeasy-relay

#7 Post by rmtucker » 26 Dec 2016, 20:23

Having spent days reading snippets of information on MQTT and domoticz/espeasy,I am no further forward.
It all seems so complicated and way beyond me without a hand holding tutorial on how to put it all together.
Domoticz seems to be the problem when using dummy switches because it does not need an ack.
It does not care if anything is actually connected and turns the little light bulb/relay on anyway and expects no answer/ack.
Does anybody know if this is the same when using Domoticz/MQTT opposed to Domoticz/HTTP?
Is there a better controller that needs or accepts ack?
I had a quick look at openhab but it seems very complicated and disjointed.
What is the tick box for in devices (send data)?

ToniA
Normal user
Posts: 69
Joined: 26 Aug 2016, 20:37

Re: Domoticz-espeasy-relay

#8 Post by ToniA » 27 Dec 2016, 11:08

My solution to this is to have a 'time' event to send the relay state once per minute. The downside is that the 'Log' button no longer works, as it seems to overload the web browser when trying to display an event per minute.

Another thing is that on the relay side I should have some safeguards against connection loss, so that the ESP side could do something sensible with the rules if there's no incoming data. Yesterday I started to experiment with a custom event:

Code: Select all

diff --git a/ESPEasy/Controller.ino b/ESPEasy/Controller.ino
index c3eba47..4c872a0 100644
--- a/ESPEasy/Controller.ino
+++ b/ESPEasy/Controller.ino
@@ -56,6 +56,12 @@ void callback(char* c_topic, byte* b_payload, unsigned int length) {
   sprintf_P(log, PSTR("%s%s"), "MQTT : Payload: ", c_payload);
   addLog(LOG_LEVEL_DEBUG, log);

+  if (Settings.UseRules)
+  {
+    String event = F("System#MQTT");
+    rulesProcessing(event);
+  }
+
   struct EventStruct TempEvent;
   TempEvent.String1 = c_topic;
   TempEvent.String2 = c_payload;
So this raises an event every time there's an incoming MQTT packet. On 'Rules' I can now do something like this (GPIO5 controls the Wemos Relay Shield, and I also have a DS18B20 temperature sensor):

Code: Select all

On System#MQTT do
  timerSet,1,120
endon

on Rules#Timer=1 do  //When Timer1 expires, do
  if [temperature#Temperature]>21
    gpio,5,1
  else
    gpio,5,0
  endif
  if [temperature#Temperature]=nan
    gpio,5,1
  endif
  timerSet,1,5
endon

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 134 guests