Rules help needed
Moderators: grovkillen, Stuntteam, TD-er
Rules help needed
Hello Everyone!
I need a little bit of your knowledge, because of my lack of it.
Tried to search the forum but couldn't find an answer for my question.
I'm using Wemos D1 mini with newest ESPEasy software.
Wemos is controlled by Domoticz.
To this Wemos I connected 3 relays, to GPIO 12, 13 and 14 and created 3 "normal switches".
I would like to control a device with this Wemos, for which I need those 3 relays. The thing is, that only one relay should be in "on" state at once, so when I send with the Domoticz command to ESP to turn on GPIO 12 I would like pins 13 and 14 to be off.
I can program this with Domoticz, but anyhow I would like to be "double-safe" and make it also by the rules in ESP.
Can you please help me how can I achieve this? I tried in many different ways, but without success.
Thank you in advance.
I need a little bit of your knowledge, because of my lack of it.
Tried to search the forum but couldn't find an answer for my question.
I'm using Wemos D1 mini with newest ESPEasy software.
Wemos is controlled by Domoticz.
To this Wemos I connected 3 relays, to GPIO 12, 13 and 14 and created 3 "normal switches".
I would like to control a device with this Wemos, for which I need those 3 relays. The thing is, that only one relay should be in "on" state at once, so when I send with the Domoticz command to ESP to turn on GPIO 12 I would like pins 13 and 14 to be off.
I can program this with Domoticz, but anyhow I would like to be "double-safe" and make it also by the rules in ESP.
Can you please help me how can I achieve this? I tried in many different ways, but without success.
Thank you in advance.
Re: Rules help needed
You should use events to switch your relays.
Now you just have to see how you trigger the event from Domoticz. Via http it looks like this:
Code: Select all
on eventname1 do
GPIO,12,1
GPIO,13,0
GPIO,14,0
endon
Code: Select all
http://<espeasyip>/control?cmd=event,eventname1
Re: Rules help needed
I'm sending from Domoticz command:
http://192.168.1.210/control?cmd=GPIO,13,1
and made in Rules:
on GPIO,12,1 do
GPIO,16,0
GPIO,13,0
GPIO,14,0
GPIO,12,1
endon
on GPIO,13,1 do
GPIO,12,0
GPIO,16,0
GPIO,14,0
GPIO,13,1
endon
on GPIO,14,1 do
GPIO,12,0
GPIO,13,0
GPIO,16,0
GPIO,14,1
endon
on GPIO,16,1 do
GPIO,12,0
GPIO,13,0
GPIO,14,0
GPIO,16,1
endon
Doesn't work unfortunately.
http://192.168.1.210/control?cmd=GPIO,13,1
and made in Rules:
on GPIO,12,1 do
GPIO,16,0
GPIO,13,0
GPIO,14,0
GPIO,12,1
endon
on GPIO,13,1 do
GPIO,12,0
GPIO,16,0
GPIO,14,0
GPIO,13,1
endon
on GPIO,14,1 do
GPIO,12,0
GPIO,13,0
GPIO,16,0
GPIO,14,1
endon
on GPIO,16,1 do
GPIO,12,0
GPIO,13,0
GPIO,14,0
GPIO,16,1
endon
Doesn't work unfortunately.
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules help needed
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Rules help needed
Yes, half last night. Even now I've been on this website, but can not find a sollution. Programming isn't my thing...
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules help needed
Your syntax on GPIO,16,1 do isn't correct. This example in the rules might be a start?
Triggered like this:
http://<espeasyip>/control?cmd=event,ToggleGPIO=12,1
Code: Select all
on ToggleGPIO do
GPIO,%eventvalue1%,%eventvalue2%
endon
http://<espeasyip>/control?cmd=event,ToggleGPIO=12,1
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules help needed
This might be working?
http://<espeasyip>/control?cmd=event,GPIOtoggle=12
Code: Select all
on GPIOtoggle do
GPIO,12,0
GPIO,13,0
GPIO,14,0
GPIO,16,0
GPIO,%eventvalue%,1
endon
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Rules help needed
Another method: See the on GPIO#N section in the readthedocs.
https://espeasy.readthedocs.io/en/lates ... Rules.html
- Thomas
https://espeasy.readthedocs.io/en/lates ... Rules.html
- Thomas
Re: Rules help needed
Works like a charm with one exception - after hitting "off", relay connected to "off" is switching for a couple of milliseconds and previous value is coming back. So if I had switched the selector switch to 3, then I hit OFF, it will change to OFF for a while and get back to 3.
Edit:
After removing all the devices from ESP and left this tab empty, everything works fine.
Thank you!
grovkillen wrote: ↑12 Mar 2020, 18:05 This might be working?
http://<espeasyip>/control?cmd=event,GPIOtoggle=12Code: Select all
on GPIOtoggle do GPIO,12,0 GPIO,13,0 GPIO,14,0 GPIO,16,0 GPIO,%eventvalue%,1 endon
Edit:
After removing all the devices from ESP and left this tab empty, everything works fine.
Thank you!
Re: Rules help needed
One more thing. After resetting ESP value doesn't come back to previous state - it doesn't read the value from Domoticz, as there is no code for that.
Is it possible to make it work?
If not, I will make just simple:
for default value to be working.
Is it possible to make it work?
If not, I will make just simple:
Code: Select all
On System#Boot do
GPIO,16,1
endon
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules help needed
No currently you'd need to use that type of fix. We have some ideas that we might be able to implement.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Rules help needed
Anyhow, thank you for the ready-to-go solution!
Who is online
Users browsing this forum: Ahrefs [Bot] and 83 guests