"watchdog" relay
Moderators: grovkillen, Stuntteam, TD-er
"watchdog" relay
Hi,
Currently I use espeasy on ESP01 to manage relay card. I want to create a rules who can switch off my relay after 20min for example whatever the state of the relay.
ex :
My domoticz call : http://192.168.1.23/control?cmd=gpio,0,1
>>timer is set ON at 20min.
At the end of the timer, the event set GPIO0 to 0
Thanks for your help.
Currently I use espeasy on ESP01 to manage relay card. I want to create a rules who can switch off my relay after 20min for example whatever the state of the relay.
ex :
My domoticz call : http://192.168.1.23/control?cmd=gpio,0,1
>>timer is set ON at 20min.
At the end of the timer, the event set GPIO0 to 0
Thanks for your help.
Re: "watchdog" relay
There are several ways to do it (all requiring a fairly recent build)
By far the simplest one:
Change your command from "gpio" to "longpulse"
See: https://espeasy.readthedocs.io/en/lates ... =longpulse
Another option using rules:
First add monitoring to the pin, which does allow you to receive an event in case the pin state changes.
N.B. you also receive the new state as %eventvalue%, but you can also act on a specific state.
See: https://espeasy.readthedocs.io/en/lates ... ore-events
In the event handling this state change you can set a timer, which will generate an event which you can also act on in the rules to set the GPIO to 0.
By far the simplest one:
Change your command from "gpio" to "longpulse"
See: https://espeasy.readthedocs.io/en/lates ... =longpulse
Another option using rules:
First add monitoring to the pin, which does allow you to receive an event in case the pin state changes.
N.B. you also receive the new state as %eventvalue%, but you can also act on a specific state.
See: https://espeasy.readthedocs.io/en/lates ... ore-events
In the event handling this state change you can set a timer, which will generate an event which you can also act on in the rules to set the GPIO to 0.
Re: "watchdog" relay
solution long pulse not impossible Just to be more clearTD-er wrote: ↑06 Dec 2020, 16:03 There are several ways to do it (all requiring a fairly recent build)
By far the simplest one:
Change your command from "gpio" to "longpulse"
See: https://espeasy.readthedocs.io/en/lates ... =longpulse
Another option using rules:
First add monitoring to the pin, which does allow you to receive an event in case the pin state changes.
N.B. you also receive the new state as %eventvalue%, but you can also act on a specific state.
See: https://espeasy.readthedocs.io/en/lates ... ore-events
In the event handling this state change you can set a timer, which will generate an event which you can also act on in the rules to set the GPIO to 0.
I use my esp to drive my boiler. domoticz is used to enslave esp to temperature. So I've a lua program who sends every minute 1 or 0 to drive ESP.
my need is simply to have a watch dog in case if my esp loose wifi or domoticz becomes crazy.
1. GPIO change state 0 to 1
2. launch 20 min timer
3. event end of timer => GPIO = 0
Re: "watchdog" relay
Then you should go for the rules option.
Re: "watchdog" relay
ok, I think I inderstand but I'm a little bit lost.
1. GPIO change state 0 to 1
2. launch 20 min timer
3. event end of timer => GPIO = 0
tks
1. GPIO change state 0 to 1
Code: Select all
How catch 0 to 1 change ?
timerSet,1,1200
3. event end of timer => GPIO = 0
Code: Select all
on Rules#Timer=1 do
GPIO,0,0
endon
Re: "watchdog" relay
See the documentation on the "monitor" command: https://espeasy.readthedocs.io/en/lates ... ore-events
This is the example from the docs, showing how to activate monitoring GPIO 15 and also if it changes, how to check the state of another GPIO (13) and act on it.
See here for documentation on "timerset": https://espeasy.readthedocs.io/en/lates ... rset#timer
So this can be combined into something like this:
Code: Select all
on System#Boot do
Monitor GPIO,15
endon
on GPIO#15=0 do
if [Plugin#GPIO#Pinstate#13]=0
// do something
endif
endon
on GPIO#15=1 do
if [Plugin#GPIO#Pinstate#13]=1
// do something
endif
endon
See here for documentation on "timerset": https://espeasy.readthedocs.io/en/lates ... rset#timer
So this can be combined into something like this:
Code: Select all
on System#Boot do
Monitor GPIO,15
endon
on GPIO#0=1 do
timerSet,1,20 // Set timer to 20 seconds
endon
On Rules#Timer=1 do
GPIO,0,0
endon
Re: "watchdog" relay
Thanks, I've activate rules menu and try :
But nothing happens after 20s switching ON GPIO0 and nothing in logs (only "694884 : WD : Uptime 11 ConnectFailures 0 FreeMem 28544")
I'm on
Build: 120
Core Version: 2_3_0
Code: Select all
on System#Boot do
Monitor GPIO,0
endon
on GPIO#0=1 do
timerSet,1,20 // Set timer to 20 seconds
endon
On Rules#Timer=1 do
GPIO,0,0
endon
I'm on
Build: 120
Core Version: 2_3_0
Re: "watchdog" relay
Ah build 120, that one is ancient and does not support "monitor" and likely other calls may also not yet work as they do now.
Can you please try a build which isn't like 3 years old?
See: https://github.com/letscontrolit/ESPEasy/releases
Can you please try a build which isn't like 3 years old?
See: https://github.com/letscontrolit/ESPEasy/releases
Re: "watchdog" relay
of course.
Is there a specific build for Puya version ? I remember that it was a specific for R120.
Is there a specific build for Puya version ? I remember that it was a specific for R120.
Re: "watchdog" relay
All builds should be able to handle Puya chips as it has been integrated in the esp8266/Arduino core since 2.5.x
Re: "watchdog" relay
I've update firmware to
see logs bellow :
nothing happens after switching On GPIO0
I've some strange connection failures but I can connect to it...
Code: Select all
Build:⋄ 20111 - Mega
System Libraries:⋄ ESP82xx Core 2843a5ac, NONOS SDK 2.2.2-dev(38a443e), LWIP: 2.1.2 PUYA support
Git Build:⋄
Plugin Count:⋄ 46 [Normal]
Build Origin: Travis
Build Time:⋄ Nov 30 2020 00:37:49
Binary Filename:⋄ ESP_Easy_mega_20201130_normal_ESP8266_1M
Build Platform:⋄ Linux-4.19.104-microsoft-standard-x86_64-with-glibc2.29
Git HEAD:⋄ mega-20201130_f4f960c
see logs bellow :
Code: Select all
890624: HTTP: gpio,0,0
890626: GPIO : port#0: set to 0
895338: HTTP: gpio,0,1
895340: GPIO : port#0: set to 1
903763: WD : Uptime 15 ConnectFailures 0 FreeMem 20728 WiFiStatus WL_CONNECTED ESPeasy internal wifi status: Conn. IP Init
928620: EVENT: Clock#Time=Thu,00:16
933753: WD : Uptime 16 ConnectFailures 0 FreeMem 24080 WiFiStatus WL_CONNECTED ESPeasy internal wifi status: Conn. IP Init
I've some strange connection failures but I can connect to it...
Re: "watchdog" relay
I apologies It works !!
So, I've try to add a return status to domoticz by calling API.
>>
but something goes wrong, ¶m is not correctly sends to http.
So, I've try to add a return status to domoticz by calling API.
Code: Select all
SendToHTTP domoticz,8080,/json.htm?type=command[b]¶[/b]m=switchlight&idx=88&switchcmd=On
Code: Select all
12584300: ACT : SendToHTTP domoticz,8080,/json.htm?type=command[b]¶[/b]m=switchlight&idx=88&switchcmd=On
Re: "watchdog" relay
If you got this log from the web-interface: Nothing is going wrong, that's just the web-log page doing its 'thing' replacing ¶ with a paragraph sign, that's a known 'feature'.miralant wrote: ↑23 Dec 2020, 20:40but something goes wrong, ¶m is not correctly sends to http.Code: Select all
12584300: ACT : SendToHTTP domoticz,8080,/json.htm?type=command[b]¶[/b]m=switchlight&idx=88&switchcmd=On
Why not send the state to Domoticz using a Controller? Way easier and less error-prone. For a simple one-way status update, Domoticz HTTP is fine.
From an older message:
It says: Uptime 16 (minutes), Connection failures: 0 ...miralant wrote:...Code: Select all
WD : Uptime 16 ConnectFailures 0 FreeMem 24080 WiFiStatus WL_CONNECTED ESPeasy internal wifi status: Conn. IP Init
I've some strange connection failures but I can connect to it...
Again, nothing to worry about
/Ton (PayPal.me)
Re: "watchdog" relay
Sure but I've a specific need. That's why I want to use API. So if it's not an issue, I've to investigate on my domoticz to understand why it does not work.Ath wrote: ↑23 Dec 2020, 20:59If you got this log from the web-interface: Nothing is going wrong, that's just the web-log page doing its 'thing' replacing ¶ with a paragraph sign, that's a known 'feature'.miralant wrote: ↑23 Dec 2020, 20:40but something goes wrong, ¶m is not correctly sends to http.Code: Select all
12584300: ACT : SendToHTTP domoticz,8080,/json.htm?type=command[b]¶[/b]m=switchlight&idx=88&switchcmd=On
Why not send the state to Domoticz using
Re: "watchdog" relay
You actually send the url with the forum bold tags?miralant wrote: ↑23 Dec 2020, 20:40 I apologies It works !!
So, I've try to add a return status to domoticz by calling API.
>>Code: Select all
SendToHTTP domoticz,8080,/json.htm?type=command[b]¶[/b]m=switchlight&idx=88&switchcmd=On
but something goes wrong, ¶m is not correctly sends to http.Code: Select all
12584300: ACT : SendToHTTP domoticz,8080,/json.htm?type=command[b]¶[/b]m=switchlight&idx=88&switchcmd=On
Here without the bold tags:
Code: Select all
SendToHTTP domoticz,8080,/json.htm?type=command¶m=switchlight&idx=88&switchcmd=On
Re: "watchdog" relay
No I've use bold to focus on the issue between code and logTD-er wrote: ↑23 Dec 2020, 21:13You actually send the url with the forum bold tags?miralant wrote: ↑23 Dec 2020, 20:40 I apologies It works !!
So, I've try to add a return status to domoticz by calling API.
>>Code: Select all
SendToHTTP domoticz,8080,/json.htm?type=command[b]¶[/b]m=switchlight&idx=88&switchcmd=On
but something goes wrong, ¶m is not correctly sends to http.Code: Select all
12584300: ACT : SendToHTTP domoticz,8080,/json.htm?type=command[b]¶[/b]m=switchlight&idx=88&switchcmd=On
Here without the bold tags:Code: Select all
SendToHTTP domoticz,8080,/json.htm?type=command¶m=switchlight&idx=88&switchcmd=On
Re: "watchdog" relay
let me gave us more information.
when I launch : > my switch is set to ON
on the rules :
the log resultin :
Event is fired but switch is not set to ON
when I launch :
Code: Select all
http://domoticz:8080/json.htm?type=command¶m=switchlight&idx=88&switchcmd=On
on the rules :
Code: Select all
On Rules#Timer=1 do
GPIO,0,0
SendToHTTP domoticz,8080,/json.htm?type=command¶m=switchlight&idx=88&switchcmd=On
endon
Code: Select all
68307215: HTTP: gpio,0,1
68307217: GPIO : port#0: set to 1
68307225: EVENT: GPIO#0=1
68307231: ACT : timerSet,1,5
68312233: EVENT: Rules#Timer=1,1
68312241: ACT : GPIO,0,0
68312242: GPIO : port#0: set to 0
68312245: ACT : SendToHTTP domoticz,8080,/json.htm?type=command¶m=switchlight&idx=88&switchcmd=On
68312319: EVENT: GPIO#0=0
Re: "watchdog" relay
Does your Domoticz require a username/password to be able to get access? Most likely it does, and your browser is quietly providing those to Domoticz, so there it will work.
When sending commands to Domoticz from other sources, like ESPEasy, the username & password need to be supplied (base64 encoded) as arguments in the url:
AFAICS, the base64 has to include padding.
When sending commands to Domoticz from other sources, like ESPEasy, the username & password need to be supplied (base64 encoded) as arguments in the url:
Code: Select all
SendToHTTP,domoticz,8080,/json.htm?username=BASE64USERNAME&password=BASE64PASSWORD&type=command¶m=switchlight&idx=%eventvalue1%&switchcmd=On
/Ton (PayPal.me)
Re: "watchdog" relay
Yes, I've credentials to access to front of Domoticz. But to access to json, I'm not sure. I remember that I've sh where I push credentials in url (for IFTTT). I dont know why but I was thinking that from local (192.168.x.x) it will need no credentials .
Just a question, concerning credentials.
In some example, Username and passeword are sent in before URL :
and in other case, like you're exemple with pwd and username in base 64 directly to json.
It's the same results ?
Just a question, concerning credentials.
In some example, Username and passeword are sent in before URL :
Code: Select all
http://username:pwd@domoticz:8080/json.htm?type=command¶m=switchlight&idx=88&switchcmd=On&level=0&passcode=
Code: Select all
http://username:pwd@domoticz:8080/json.htm?username=BASE64USERNAME&password=BASE64PASSWORD&type=command¶m=switchlight&idx=88&switchcmd=On
Re: "watchdog" relay
Haven't tried to authenticate with username:pwd@domoticz but I'd assume that's not directly supported by ESPEasy, so the &username= and &password= arguments in the url is easy to apply, just use Notepad++ with the MIME Tools plugin (installed by default, I think, not sure) or an on-line service will provide you with something useful, f.e. admin will translate to YWRtaW4= so you use that result (with the = padding included) in the url.
/Ton (PayPal.me)
Re: "watchdog" relay
works like a charm by pusching credentials to json.
Thanks for your help
Thanks for your help
Re: "watchdog" relay
Hi,
Just to add new technology to my domoticz and acquire new skills , I've mount MQTT server (mosquitto) and connects my espeasy to domoticz with MQTT.
It works like a charm but i've a question My rules is like that :
as you can see, at the end of the timer, the return state is made with json request. Sure it works but how can I do the same with MQTT to be consistent ?
Thanks
Just to add new technology to my domoticz and acquire new skills , I've mount MQTT server (mosquitto) and connects my espeasy to domoticz with MQTT.
It works like a charm but i've a question My rules is like that :
Code: Select all
on System#Boot do
Monitor GPIO,0
endon
on GPIO#0=1 do
timerSet,1,5 // Set timer to 5 seconds
endon
On Rules#Timer=1 do
GPIO,0,0
SendToHTTP domoticz,8080,/json.htm?username=xxx&password=yyyy&type=command¶m=switchlight&idx=88&switchcmd=Off&level=0&passcode=
endon
Thanks
Re: "watchdog" relay
This is where the Domoticz MQTT Controller comes in
- Configure the Domoticz MQTT Controller using the correct username/password
- Lookup in Domoticz what the matching Dummy device's IDX is
- In ESPEasy set up a Switch device using GPIO-0.
- Enable the Controller on the Device Configuration for the switch using the IDX obtained before
That should report the status to Domoticz, using the Domoticz/in topic, no need to report status every time, it will be sent when status changes (both on and off).
- Configure the Domoticz MQTT Controller using the correct username/password
- Lookup in Domoticz what the matching Dummy device's IDX is
- In ESPEasy set up a Switch device using GPIO-0.
- Enable the Controller on the Device Configuration for the switch using the IDX obtained before
That should report the status to Domoticz, using the Domoticz/in topic, no need to report status every time, it will be sent when status changes (both on and off).
/Ton (PayPal.me)
Re: "watchdog" relay
That's exactly what I did.
When I click on the dummy device in domoticz (Switch), the GPio is set to 1 (and Relay click ).
But when the timer sets GPio to 0, in domoticz the switch does not change state.
When I click on the dummy device in domoticz (Switch), the GPio is set to 1 (and Relay click ).
But when the timer sets GPio to 0, in domoticz the switch does not change state.
Re: "watchdog" relay
That's exactly what the Controller selection (and IDX) on the Device configuration page is for... quite surprising you can't get it working, as it is exactly how I set up my Sonoff S20's to make them work reliably. And they react to and show their state however I change the relay GPIO state.
For controlling a GPIO pin on an ESP, I use the Domoticz MQTT Helper plugin to set the relay in the correct state. (That also takes an IDX, and expects the Domoticz MQTT Controller active.)
/Ton (PayPal.me)
Re: "watchdog" relay
See here for more info on the Domoticz Helper plugin: https://espeasy.readthedocs.io/en/lates ... #p029-page
Re: "watchdog" relay
Thanks for your help.
I only had created the Domoticz MQTT Helper not the Switch input. That's why return stat does not work I think.
really thanks!
I only had created the Domoticz MQTT Helper not the Switch input. That's why return stat does not work I think.
really thanks!
Who is online
Users browsing this forum: No registered users and 0 guests