Check Wifi Connection and set GPIO

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
EPICENTER
New user
Posts: 1
Joined: 27 Sep 2017, 08:49

Check Wifi Connection and set GPIO

#1 Post by EPICENTER » 27 Sep 2017, 10:20

Hi,
can I setup a rule with a paramater that check the wifi connection?
So, that I can light up a LED if the connection to the network is fine and set the GPIO to low if the connection is to the WLAN is lost and the ESP entering the AP mode.
Regards Martin

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Check Wifi Connection and set GPIO

#2 Post by toffel969 » 02 Oct 2017, 15:05

EPICENTER wrote: 27 Sep 2017, 10:20 Hi,
can I setup a rule with a paramater that check the wifi connection?
So, that I can light up a LED if the connection to the network is fine and set the GPIO to low if the connection is to the WLAN is lost and the ESP entering the AP mode.
Regards Martin
Why dont you use The wifi gpio feature in Hardware tab?
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

hestia
Normal user
Posts: 90
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Check Wifi Connection and set GPIO

#3 Post by hestia » 28 Jun 2021, 09:30

toffel969 wrote: 02 Oct 2017, 15:05 Why dont you use The wifi gpio feature in Hardware tab?
Because I'd like to give more than 1 status with only 1 LED:
wifi status and functional status (for instance: if wifi KO blink fast elseif functional status KO blink slow else ON)
Could it be possible with the feature in Hardware? If not, how to do it?

User avatar
Ath
Normal user
Posts: 3490
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Check Wifi Connection and set GPIO

#4 Post by Ath » 28 Jun 2021, 09:55

hestia wrote: 28 Jun 2021, 09:30 wifi status and functional status (for instance: if wifi KO blink fast elseif functional status KO blink slow else ON)
Could it be possible with the feature in Hardware? If not, how to do it?
1) This is a very old post you are reacting to ;)

2) Don't think a hardware solution could help you, other than using a multi-colored LED or NeoPixel.
Blinking fast/slow/steady can be controlled from rules, just making choices based on the status of multiple inputs and setting it up using f.e. a loopTimerSet.
/Ton (PayPal.me)

hestia
Normal user
Posts: 90
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Check Wifi Connection and set GPIO

#5 Post by hestia » 28 Jun 2021, 13:07

it was the only post near to what I was looking for...
ok for the rules, but I'm stuck with the variable to use...
I thought I could use

Code: Select all

LogEntry, %WiFi#Connected%
but it is empty :-(

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

Re: Check Wifi Connection and set GPIO

#6 Post by TD-er » 28 Jun 2021, 13:33

You can try %iswifi%
If it is < 7, you don't have a fully initialized WiFi.
See the system variables page (button on the Tools tab)

hestia
Normal user
Posts: 90
Joined: 06 Mar 2021, 08:27
Location: Paris

Re: Check Wifi Connection and set GPIO

#7 Post by hestia » 29 Jun 2021, 12:47

Thanks for the info
I did it like this

Code: Select all

on Rules#Timer=4 do // status LED
	timerSet,4,2
	if %iswifi% < 7 do // wifi KO
		LongPulse_ms,13,0,300
	elseif [TankLevel#Level_OK0_KO1]=1 do // level KO
		LongPulse_ms,13,0,1300
	else
		gpio,13,0
	endif	
endon
(code updated on 01-July)

Post Reply

Who is online

Users browsing this forum: No registered users and 40 guests