# Como ser alertado via Telegram se alguém tentou entrar no nosso HA

**URL:** <https://forum.cpha.pt/t/como-ser-alertado-via-telegram-se-alguem-tentou-entrar-no-nosso-ha/296>\
**Category:** Configuração\
**Created:** [4 Maio , 2018 11:37 UTC](https://forum.cpha.pt/t/como-ser-alertado-via-telegram-se-alguem-tentou-entrar-no-nosso-ha/296 "2018-05-04T11:37:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![j\_assuncao](https://forum.cpha.pt/user_avatar/forum.cpha.pt/j_assuncao/32/3_2.png) [@j\_assuncao](https://forum.cpha.pt/u/j_assuncao)\
**Post date:** [4 Maio , 2018 11:37 UTC](https://forum.cpha.pt/t/como-ser-alertado-via-telegram-se-alguem-tentou-entrar-no-nosso-ha/296/1 "2018-05-04T11:37:22Z")

</div>

> [@bookmark\_tabs Como ser alertado via Telegram se alguém tentou entrar no nosso HA](https://forum.cpha.pt/t/como-ser-alertado-via-telegram-se-alguem-tentou-entrar-no-nosso-ha/39):
>
> Neste post mostro-vos como podem criar uma automação simples para serem alertados via telegram se alguém tentou entrar no vosso HA. - alias: "Tentativa de Ataque Home Assistant" trigger: - platform: state entity\_id: persistent\_notification.httplogin condition: - condition: template value\_template: "{{ trigger.to\_state.state != 'None' }}" action: - service: notify.telegram \*\*////////// altererar para o nome do vosso notify\*\* data\_template: …

---

<div class="post-metadata">

**Author:** ![Luis\_Belo](https://forum.cpha.pt/user_avatar/forum.cpha.pt/luis_belo/32/28_2.png) [@Luis\_Belo](https://forum.cpha.pt/u/Luis_Belo)\
**Post date:** [30 Março , 2020 20:38 UTC](https://forum.cpha.pt/t/como-ser-alertado-via-telegram-se-alguem-tentou-entrar-no-nosso-ha/296/2 "2020-03-30T20:38:12Z")

</div>

Boa noite camaradas 🙂

O meu deixou de funcionar … o que poderá ser? Fiz agora o teste e não recebo nada no telemovel.

```auto
automation:
  - alias: "Tentativa de Ataque Home Assistant"
    trigger:
      - platform: state
        entity_id: persistent_notification.httplogin
    condition:
      - condition: template
        value_template: "{{ trigger.to_state.state != 'None' }}"
    action:
      - service: notify.telegram
        data_template:
          title: "Tentativa de Ataque Home Assistant"
          message: "{{ states.persistent_notification.httplogin.attributes.message }}"
          data:
            url: https://whatismyipaddress.com/ip/{{ states.persistent_notification.httplogin.attributes.message.split("from ") [1]}}

```

☹

---

<div class="post-metadata">

**Author:** ![RodolfoVieira](https://forum.cpha.pt/user_avatar/forum.cpha.pt/rodolfovieira/32/14633_2.png) [@RodolfoVieira](https://forum.cpha.pt/u/RodolfoVieira)\
**Post date:** [31 Março , 2020 16:04 UTC](https://forum.cpha.pt/t/como-ser-alertado-via-telegram-se-alguem-tentou-entrar-no-nosso-ha/296/3 "2020-03-31T16:04:07Z")

</div>

Penso que issou mudou tenta assim altera para os teus dados:

```auto

 alias: "homeassistant_attack_attempt"
  initial_state: 'on'
  hide_entity: false
  trigger:
   - platform: state
     entity_id: persistent_notification.http_login
  condition:
   - condition: template
     value_template: "{{ trigger.to_state.state != off }}"
# value_template: "{{ trigger.to_state.state != 'None' }}"
  action:
    - service: notify.myphone
      data_template:
        title: "Neautorizovaný pokus o login"
        message: "{{ states.persistent_notification.http_login.attributes.message }}"
        data:
          url: https://whatismyipaddress.com/ip/{{ states.persistent_notification.http_login.attributes.message.split("from ") [1]}

```

---

<div class="post-metadata">

**Author:** ![Luis\_Belo](https://forum.cpha.pt/user_avatar/forum.cpha.pt/luis_belo/32/28_2.png) [@Luis\_Belo](https://forum.cpha.pt/u/Luis_Belo)\
**Post date:** [31 Março , 2020 21:01 UTC](https://forum.cpha.pt/t/como-ser-alertado-via-telegram-se-alguem-tentou-entrar-no-nosso-ha/296/4 "2020-03-31T21:01:47Z")

</div>

> [@RodolfoVieira](#):
>
> ```auto
> alias: "homeassistant_attack_attempt"
> initial_state: 'on'
> hide_entity: false
> trigger:
> - platform: state
> entity_id: persistent_notification.http_login
> condition:
> - condition: template
> value_template: "{{ trigger.to_state.state != off }}"
> # value_template: "{{ trigger.to_state.state != 'None' }}"
> action:
> - service: notify.myphone
> data_template:
> title: "Neautorizovaný pokus o login"
> message: "{{ states.persistent_notification.http_login.attributes.message }}"
> data:
> url: https://whatismyipaddress.com/ip/{{ states.persistent_notification.http_login.attributes.message.split("from ") [1]}
> 
> ```

Essa dá erro…

Após ajuste meti:

```auto
automation:
  - alias: "Tentativa de Ataque Home Assistant"
    initial_state: 'on'
    hide_entity: false
    trigger:
      platform: state
      entity_id: persistent_notification.http_login
    condition:
      condition: template
      value_template: "{{ trigger.to_state.state != 'off' }}"
    action:
      service: notify.telegram
      data_template:
        title: "Tentativa de Ataque Home Assistant"
        message: "{{ states.persistent_notification.http_login.attributes.message }}"
        data:
          url: https://whatismyipaddress.com/ip/{{ states.persistent_notification.http_login.attributes.message.split("from ") [1]}}

```

E não recebo nada na mesma 😕
