Numeric_state

Hi i have a problem with the automations based on Numeric_state.
Use for incorrect login control.
Below is the code that seems right but does not work.
If the hand trigger works
It seems to you that there is some error in the code?
Thanks for the help

  • alias: ‘Bad Login Notification Telegram’
    hide_entity: false
    trigger:
    platform: numeric_state
    entity_id: sensor.badlogin
    value_template: “{{ states.sensor.badlogin.state | int }}”
    above: 0
    action:
    service: notify.Telegram_Home
    data:
    message: ‘Error: {{ states.sensor.badloginmessage.state }}’

when you paste your config highlight your text and click the “< / >” button in the bar above where you type. This preserves the formatting, makes it easier to read and check for accuracy.

This is an automation I use. It is built into HA and will also send you the IP address of the bad login. This will tell you if it came internally, externally and if external you can look up the IP address and see where its coming from.

  - alias: "Send notification upon failed login attempt"
    trigger:
      - platform: state
        entity_id: persistent_notification.httplogin
    condition:
      - condition: template
        value_template: "{{ trigger.to_state.state != 'None' }}"
    action:
      - service: notify.Telegram_home
        data_template:
          title: "Failed Home Assistant login!"
          message: "{{ trigger.to_state.state }}"
2 Likes