Rules Help
Moderators: grovkillen, Stuntteam, TD-er
-
- New user
- Posts: 7
- Joined: 17 Jan 2019, 23:34
Rules Help
hi to all, I'm new in the forum.
I recently met this wonderful software, it's really well done. I ask you for a suggestion for the application of a simple rule.
I'm using a wemosd1r1
in the GPIO 13 a pullup switch is connected. The GPIO at BOOT is in default configuration
I would like that: when the pullup switch goes to 1 (gpio13,1)
the gpio 14 goes to 1 (gpio14,1)
I use the gpio14 for other services in mqtt to nodered without any problem
I applied the rule I found at the address
https://espeasy.readthedocs.io/en/lates ... Rules.html
Without any success.
I did a more in-depth search in the forum and in google and applied many variations, without success.
I ask you if you can tell me which is the best solution, and how to apply it.
I enclose the photos of my configuration.
I thank those who want to help me.
Angelo Filippi
I recently met this wonderful software, it's really well done. I ask you for a suggestion for the application of a simple rule.
I'm using a wemosd1r1
in the GPIO 13 a pullup switch is connected. The GPIO at BOOT is in default configuration
I would like that: when the pullup switch goes to 1 (gpio13,1)
the gpio 14 goes to 1 (gpio14,1)
I use the gpio14 for other services in mqtt to nodered without any problem
I applied the rule I found at the address
https://espeasy.readthedocs.io/en/lates ... Rules.html
Without any success.
I did a more in-depth search in the forum and in google and applied many variations, without success.
I ask you if you can tell me which is the best solution, and how to apply it.
I enclose the photos of my configuration.
I thank those who want to help me.
Angelo Filippi
- Attachments
-
- log-output.png (33.24 KiB) Viewed 7065 times
-
- rules.png (11.43 KiB) Viewed 7065 times
-
- switch-pullup.png (8.98 KiB) Viewed 7065 times
-
- switch input.png (30.6 KiB) Viewed 7065 times
- dynamicdave
- Normal user
- Posts: 257
- Joined: 30 Jan 2017, 20:25
- Location: Hampshire, UK
Re: Rules Help
In your screenshots, your device name is Switch1 and the value is called State.
In the rules you have used... on Button#State=1 do
I think it should be... on Switch1#State=1 do
Regards, David
In the rules you have used... on Button#State=1 do
I think it should be... on Switch1#State=1 do
Regards, David
-
- New user
- Posts: 7
- Joined: 17 Jan 2019, 23:34
Re: Rules Help
Hi thank you for the reply
i have applied you suggestion but nothing...
now the rules are:
on Switch1#State=1 do
timerSet,1,1
endon
on rules#timer=1 do
if [Switch1#State]=0
gpio,14,1
endif
endon
the GPIO14 is always turned off.
how to have the same result using in the rules mqtt?
i have applied you suggestion but nothing...
now the rules are:
on Switch1#State=1 do
timerSet,1,1
endon
on rules#timer=1 do
if [Switch1#State]=0
gpio,14,1
endif
endon
the GPIO14 is always turned off.
how to have the same result using in the rules mqtt?
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules Help
angelo-filippi wrote: ↑18 Jan 2019, 16:09 Hi thank you for the reply
i have applied you suggestion but nothing...
now the rules are:
on Switch1#State=1 do
timerSet,1,1
endon
on rules#timer=1 do
if [Switch1#State]=0
gpio,14,1
endif
endon
the GPIO14 is always turned off.
how to have the same result using in the rules mqtt?
Code: Select all
on Switch1#State=1 do
timerSet,1,1
endon
on rules#timer=1 do
if [Switch1#State]=0
gpio,14,1
else
gpio,14,0
endif
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
-
- New user
- Posts: 7
- Joined: 17 Jan 2019, 23:34
Re: Rules Help
Thank you for the reply,
no, the GPIO14 is always turned off
2704105: SW : GPIO=13 State=0 Output value=1
2704112: EVENT: Switch1#State=1.00
2705205: SW : GPIO=13 State=0 Output value=0
2705212: EVENT: Switch1#State=0.00
no, the GPIO14 is always turned off
2704105: SW : GPIO=13 State=0 Output value=1
2704112: EVENT: Switch1#State=1.00
2705205: SW : GPIO=13 State=0 Output value=0
2705212: EVENT: Switch1#State=0.00
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules Help
You're using the newer version which got double click and long press already. Use those events instead.
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
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
-
- New user
- Posts: 7
- Joined: 17 Jan 2019, 23:34
Re: Rules Help
Mmm.
I read the wiki. I thought about using a single event.
Thank you very much for helping.
I try your suggestion as soon as possible.
Espeasy is fantastic.
Congratulations to the whole development team
I read the wiki. I thought about using a single event.
Thank you very much for helping.
I try your suggestion as soon as possible.
Espeasy is fantastic.
Congratulations to the whole development team
Re: Rules Help
How long should gpio 14 be 1? As long as gpio 13 is 1 or should gpio 13 toggle 14?
as long as gpio13 is 1:
on Switch1#State do
if [Switch1#State]=1
gpio,14,1
else
gpio,14,0
endif
endon
Don*t know why you use the timer
in this Case (toggle everytime gpio 13 gets 1) i use Dummy Device (task12, Name = status, first value name = io14) to show the state of the io14
maybe the very first "toggle" goes wrong, because io14 and dummy is not equal. And if you change io14 in another way (second switch or mqtt) you should update the TaskValueSet too.
on Switch1#State=1 do
If [status#io14]=1 -----> Dummy Device
TaskValueSet,12,1,0 -----> set Dummy Device like gpio
GPIO,14,0
Else
TaskValueSet,12,1,1
GPIO,14,1
EndIf
EndOn
as long as gpio13 is 1:
on Switch1#State do
if [Switch1#State]=1
gpio,14,1
else
gpio,14,0
endif
endon
Don*t know why you use the timer
in this Case (toggle everytime gpio 13 gets 1) i use Dummy Device (task12, Name = status, first value name = io14) to show the state of the io14
maybe the very first "toggle" goes wrong, because io14 and dummy is not equal. And if you change io14 in another way (second switch or mqtt) you should update the TaskValueSet too.
on Switch1#State=1 do
If [status#io14]=1 -----> Dummy Device
TaskValueSet,12,1,0 -----> set Dummy Device like gpio
GPIO,14,0
Else
TaskValueSet,12,1,1
GPIO,14,1
EndIf
EndOn
-
- New user
- Posts: 7
- Joined: 17 Jan 2019, 23:34
Re: Rules Help
Dear friends, thank you again for your precious help.
I followed your generous instructions, unfortunately without luck.
I applied the rules you suggested to me, I really did the most disparate tests
yet it is simple.
at boot the gpio14 is at 0
1 press on the button (gpio13)
the gpio14 (led) must light up.
1 press on the button (gpio13)
the gpio14 (led) must go off.
If possible without mqtt.
@fraeggle I used the timer because it is written in the wiki.
thanks for the suggestion on using the dummy device,
using the rules you suggested, but no success, I attach my configuration.
THANK YOU FOR ALL
{"System":{
"Build":20103,
"Git Build":"mega-20190108",
"System libraries":"ESP82xx Core 2_4_2, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.0.3 PUYA support",
"Plugins":46,
"Plugin description":" [Normal]",
"Local time":"2019-01-21 23:03:02",
"Unit":1,
"Name":"ESP_Easy",
"Uptime":69,
"Last boot cause":"Cold boot",
"Reset Reason":"External System",
"Load":25.00,
"Load LC":6776,
"Free RAM":17744
},
"WiFi":{
"Hostname":"ESP-Easy-1",
"IP config":"DHCP",
"IP":"192.168.20.243",
"Subnet Mask":"255.255.255.0",
"Gateway IP":"192.168.20.1",
"MAC address":"60:01:94:70:09:0F",
"DNS 1":"8.8.8.8",
"DNS 2":"0.0.0.0",
"SSID":"WIFI-01",
"BSSID":"E4:8D:8C:D4:55:29",
"Channel":1,
"Connected msec":4149297,
"Last Disconnect Reason":1,
"Last Disconnect Reason str":"(1) Unspecified",
"Number reconnects":0,
"RSSI":-42
},
"Sensors":[
{
"DataAcquisition": [
{"Controller":1,
"IDX":0,
"Enabled":"false"
},
{"Controller":2,
"IDX":0,
"Enabled":"false"
},
{"Controller":3,
"IDX":0,
"Enabled":"false"
}],
"TaskInterval":1,
"Type":"Display - LCD2004",
"TaskName":"LCD",
"TaskEnabled":"true",
"TaskNumber":1
},
{
"TaskValues": [
{"ValueNumber":1,
"Name":"Temp",
"NrDecimals":1,
"Value":19.3
},
{"ValueNumber":2,
"Name":"Hum",
"NrDecimals":1,
"Value":48.7
}],
"DataAcquisition": [
{"Controller":1,
"IDX":1,
"Enabled":"true"
},
{"Controller":2,
"IDX":0,
"Enabled":"false"
},
{"Controller":3,
"IDX":0,
"Enabled":"false"
}],
"TaskInterval":60,
"Type":"Environment - DHT11/12/22 SONOFF2301/7021",
"TaskName":"DHT22",
"TaskEnabled":"true",
"TaskNumber":2
},
{
"TaskValues": [
{"ValueNumber":1,
"Name":"State",
"NrDecimals":0,
"Value":1
}],
"DataAcquisition": [
{"Controller":1,
"IDX":0,
"Enabled":"true"
},
{"Controller":2,
"IDX":3,
"Enabled":"true"
},
{"Controller":3,
"IDX":0,
"Enabled":"false"
}],
"TaskInterval":0,
"Type":"Switch input - Switch",
"TaskName":"Switch1",
"TaskEnabled":"true",
"TaskNumber":3
},
{
"TaskValues": [
{"ValueNumber":1,
"Name":"io14",
"NrDecimals":2,
"Value":0.00
},
{"ValueNumber":2,
"Name":"",
"NrDecimals":2,
"Value":0.00
},
{"ValueNumber":3,
"Name":"",
"NrDecimals":2,
"Value":0.00
},
{"ValueNumber":4,
"Name":"",
"NrDecimals":2,
"Value":0.00
}],
"DataAcquisition": [
{"Controller":1,
"IDX":0,
"Enabled":"true"
},
{"Controller":2,
"IDX":4,
"Enabled":"true"
},
{"Controller":3,
"IDX":0,
"Enabled":"false"
}],
"TaskInterval":60,
"Type":"Generic - Dummy Device",
"TaskName":"status",
"TaskEnabled":"true",
"TaskNumber":4
}
],
"TTL":60000
}
I followed your generous instructions, unfortunately without luck.
I applied the rules you suggested to me, I really did the most disparate tests
yet it is simple.
at boot the gpio14 is at 0
1 press on the button (gpio13)
the gpio14 (led) must light up.
1 press on the button (gpio13)
the gpio14 (led) must go off.
If possible without mqtt.
@fraeggle I used the timer because it is written in the wiki.
thanks for the suggestion on using the dummy device,
using the rules you suggested, but no success, I attach my configuration.
THANK YOU FOR ALL
{"System":{
"Build":20103,
"Git Build":"mega-20190108",
"System libraries":"ESP82xx Core 2_4_2, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.0.3 PUYA support",
"Plugins":46,
"Plugin description":" [Normal]",
"Local time":"2019-01-21 23:03:02",
"Unit":1,
"Name":"ESP_Easy",
"Uptime":69,
"Last boot cause":"Cold boot",
"Reset Reason":"External System",
"Load":25.00,
"Load LC":6776,
"Free RAM":17744
},
"WiFi":{
"Hostname":"ESP-Easy-1",
"IP config":"DHCP",
"IP":"192.168.20.243",
"Subnet Mask":"255.255.255.0",
"Gateway IP":"192.168.20.1",
"MAC address":"60:01:94:70:09:0F",
"DNS 1":"8.8.8.8",
"DNS 2":"0.0.0.0",
"SSID":"WIFI-01",
"BSSID":"E4:8D:8C:D4:55:29",
"Channel":1,
"Connected msec":4149297,
"Last Disconnect Reason":1,
"Last Disconnect Reason str":"(1) Unspecified",
"Number reconnects":0,
"RSSI":-42
},
"Sensors":[
{
"DataAcquisition": [
{"Controller":1,
"IDX":0,
"Enabled":"false"
},
{"Controller":2,
"IDX":0,
"Enabled":"false"
},
{"Controller":3,
"IDX":0,
"Enabled":"false"
}],
"TaskInterval":1,
"Type":"Display - LCD2004",
"TaskName":"LCD",
"TaskEnabled":"true",
"TaskNumber":1
},
{
"TaskValues": [
{"ValueNumber":1,
"Name":"Temp",
"NrDecimals":1,
"Value":19.3
},
{"ValueNumber":2,
"Name":"Hum",
"NrDecimals":1,
"Value":48.7
}],
"DataAcquisition": [
{"Controller":1,
"IDX":1,
"Enabled":"true"
},
{"Controller":2,
"IDX":0,
"Enabled":"false"
},
{"Controller":3,
"IDX":0,
"Enabled":"false"
}],
"TaskInterval":60,
"Type":"Environment - DHT11/12/22 SONOFF2301/7021",
"TaskName":"DHT22",
"TaskEnabled":"true",
"TaskNumber":2
},
{
"TaskValues": [
{"ValueNumber":1,
"Name":"State",
"NrDecimals":0,
"Value":1
}],
"DataAcquisition": [
{"Controller":1,
"IDX":0,
"Enabled":"true"
},
{"Controller":2,
"IDX":3,
"Enabled":"true"
},
{"Controller":3,
"IDX":0,
"Enabled":"false"
}],
"TaskInterval":0,
"Type":"Switch input - Switch",
"TaskName":"Switch1",
"TaskEnabled":"true",
"TaskNumber":3
},
{
"TaskValues": [
{"ValueNumber":1,
"Name":"io14",
"NrDecimals":2,
"Value":0.00
},
{"ValueNumber":2,
"Name":"",
"NrDecimals":2,
"Value":0.00
},
{"ValueNumber":3,
"Name":"",
"NrDecimals":2,
"Value":0.00
},
{"ValueNumber":4,
"Name":"",
"NrDecimals":2,
"Value":0.00
}],
"DataAcquisition": [
{"Controller":1,
"IDX":0,
"Enabled":"true"
},
{"Controller":2,
"IDX":4,
"Enabled":"true"
},
{"Controller":3,
"IDX":0,
"Enabled":"false"
}],
"TaskInterval":60,
"Type":"Generic - Dummy Device",
"TaskName":"status",
"TaskEnabled":"true",
"TaskNumber":4
}
],
"TTL":60000
}
- Attachments
-
- dummy.PNG (33.83 KiB) Viewed 6925 times
Re: Rules Help
At first you wrote you switch gpio13 by pulling it up.
But in your first configuration screenshot I can see internal pullup enabled.
So your gpio13 is on log. 1 in standby and you must switch to ground and check log. low state when switch is pressed.
If I understand well, you want to change the status of the led output every time you press the button.
I had a similar project for switching on and switching off light using a button and using commands sent from other ESPs and Domoticz along with sending the current status back to Domoticz.
My rules ( gpio12 - relay, gpio13 - LED
I am using old "stable" versions _dev13 and V2.0 and defined auxiliary input switch on the same gpio like relay is, so I can check actual relay status by reading [rele#Switch]
An example of a similar device configuration but from another project, so relay is on gpio-5: But in actual mega versions of firmware this is maybe not possible.
I read something like this in a forum.
But in your first configuration screenshot I can see internal pullup enabled.
So your gpio13 is on log. 1 in standby and you must switch to ground and check log. low state when switch is pressed.
If I understand well, you want to change the status of the led output every time you press the button.
I had a similar project for switching on and switching off light using a button and using commands sent from other ESPs and Domoticz along with sending the current status back to Domoticz.
My rules ( gpio12 - relay, gpio13 - LED
Code: Select all
on lamp_on do
gpio,12,1
gpio,13,0
endon
on lamp_off do
gpio,12,0
gpio,13,1
endon
on lamp_change do
if [rele#Switch]=1
event,lamp_off
SendToHTTP 192.168.1.253,8080,/json.htm?type=command¶m=switchlight&idx=19&switchcmd=Off
else
event,lamp_on
SendToHTTP 192.168.1.253,8080,/json.htm?type=command¶m=switchlight&idx=19&switchcmd=On
endif
endon
on SW01#Switch do
event,lamp_change
endon
An example of a similar device configuration but from another project, so relay is on gpio-5: But in actual mega versions of firmware this is maybe not possible.
I read something like this in a forum.
Re: Rules Help
kimot wrote: ↑22 Jan 2019, 08:42 At first you wrote you switch gpio13 by pulling it up.
But in your first configuration screenshot I can see internal pullup enabled.
So your gpio13 is on log. 1 in standby and you must switch to ground and check log. low state when switch is pressed.
You are right... haven't seen this.
@angelo-filippi:
How is your switch and GPIO13 connected.
can you try following:
GPIO 13 connectect via 10k to Ground and via 1k and switch to 5V.
Change GPIO Device to Pullup Enabled normal switch...
Gnd ------| 10k |----O------| 1K |----/ --------> 5V
|
|-----> Gpio13
Re: Rules Help
Simply enable pullup and through switch connect gpio to ground.
Re: Rules Help
fraeggle wrote: ↑22 Jan 2019, 10:45ups gpio 13 should be between 10k and 1k,kimot wrote: ↑22 Jan 2019, 08:42 At first you wrote you switch gpio13 by pulling it up.
But in your first configuration screenshot I can see internal pullup enabled.
So your gpio13 is on log. 1 in standby and you must switch to ground and check log. low state when switch is pressed.
You are right... haven't seen this.
@angelo-filippi:
How is your switch and GPIO13 connected.
can you try following:
GPIO 13 connectect via 10k to Ground and via 1k and switch to 5V.
Change GPIO Device to Pullup Enabled normal switch...
Gnd ------| 10k |----O------| 1K |----/ --------> 5V
|
|-----> Gpio13
He wrote "I would like that: when the pullup switch goes to 1 (gpio13,1), the gpio 14 goes to 1 (gpio14,1)"
by kimot » 22 Jan 2019, 11:06
Simply enable pullup and through switch connect gpio to ground. ---> in this case GPIO13 is 1 and 0 wenn pressed (if he usese a normal button. Ok in the end it will be the same effect, but then it would be better to change if GPIO 13 goes 0).
Who is online
Users browsing this forum: No registered users and 36 guests