Rules Event On and OFF
Moderators: grovkillen, Stuntteam, TD-er
Rules Event On and OFF
Guys,
I am stuck in my rules and do not understand where I am going wrong
From the page :
https://www.letscontrolit.com/wiki/inde ... ith_events
I have copied the full script and started to modify it a little.
Now the issue I am facing that I can start the event, but can not stop it #$%#$%@$#
I can start it with:
http://192.168.1.19/control?cmd=event,vuurtorenaan
But stop does not work:
http://192.168.1.19/control?cmd=event,vuurtorenuit
As you can see I have put an LED on GPIO 13. The led goes on and off per url request to go on and off. So the even on/off works.
I guess the issue is in the "timerSet,1,0" on the stop event. But as you can see the code is copied from the example page.......
Please advise or hint me in the correct direction ?
Goal :
To be able with a URL into ESP_EASY to start and stop a PWM slow on and off signal simulation a lighthouse light.
Many thanks for your time/help
Frank
-------------------------------
This is my rules code :
//start the warning signal when we receive a start_warning event:
On vuurtorenaan do
timerSet,1,1
gpio,13,1
endon
//stop the warning signal when we receive a stop_warning event:
On vuurtorenuit do
timerSet,1,0
gpio,13,0
endon
//create an actual warning signal, every time timer 1 expires:
On Rules#Timer=1 do
//repeat after 2 seconds
timerSet,1,0.5
//pulse some led on pin 4 shortly
PWM,13,1024,1000
gpio,16,1
//Pulse,14,1,500
//produce a short 1000hz beep via a piezo element on pin 14
PWM,13,0,1000
gpio,16,0
endon
---------------------------------
I am stuck in my rules and do not understand where I am going wrong
From the page :
https://www.letscontrolit.com/wiki/inde ... ith_events
I have copied the full script and started to modify it a little.
Now the issue I am facing that I can start the event, but can not stop it #$%#$%@$#
I can start it with:
http://192.168.1.19/control?cmd=event,vuurtorenaan
But stop does not work:
http://192.168.1.19/control?cmd=event,vuurtorenuit
As you can see I have put an LED on GPIO 13. The led goes on and off per url request to go on and off. So the even on/off works.
I guess the issue is in the "timerSet,1,0" on the stop event. But as you can see the code is copied from the example page.......
Please advise or hint me in the correct direction ?
Goal :
To be able with a URL into ESP_EASY to start and stop a PWM slow on and off signal simulation a lighthouse light.
Many thanks for your time/help
Frank
-------------------------------
This is my rules code :
//start the warning signal when we receive a start_warning event:
On vuurtorenaan do
timerSet,1,1
gpio,13,1
endon
//stop the warning signal when we receive a stop_warning event:
On vuurtorenuit do
timerSet,1,0
gpio,13,0
endon
//create an actual warning signal, every time timer 1 expires:
On Rules#Timer=1 do
//repeat after 2 seconds
timerSet,1,0.5
//pulse some led on pin 4 shortly
PWM,13,1024,1000
gpio,16,1
//Pulse,14,1,500
//produce a short 1000hz beep via a piezo element on pin 14
PWM,13,0,1000
gpio,16,0
endon
---------------------------------
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules Event On and OFF
Code: Select all
On vuurtorenuit do
timerSet,1,0
gpio,13,0
endon
Code: Select all
On vuurtorenuit do
gpio,13,0
timerSet,1,0
endon
Hope it helps
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 Event On and OFF
You should not mix gpio and pwm commands to the same pin (because it does not handle well).
If pwm has been used on a pin, the gpio commands have no effect until you set pwm to value 0 before using gpio commands again...
If pwm has been used on a pin, the gpio commands have no effect until you set pwm to value 0 before using gpio commands again...
Re: Rules Event On and OFF
Guys
Thanks for the quick reply.
I cleaned up my test code/rules. And stil having the same issue..
Can start with :
http://192.168.1.19/control?cmd=event,vuurtorenaan
Can not stop with :
http://192.168.1.19/control?cmd=event,vuurtorenuit
Would you be so kind to look after it again and advise me why my "vuurtorenuit" event does not stop the cyclus ?
===================
My code
//start the signal when we receive a vuurtorenaan event:
On vuurtorenaan do
timerSet,1,1
endon
//stop the signal when we receive a vuurtorenuit event:
On vuurtorenuit
timerSet,1,0
endon
//create an actual warning signal, every time timer 1 expires:
On Rules#Timer=1 do
//fade on led
PWM,13,1024,1000
//fade off led
PWM,13,0,1000
//repeat after 1 seconds
timerSet,1,1
endon
Thanks for the quick reply.
I cleaned up my test code/rules. And stil having the same issue..
Can start with :
http://192.168.1.19/control?cmd=event,vuurtorenaan
Can not stop with :
http://192.168.1.19/control?cmd=event,vuurtorenuit
Would you be so kind to look after it again and advise me why my "vuurtorenuit" event does not stop the cyclus ?
===================
My code
//start the signal when we receive a vuurtorenaan event:
On vuurtorenaan do
timerSet,1,1
endon
//stop the signal when we receive a vuurtorenuit event:
On vuurtorenuit
timerSet,1,0
endon
//create an actual warning signal, every time timer 1 expires:
On Rules#Timer=1 do
//fade on led
PWM,13,1024,1000
//fade off led
PWM,13,0,1000
//repeat after 1 seconds
timerSet,1,1
endon
Re: Rules Event On and OFF
Hemmmmmmm
The below code does go on and off with the event on and off url
Only difference I see is that the timer is set to 600 instead of 1 sec.
Any hints ?
======================
On startw do
gpio,13,1 //start watering (open valve)
timerSet,1,600 //timer 1 set for 10 minutes
endon
On stopw do
timerSet,1,0 //timer 1 set to halt, used to stop watering before the timer ends!
endon
On Rules#Timer=1 do
gpio,13,0 //stop watering (close valve)
endOn
The below code does go on and off with the event on and off url
Only difference I see is that the timer is set to 600 instead of 1 sec.
Any hints ?
======================
On startw do
gpio,13,1 //start watering (open valve)
timerSet,1,600 //timer 1 set for 10 minutes
endon
On stopw do
timerSet,1,0 //timer 1 set to halt, used to stop watering before the timer ends!
endon
On Rules#Timer=1 do
gpio,13,0 //stop watering (close valve)
endOn
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Rules Event On and OFF
Yes, 1 second might be a bit fast and possibly is casing the timer to miss the trigger. We need to make a small passus about short time when using timer (on the wiki).
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 Event On and OFF
Hallo Freijn
Maybe a litle too late.
I think why it doesn't switch off is because of your PWM delays.
An ESP is a single threat processor.
While it is busy with PWM delay it cannot receive/handle other actions.
i didn't try but i had a same sort of issue.
Succes.
Gr Ernst
PS Wat voor soort vuurtoren schakel je aan en uit?
Maybe a litle too late.
I think why it doesn't switch off is because of your PWM delays.
An ESP is a single threat processor.
While it is busy with PWM delay it cannot receive/handle other actions.
i didn't try but i had a same sort of issue.
Succes.
Gr Ernst
PS Wat voor soort vuurtoren schakel je aan en uit?
Re: Rules Event On and OFF
Hi Ernst,
I will test your suggestion, many thanks !
If I send a reboot, it does switch off after all
The lighthouse is a plastic tower little over 1 meter hight. I have put an 12v super power led in it. Officially not dimmable but in a short span it does emulate the
lighthouse light effect of a light doing circles in the top of the tower.
Will let you know the results,
Frank
I will test your suggestion, many thanks !
If I send a reboot, it does switch off after all
The lighthouse is a plastic tower little over 1 meter hight. I have put an 12v super power led in it. Officially not dimmable but in a short span it does emulate the
lighthouse light effect of a light doing circles in the top of the tower.
Will let you know the results,
Frank
Re: Rules Event On and OFF
Ernst
I have made this one. Brute force hack, but it works (mind the reboot )
//start the warning signal when we receive a start_warning event:
On start_warning do
timerSet,1,2
endon
//stop the warning signal when we receive a stop_warning event:
On stop_warning do
reboot
endon
//create an actual warning signal, every time timer 1 expires:
On Rules#Timer=1 do
//repeat after 2 seconds
timerSet,1,2
//pulse some led on pin 4 shortly
Pwm,13,1024,800
//produce a short 1000hz beep via a piezo element on pin 14
pwm,13,0,800
delay 300
endon
I have made this one. Brute force hack, but it works (mind the reboot )
//start the warning signal when we receive a start_warning event:
On start_warning do
timerSet,1,2
endon
//stop the warning signal when we receive a stop_warning event:
On stop_warning do
reboot
endon
//create an actual warning signal, every time timer 1 expires:
On Rules#Timer=1 do
//repeat after 2 seconds
timerSet,1,2
//pulse some led on pin 4 shortly
Pwm,13,1024,800
//produce a short 1000hz beep via a piezo element on pin 14
pwm,13,0,800
delay 300
endon
Who is online
Users browsing this forum: Google [Bot] and 152 guests