Just a simple but effective automation which notifies me whenever someone tries to login to my HASS and enters a faulty password. Can be usefull when you’re exposed to the internet.
The only component which has to be enabled for this to work is Pushbullet.
You can extend this notification with all the bells and whistles you like, especially when intercepting the notification with Tasker (Android only). Enjoy.
Thanks for the idea that I stole (if you don’t mind to adapt to send a text message instead of a Pushbullet notification !! It uses Free Mobile API to send the text message but easily adaptable for other SMS system I guess You need to get Free Mobile API already setup in HA to get this working !
- alias: "Send notification upon failed login attempt"
trigger:
- platform: state
entity_id: persistent_notification.httplogin
condition:
- condition: template
value_template: "{{ trigger.to_state.state != off }}"
action:
- service: notify.free_mobile
data_template:
title: "Failed Home Assistant login attempt!"
target: '012345678' <- to replace with your Free Mobile french phone number
message: "{{ trigger.to_state.state }}from{{ states.persistent_notification.httplogin.state.split}}"
and here is text message received on phone (not sure from what is coming the garbage after message but doesn’t matter !!
action:
- service: notify.free_mobile
data_template:
title: "Failed Home Assistant login attempt!"
target: '012345678' <- to replace with your Free Mobile french phone number
message: "{{ trigger.to_state.state }}"
Hi Bob. Nice idea and I copied it into my configuration. It works, at least the detection works. But because I’ve set up a SSL reverse proxy through my Synology NAS, it detects only the internal IP address of my Synology.
Does anybody has a solution for this problem, or is it simply not possible to resolve the external IP address through a SSL reverse proxy ?
You’re right! I had to update the trigger per the giant warning about homeassistant_start (https://home-assistant.io/docs/automation/trigger/). Thanks for getting that back on my radar, that has been annoying.