Rules don´t work if wifi not present
Moderators: grovkillen, Stuntteam, TD-er
Rules don´t work if wifi not present
I experienced it twice now that my rules doesn´t work when there is no wifi present.
Unfortunately there is no log i can provide since i had no equipment with me to get one.
E.g.
I made an automated chicken coop door for a friend. A button to open and close manually and a ldr for automatic mode.
So i tested it at home for a while and it worked perfectly.
Then i added a fallback ssid in case the internet at the friends place is strong enough to reach the esp. Otherwise i would configured it in ap mode. (release: mega-20210503)
So i brought it to the friend and installed it. and it did not work. It seemed, that the rules are beeing simply ignored. I also got no AP and the Wifi there was to weak. (powercycling did not work)
So i had to uninstall the electronics and bring it closer to the Router. And then it connected and everything worked as expected.
Even when i brought it back to its place it it worked and switched into AP mode.
I am pretty sure i had this once with the previous release to.
What could this be? And how to circumvent this issue?
Unfortunately there is no log i can provide since i had no equipment with me to get one.
E.g.
I made an automated chicken coop door for a friend. A button to open and close manually and a ldr for automatic mode.
So i tested it at home for a while and it worked perfectly.
Then i added a fallback ssid in case the internet at the friends place is strong enough to reach the esp. Otherwise i would configured it in ap mode. (release: mega-20210503)
So i brought it to the friend and installed it. and it did not work. It seemed, that the rules are beeing simply ignored. I also got no AP and the Wifi there was to weak. (powercycling did not work)
So i had to uninstall the electronics and bring it closer to the Router. And then it connected and everything worked as expected.
Even when i brought it back to its place it it worked and switched into AP mode.
I am pretty sure i had this once with the previous release to.
What could this be? And how to circumvent this issue?
Re: Rules don´t work if wifi not present
That should not happen.
The only thing I can imagine is that you base your rules on a system time and as long as the node does not have a time set, the clock events may not occur.
I do have planned to add support for an RTC timer IC soon, so I guess that may be your fix here.
To test this hypothesis, I guess you could set the time in the rules on system#boot via a command.
Just to some time, which makes it easy for you to test if this is the true cause here.
The only thing I can imagine is that you base your rules on a system time and as long as the node does not have a time set, the clock events may not occur.
I do have planned to add support for an RTC timer IC soon, so I guess that may be your fix here.
To test this hypothesis, I guess you could set the time in the rules on system#boot via a command.
Just to some time, which makes it easy for you to test if this is the true cause here.
Re: Rules don´t work if wifi not present
I don´t use the time at any point nor is ntp activated...
Re: Rules don´t work if wifi not present
Can you then see if the node maybe reboots (for whatever reason. should also not happen) before the rules can be executed?
Do you have some example part (or complete) of the rules?
Do you have some example part (or complete) of the rules?
Re: Rules don´t work if wifi not present
but i do remember now, that the relay worked but the timing was not correct..
so if the door opens the relay is switching for x milliseconds on..
...but it switched for several seconds. in a way it was totally not expected.
to bad i have no log of it...
maybe i build a test setup for recreating the error
so if the door opens the relay is switching for x milliseconds on..
...but it switched for several seconds. in a way it was totally not expected.
to bad i have no log of it...
maybe i build a test setup for recreating the error
Re: Rules don´t work if wifi not present
Code: Select all
On System#Boot do
TimerSet,4,10
let,3,1
endon
On licht#Analog do
if [licht#Analog] >600 //300
if [var#2]=0
Let,2,1
event,testauf
endif
elseif [licht#Analog] <500 //240
if [var#2]=1
Let,2,0
event,testauf
endif
endif
endon
on auf do
gpio,2,0
gpio,0,1
taskvalueset,5,1,1
TimerSet_ms,1,3500
endon
on zu do
gpio,0,0
gpio,2,1
taskvalueset,5,1,0
TimerSet_ms,1,3500
endon
On Rules#Timer=1 do
if [var#1]=1
let,1,0
else
let,1,1
endif
gpio,2,1
gpio,0,1
let,3,1
endon
On Rules#Timer=4 do
SendToHTTP api.thingspeak.com,80,/update?api_key=******&field7=[licht#Analog]&field8=[aufzu#Dummy]
TimerSet,4,300
endon
On testauf do
if [var#2]=1
TimerSet,2,600
TimerSet,3,0
elseif [var#2]=0
TimerSet,3,600
TimerSet,2,0
endif
endon
On Rules#Timer=2 do
if [var#2]=1 and [aufzu#Dummy]=0
event,auf
endif
endon
On Rules#Timer=3 do
if [var#2]=0 and [aufzu#Dummy]=1
event,zu
endif
endon
on Button#State=1 do
if [var#1]=1 and [var#3]=1
event,auf
let,3,0
elseif [var#1]=0 and [var#3]=1
event,zu
let,3,0
endif
endon
Re: Rules don´t work if wifi not present
no i couldn´t when it wasn´t connected to anything and before and after that there where no unexpected reboots.
Powersource is fine and as i said i tested it for quite a while before moving....
the thing in common with the last project where it happend was the moving the esp to another place with the fallback ssid entered (for the wifi at its destination). So i had this feeling, that this might be an issue...
Re: Rules don´t work if wifi not present
Don't underestimate my powers in making bugs... It is not always the power source, sometimes it is just the source written by the powers-that-be
Re: Rules don´t work if wifi not present
Don't underestimate my powers in making bugs... It is not always the power source, sometimes it is just the source written by the powers-that-be
Re: Rules don´t work if wifi not present
In timer 4 eventhandler you are using SendToHTTP, isn't that causing issues, like blocking time-outs or watchdog reboots, when WiFi is down/unavailable?
/Ton (PayPal.me)
Re: Rules don´t work if wifi not present
Do you think this blocks everything when not able to finish....hmmmm... I'll test this but i find it unlikely..
Re: Rules don´t work if wifi not present
It should test for WiFi connected.
Re: Rules don´t work if wifi not present
And it happend again.... this time i had my serial monitor attached.
I was working at a place with weak wifi and realized, that with the loss of the connection the esp did not repond anymore to inputs nor worked the rules.
How do i attach the serial log since it is to big to post?
Here is the rule:
here the device overview:
the rest is standard. no special config
EDIT: just disabled task nr.12 and removed it from the rules to rule that out...
EDIT2: disabled ntp to rule this out too.... and as log as the wifi scan is in progress nothing works
I was working at a place with weak wifi and realized, that with the loss of the connection the esp did not repond anymore to inputs nor worked the rules.
How do i attach the serial log since it is to big to post?
Here is the rule:
Code: Select all
on rotary#Counter do
if [rotary#Counter] > [count#Value] and [count#Dummy] < 30
Taskvalueset,6,1,[count#Dummy]+0.5
elseif [rotary#Counter] < [count#Value] and [count#Dummy] > 10
Taskvalueset,6,1,[count#Dummy]-0.5
endif
if [count#Dummy] < 10
[display2].7dtext," [count#Dummy]"
elseif [count#Dummy] > 9 and [count#Dummy] < 100
[display2].7dtext,"[count#Dummy]"
elseif [count#Dummy] > 99
[display2].7dtext,"[count#Dummy]"
endif
Taskvalueset,6,2,[rotary#Counter]
endon
on licht#Analog do
Let,6,[sensor#Temperature]*10
Let,7,[int#6]-[sensor#Temperature#F]*10
if [var#7] < 5
[display2].7dtext," [sensor#Temperature#F]^"
else
[display2].7dtext," [sensor#Temperature#F]!"
endif
endon
on button#State=0 do
Taskvalueset,6,1,0
[display2].7dtext," [count#Dummy]"
endon
on licht#Analog do
if [licht#Analog] >300
[display1].7db,15
[display2].7db,10
elseif [licht#Analog] >70 and [licht#Analog] <=250
[display1].7db,10
[display2].7db,6
elseif [licht#Analog] >= 10 and [licht#Analog] <=60
[display1].7db,0
[display2].7db,0
elseif [licht#Analog] <5
[display1].7doff
[display2].7doff
endif
endon
the rest is standard. no special config
EDIT: just disabled task nr.12 and removed it from the rules to rule that out...
EDIT2: disabled ntp to rule this out too.... and as log as the wifi scan is in progress nothing works
Re: Rules don´t work if wifi not present
I am not 100% sure right now but it seems, that disabling "Periodical Scan WiFi" solve the issue....
Re: Rules don´t work if wifi not present
You can attach such big log as an attachment.
You have quite complex code to fill the value nicely on the display:
Instead of that you can use the formatting features in the replacement of [task#variable(#formatting(#justification))], so your code could be replaced by this:
You have quite complex code to fill the value nicely on the display:
Code: Select all
if [count#Dummy] < 10
[display2].7dtext," [count#Dummy]"
elseif [count#Dummy] > 9 and [count#Dummy] < 100
[display2].7dtext,"[count#Dummy]"
elseif [count#Dummy] > 99
[display2].7dtext,"[count#Dummy]"
endif
Code: Select all
[display2].7dtext,"[count#Dummy#d3]"
/Ton (PayPal.me)
Re: Rules don´t work if wifi not present
Wich format it has to be. I tried a simple txt file but it is not supported.
Thank you for that!You have quite complex code to fill the value nicely on the display:Instead of that you can use the formatting features in the replacement of [task#variable(#formatting(#justification))], so your code could be replaced by this:Code: Select all
if [count#Dummy] < 10 [display2].7dtext," [count#Dummy]" elseif [count#Dummy] > 9 and [count#Dummy] < 100 [display2].7dtext,"[count#Dummy]" elseif [count#Dummy] > 99 [display2].7dtext,"[count#Dummy]" endif
Code: Select all
[display2].7dtext,"[count#Dummy#d3]"
Last edited by chromo23 on 24 May 2021, 16:26, edited 1 time in total.
Re: Rules don´t work if wifi not present
Disabling Periodical Scan WiFi didn’t solve it.
Re: Rules don´t work if wifi not present
You can zip that .txt file, you should be able to attach that.
/Ton (PayPal.me)
Re: Rules don´t work if wifi not present
Ahhh... here you go:
Edit: probably like this
Here you can see the device in action:
And btw...how would you do this:
Code: Select all
[display2].7dtext,"[count#Dummy#d3#F]^"
Edit: probably like this
Code: Select all
Let,1,[count#Dummy#F]
[display2].7dtext,"[var#1#d3]^"
Here you can see the device in action:
Re: Rules don´t work if wifi not present
What's that #F supposed to mean? It is not a supported formatting or justification character, AFAIK.chromo23 wrote: ↑24 May 2021, 17:24 And btw...how would you do this:Code: Select all
[display2].7dtext,"[count#Dummy#d3#F]^"
Edit: probably like thisCode: Select all
Let,1,[count#Dummy#F] [display2].7dtext,"[var#1#d3]^"
/Ton (PayPal.me)
Re: Rules don´t work if wifi not present
Ah, yes, because of the layout it is a bit obscured.
The way you have used is the only way to achieve that, as you can only use 1 formatting option in such statement.
The way you have used is the only way to achieve that, as you can only use 1 formatting option in such statement.
/Ton (PayPal.me)
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 43 guests