Shutdown PC via Telegram

Hello,

I want to get messages every 60 Minutes if my PC is still on via Telegram, so I can choose to shut it down.

Here is what i get so far:

  • telegram bot
  • ability to shut the pc down via home assistant
  • binary sensor that checks via ping, if the pc in online

now i “just” need the automation. thats what i tried:

  alias: PC Shutdown
  description: ''
  trigger:
  - platform: template
    value_template: '{{states(''binary_sensor.wand_pc'') == ''on''}}'
  condition: []
  action:
  - wait_template: '{{ as_timestamp(now()) - as_timestamp(states.binary_sensor.wand_pc.last_changed)
      | int > 1800}}'
  - service: notify.telegram_notify
    data:
      title: '*Home Assistant - PC Shutdown*'
      message: Computer ist schon {{((as_timestamp(now()) - as_timestamp(states.binary_sensor.wand_pc.last_changed))
        / 60) | float | round(2)}} Minuten an. Willst du Ihn ausschalten?
      data:
        inline_keyboard:
        - Ja:/shutdownpc, Nein:/dummy
  - repeat:
      until:
      - condition: template
        value_template: '{{states(''binary_sensor.wand_pc'') != ''on''}}'
      sequence:
      - delay: '01:00'
  mode: single

So the trigger is the binary sensor, which show if the pc is online. if it is it will start the automation and wait for 30 Minutes. AFter that it sends me a message, that the PC is online for xx Minutes. thats what is working so far. Whats not working is, that i want HA to repeat sending me a telegram message every 60 Minutes and asking me if i want to turn of my pc. thats not working and i have no idea why. Someone here that can help me?

regards

Tidle