letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.28k stars 2.21k forks source link

Rule triggered based on SSID in range (feature request) #2832

Open blb4github opened 4 years ago

blb4github commented 4 years ago

Checklist

I have...

Steps already tried...

If you self compile, please state this and PLEASE try to ONLY REPORT ISSUES WITH OFFICIAL BUILDS!

Summarize of the problem/feature request

Feature request: I like to have the possibility to publish an MQTT message once a WIFI SSID is in reach and out of reach. Via webinterface->tools->scan it's possible to get an overview of all SSID's in range. In the log I can see the number of SSID's found. I would like to trigger a rules based on the name of an SSID in range.

TD-er commented 4 years ago

The ESP will hardly ever perform a wifi scan. Only when asked to or when to perform a reconnect from an "unstable" connection or when the last used connection is not available any more.

So even if this will be implemented, then it will hardly ever trigger such an event. This means you cannot use it for IFTTT kind of rules. (or you must perform scans at a regular interval)

blb4github commented 4 years ago

It would be fine to perform scan as part of a timer rule. Something like: On Rules#Timer=1 do if wifiscan#=1 Publish ,[wifiscan#<SSIDtoCheck] endif timerSet,1,300 endon

TD-er commented 4 years ago

A scan does cause connection issues and probably a reconnect. What can be done is spit the scan into a scan per channel, which only takes roughly 200 msec.

blb4github commented 4 years ago

Per channel would be sufficient, the networks I want to detect do have fixed channel.

TD-er commented 4 years ago

OK, then it may be a useful feature I guess. So in short, what you want is:

Right now, we do not have proper support yet for strings as an event parameter, so that's something that has to be implemented first.

blb4github commented 4 years ago

Sounds great to me. About the strings as event parameter: Maybe it helps that in my use case I know which SSID I'm searching for. Maybe it's easier to initiate a scan with the SSID I'm interested in as a parameter and get 0 back when SSID not in reach and 1 or the RSSI value when in reach.