jowiedog
(Chris Jowett)
May 5, 2021, 3:11pm
1
Hi.
I am pretty new with HA. I have managed to intergrate Telegram Bot.
I want to do a very simple thing (well in my mind)
I want to check a status of a device, which is fairly easy but i then want to Send a message to my Telegram bot at like say 8AM
I have looked at the time intergration and other things but i was wondering if there was just a very simple way of achieving it.
An example of what i am trying to do.
Get Home Assistant to check a Zigbee device is online (lame but i am just messing around at the moment), then send a message to my bot at 8AM.
LIke i said i have the telegram bot working for my other automations, its just the timing section for my message to be sent i am struggling with.
thanks
Welcome to the loony bin!
At what time do you want the state checked? If it doesn’t matter, just check it at 08:00 and then send the message. This is easy.
If you want the state check and the message at different times, that will be a little more work. You’d need to explain more, especially when your check should be performed.
jowiedog
(Chris Jowett)
May 5, 2021, 3:38pm
3
thanks for replying
it can be the same time, in fact if that is easier, thats fine.
I was more struggling on how to write the code for it, tried using the GUI automation but cannot seem to find what i am looking with regards.
You have to setup a notifier like this:
notify:
- platform: telegram
name: NOTIFIER_NAME
chat_id: CHAT_ID_1
After that you setup an automation like this:
automation:
- id: 'My telegram notification'
trigger:
- platform: time
at: '08:00:00'
condition:
- condition: state
entity_id: sensor.myzigbeedevice
state: 'on'
action:
- service: notify.NOTIFIER_NAME
data:
title: "*Send a message*"
message: "Super cool message here"
As trigger and condition you can use one of these: Automation Trigger - Home Assistant
This does the following: At 08:00 it starts running, checks, if the device is on, if not it ends, if it is on, it will send the message.
EDIT: Somehow some of my text got lost, I added it back again.
jowiedog
(Chris Jowett)
May 5, 2021, 6:44pm
5
thats is perfect mate, thank you for taking time to show me that.
123
(Taras)
May 5, 2021, 8:23pm
6
Don’t forget to mark paddy0174’s post with the Solution tag. Only you, the author of this topic, can do that. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic is resolved. It makes it easier for users to find answers to similar questions.
1 Like