Hi,
I am quite new to home assistant and already got quite a lot working. I am now trying to list all my devices every 5 minutes towards Telegram. The telegram bot works fine and also the devices are scanned frequently, but what I can’t figure out is how I would go through all my devices and send them in the message. My Automation attempt is below, but I have no idea how the create the message (thats why there are now just question marks).
Any advice would be appreciated.
- id: '1534004396541'
alias: Notify all devices to Telegram every 5 minutes
trigger:
- platform: time
minutes: /5
condition: []
action:
- data:
message: ?? List all device in group.all_devices with indication away or home ??
service: telegram_bot.send_message
Well, try changing |- to >-. Maybe HA’s YAML parser doesn’t support |. I guess I never tried it.
Also, for Away, you might want to consider changing:
|selectattr('state','eq','not_home')
to:
|selectattr('state','ne','home')
The former will only list the entities whose state is exactly ‘not_home’, whereas the latter will list all entities whose state is not exactly ‘home’ (e.g., it will also list entities that are in a zone other than the home zone.)
hmm no >- also doesnt work. The error I get on config validation is:
Invalid config for [automation]: expected a dictionary for dictionary value @ data['action'][0]['data_template']. Got None
extra keys not allowed @ data['action'][0]['message']. Got None. (See /config/configuration.yaml, line 61). Please check the docs at https://home-assistant.io/components/automation/
But ill play around with it a bit more, must be some kind of simple formatting or something