I configured a UniFi captive portal and guest wifi network with a periodically rotated voucher. I also came up with a script to generate a HTML page with the voucher access code. What I want to ultimately achieve is that someone can ask “Hey Google, what’s the wifi password?” on one of the Google Home devices and get a TTS response back on that specific Google Home from HA where it reads the text off this generated page but I’m really not sure what the HA automation configuration should look like.
Made some progress.
I set up a web scrape sensor, this gets me the value for the access code
sensor:
- platform: scrape
resource: https://guest.mydomain.com/voucher
select: ".voucher"
The automation looks like this. I am only using webhook as a test for now, and this is working. However, I am limited to a specific entity to say the response on, or I could have it play on all cast device entities although that is not preferred. Does IFTTT have some means of passing which entity it was triggered from?
- alias: Guest Wifi Password
initial_state: on
trigger:
platform: webhook
webhook_id: get_wifi_pwd
action:
service: tts.google_say
entity_id: media_player.office_speaker
data_template:
message: "The guest wifi password is {{ states.sensor.web_scrape.state }}"