25 lines
760 B
YAML
25 lines
760 B
YAML
|
# https://blog.ceard.tech/2023/01/wifi-sensor-to-device-tracker
|
||
|
- id: 'pixel_4a_wifi_to_mqtt_location'
|
||
|
alias: 'Pixel 4a wifi to MQTT location'
|
||
|
initial_state: 'on'
|
||
|
trigger:
|
||
|
- platform: state
|
||
|
entity_id: sensor.pixel_4a_wifi_bssid
|
||
|
to: ~
|
||
|
action:
|
||
|
- choose:
|
||
|
- conditions:
|
||
|
- condition: template
|
||
|
value_template: "{{ 'e6:63:da:e8:c7:e5' in states('sensor.pixel_4a_wifi_bssid') }}"
|
||
|
sequence:
|
||
|
- service: mqtt.publish
|
||
|
data:
|
||
|
topic: location/pixel_4a_wifi
|
||
|
payload: 'home'
|
||
|
retain: true
|
||
|
default:
|
||
|
- service: mqtt.publish
|
||
|
data:
|
||
|
topic: location/pixel_4a_wifi
|
||
|
payload: 'not_home'
|
||
|
retain: true
|