I used that in the past to get the rssi of a certain ap (“AP Test”) which is in range of the esp:
wifi:
id: wifithing
networks:
- ssid: ...
sensor:
- platform: template
name: "${upper_devicename} AP Test RSSI"
id: wifiscanrssi
update_interval: never
switch:
- platform: template
name: "${upper_devicename} Get AP Test RSSI"
turn_on_action:
lambda: |-
auto results = id(wifithing).get_scan_result() ;
for(auto item: results){
auto ssid = item.get_ssid();
auto rssi = item.get_rssi();
if(ssid == "AP Test"){
id(wifiscanrssi).publish_state(rssi);
}
}
Guess in 2022 a template button instead of the template switch would make sense ![]()