How to disable wifi AND APmode with a delay after boot

Moderators: Voyager, BertB, grovkillen, Stuntteam, LisaM

Post Reply
Message
Author
DavidC
Normal user
Posts: 3
Joined: 07 Feb 2022, 21:23

How to disable wifi AND APmode with a delay after boot

#1 Post by DavidC » 07 Feb 2022, 22:03

Hello,
For my ventilation control project I need to be able to access the ESP using APmode after boot/power on .
(My wifi network is not strong enough to reach the ESP which is in a ceiling and I do not need constant link)
But once it is running and rules are OK, I would like to disable all wifi connections and APmode.
Say after 30 minutes, the ESP should be muted, but not sleeping as it needs to keep on monitoring Humidity
to activate the relay as soon as a treshsold is met. (In real conditions this is working as expected! It switches
on and off the connection "N123" wich is in theory ment for a toilet switch when humidity is > 70 and during 10 minutes
more after humidity is back below the threshold. But the APMode stays visible...)

Using rules with Timer, and WifiDisconnect, I thought I was not far away from a solution...
But - as I searched quite extensively - I think there is no "WIFIAPMODEOFF" command (or similar). But perhaps there is another solution I'm not aware of?

My idea was a rule like this one:

on System#Boot do
timerSet,2,1800
EndOn
On Rules#Timer=2 do
??? WIFIAPMODEOFF ???
WifiDisconnect
endon

If you have a suggestion I would be glad to test it.

Thanks all for sharing all this: I've learned a lot!

Regards,
DavidC

Current projects:
Ventilation control : Espeasy (on esp8266 nodemcu v3) + relay + dht22 (to control Ducobox)
Mobile Co2 & air quality sensor: RPIeasy on PiZero WH + mh-z19 + sds011+ BME280 + CCS811 (Domoticz dashboard on Grafana)

TD-er
Core team member
Posts: 6364
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: How to disable wifi AND APmode with a delay after boot

#2 Post by TD-er » 07 Feb 2022, 22:52

Hmm apparently the "wifimode" command isn't documented in the RTD.

See the code:
https://github.com/letscontrolit/ESPEas ... p#L88-L119

Code: Select all

wifimode,off
wifimode,sta
wifimode,ap
wifimode,ap+sta
[code]

"sta" = Station mode => Connect to another access point
"ap" = Access point => Run an access point on the ESP
"ap+sta" = Run access point and be connected to another access point.

Only thing I'm not sure about is whether ESPEasy may turn on the WiFi again after you turn it off.
That's probably not working well right now.

DavidC
Normal user
Posts: 3
Joined: 07 Feb 2022, 21:23

Re: How to disable wifi AND APmode with a delay after boot

#3 Post by DavidC » 10 Feb 2022, 20:28

Thanks! I will try that by the end of the month (I'm not at the right place for the moment).

I do not need the ESPEasy to turn the wifi back on at some time.
What I expect is that it will turn on again if I switch the device off and then on.
Or do I need to add a rule at startup?
Any way I will make some tests and let you know (might take some time)
DavidC

Current projects:
Ventilation control : Espeasy (on esp8266 nodemcu v3) + relay + dht22 (to control Ducobox)
Mobile Co2 & air quality sensor: RPIeasy on PiZero WH + mh-z19 + sds011+ BME280 + CCS811 (Domoticz dashboard on Grafana)


DavidC
Normal user
Posts: 3
Joined: 07 Feb 2022, 21:23

Re: How to disable wifi AND APmode with a delay after boot

#5 Post by DavidC » 29 May 2022, 20:48

Hello, back here after being silent for a while; the unit is in a holiday home... So now that it has been rainy when I was there I have been able to make some tests at last.
I added the following code, but it did not work: the wifi AP stays alive even hours after it was turned on. In theory it should stop emiting about 30 minutes after the unit was powered on (tha's my aim)... Any idea what could go wrong?
Thanks again for your patience, I'm not sure when I would be abele to make new tests...

On System#Boot Do
GPIO,2,0
Timerset,2,3600
EndOn

On Rules#Timer=2 Do
Wifimode,Off
Endon
DavidC

Current projects:
Ventilation control : Espeasy (on esp8266 nodemcu v3) + relay + dht22 (to control Ducobox)
Mobile Co2 & air quality sensor: RPIeasy on PiZero WH + mh-z19 + sds011+ BME280 + CCS811 (Domoticz dashboard on Grafana)

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests