I created an automation to trigger when I enter or leave a zone. It will connect with IFTTT to do something. At this moment it just logs some things into a Google sheet.
I want to send the time and date as seperate values, but I can’t get it to work. This is what I have in my automation.yaml file:
- alias: Timesheet Colruyt - Haasrode - Leave
id: '1496142116976'
trigger:
- entity_id: device_tracker.marcel_redmi_note_4
event: leave
platform: zone
zone: zone.colruyt_haasrode
action:
- data:
event: colruyt_timesheet
value1: "OUT"
value2: "Haasrode"
value3: sensor.time
service: ifttt.trigger
The problem is that value3 should pass the current time, but it just passes the string. What do I have to do to actually pass the current time?
Changed it to this, as suggested… but that does not work:
- alias: Timesheet Colruyt - Haasrode - Leave
id: '1496142116976'
trigger:
- entity_id: device_tracker.marcel_redmi_note_4
event: leave
platform: zone
zone: zone.colruyt_haasrode
action:
- data:
event: colruyt_timesheet
value1: OUT
value2: Haasrode
value3: {{states.sensor.time.state}}
service: ifttt.trigger
Getting this error in the log file:
2017-06-21 09:08:46 ERROR (MainThread) [homeassistant.components.automation] invalid key: "OrderedDict([('states.sensor.time.state', None)])"
in "/config/automations.yaml", line 87, column 0
treno
(travis reno)
June 21, 2017, 1:39pm
4
You need to use data_template. Also I have my automations in separate files, you may need to make adjustments to a single automations.yaml file.
EDIT: The template also has to be encased in quotes.
value3: '{{states.sensor.time.state}}'
Excellent!
That worked indeed, thanks for the help!
saro
February 3, 2019, 4:47pm
6
Hi. I have a problem to send value. If i try your solution in automation windows, the Json call is disactivated and message is “Invalid Json”. Do you have any idea?
thx