I am trying to make a notification with a shell script output. For example, when some door sensor fires, I’d like it also to sent a message via google hangouts. The script runs in shell and prints an url where the picture was uploaded - one line, I want this URL in the message. A nice thing would be a trigger id in the url. I managed to get as far as this
shell_command:
push_photos: "/mnt/sda/aik/s/hass/push {{ event_entity_id }}"
and
alias: Door
description: ''
trigger:
- type: opened
platform: device
device_id: 71aa4e24f888ddca22bd3fe8c53d9a55
entity_id: binary_sensor.catflap_contact
domain: binary_sensor
condition: []
action:
- service: shell_command.push_photos
data_template:
event_entity_id: {{ trigger.entity_id }}
- data_template:
message:
- text: >-
Cat {{ trigger.entity_id }} {{as_timestamp(now()) |
timestamp_custom('%-H:%M:%S') }}
target:
- name: HomeAssistantChat
service: hangouts.send_message
mode: single
The problems are:
- cannot insert the script output to the hangouts message;
- cannot pass
{{ trigger.entity_id }}
to the script - when I save the automation, it replacesevent_entity_id: {{ trigger.entity_id }}
with'[object Object]': null
soevent_entity_id
is{[object_Object]:None}
inside the scrit but I can still use a static string.
Solvable? The shell script is python3 so in theory I could put it somewhere inside HA but really not sure if it makes the task easier.
Thanks!