I’m writing an automation to add a Google calendar entry and send a message to my phone when a particular file is updated with new data. It’s triggered successfully (using folder watcher) by the closing of the file. The data is just the date and the value of tomorrow’s electricity cost, in a JSON file. This file is updated programmatically once a day, using data grabbed using an external API.
The error I’m reporting is from today’s update. Once it is triggered I toggle my office light ( - a testing step I was previously using to check whether it was being properly triggered). I have included a pause after it’s triggered and before it starts in case it was a slow write causing it (though it is writing to SSD).
Then it sends the calendar event, then the message to the phone.
The light appears to have triggered (though i wasn’t here to see it) but neither of the other actions have happened
The trace timeline indicates it has completed and doesn’t mention errors.
This is how it has made the automation yaml.
alias: A octopus test
description: folder event test
trigger:
- platform: event
event_type: folder_watcher
event_data:
event_type: closed
condition: []
action:
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
enabled: true
- type: toggle
device_id: xxx
entity_id: xxx
domain: light
enabled: true
- service: google.add_event
data:
calendar_id: >-
[email protected]
summary: Tracker region H {{ states("sensor.tracker_cost_tomorrow") }}p
start_date: '{{ ( states( ''sensor.tracker_date_tomorrow''))}}'
end_date: '{{ ( states( ''sensor.tracker_date_tomorrow''))}}'
enabled: true
- service: notify.mobile_app_xxx
data:
message: '"{{ ( states( ''sensor.tracker_date_tomorrow''))}}"'
mode: single```
The errors can be seen in the trace below but I can't see what might have caused them (nor can I see how to attach this as a file rather than reproduce it here!!!).
Any help or advice would be appreciated
```"{
"trace": {
"last_step": "action/3",
"run_id": "438b66c20ff3d4017360fa584bdbc251",
"state": "stopped",
"script_execution": "finished",
"timestamp": {
"start": "2023-07-24T09:55:07.996296+00:00",
"finish": "2023-07-24T09:55:14.451397+00:00"
},
"domain": "automation",
"item_id": "1689631789416",
"trigger": "event 'folder_watcher'",
"trace": {
"trigger/0": [
{
"path": "trigger/0",
"timestamp": "2023-07-24T09:55:07.996473+00:00",
"changed_variables": {
"this": {
"entity_id": "automation.a_octopus_test",
"state": "on",
"attributes": {
"id": "1689631789416",
"last_triggered": "2023-07-23T11:12:06.235119+00:00",
"mode": "single",
"current": 0,
"friendly_name": "A octopus test"
},
"last_changed": "2023-07-23T11:10:42.910506+00:00",
"last_updated": "2023-07-23T11:12:12.119537+00:00",
"context": {
"id": "XXX",
"parent_id": null,
"user_id": null
}
},
"trigger": {
"id": "0",
"idx": "0",
"alias": null,
"platform": "event",
"event": {
"event_type": "folder_watcher",
"data": {
"event_type": "closed",
"path": "/share/haelecpricestomorrow.json",
"file": "haelecpricestomorrow.json",
"folder": "/share"
},
"origin": "LOCAL",
"time_fired": "2023-07-24T09:55:07.993362+00:00",
"context": {
"id": "XXX",
"parent_id": null,
"user_id": null
}
},
"description": "event 'folder_watcher'"
}
}
}
],
"action/0": [
{
"path": "action/0",
"timestamp": "2023-07-24T09:55:07.999985+00:00",
"changed_variables": {
"context": {
"id": "XXX",
"parent_id": "XXX",
"user_id": null
}
},
"result": {
"delay": 5,
"done": true
}
}
],
"action/1": [
{
"path": "action/1",
"timestamp": "2023-07-24T09:55:13.002107+00:00"
}
],
"action/2": [
{
"path": "action/2",
"timestamp": "2023-07-24T09:55:13.328217+00:00",
"result": {
"params": {
"domain": "google",
"service": "add_event",
"service_data": {
"calendar_id": "[email protected]",
"summary": "Tracker region H 17.0835p",
"start_date": "2023-07-24",
"end_date": "2023-07-24"
},
"target": {}
},
"running_script": false
}
}
],
"action/3": [
{
"path": "action/3",
"timestamp": "2023-07-24T09:55:13.972033+00:00",
"result": {
"params": {
"domain": "notify",
"service": "mobile_app_XXX",
"service_data": {
"message": "\"2023-07-24\""
},
"target": {}
},
"running_script": false
}
}
]
},
"config": {
"id": "1689631789416",
"alias": "A octopus test",
"description": "folder event test",
"trigger": [
{
"platform": "event",
"event_type": "folder_watcher",
"event_data": {
"event_type": "closed"
}
}
],
"condition": [],
"action": [
{
"delay": {
"hours": 0,
"minutes": 0,
"seconds": 5,
"milliseconds": 0
},
"enabled": true
},
{
"type": "toggle",
"device_id": "XXX",
"entity_id": "XXX",
"domain": "light",
"enabled": true
},
{
"service": "google.add_event",
"data": {
"calendar_id": "[email protected]",
"summary": "Tracker region H {{ states(\"sensor.tracker_cost_tomorrow\") }}p",
"start_date": "{{ ( states( 'sensor.tracker_date_tomorrow'))}}",
"end_date": "{{ ( states( 'sensor.tracker_date_tomorrow'))}}"
},
"enabled": true
},
{
"service": "notify.mobile_app_XXX",
"data": {
"message": "\"{{ ( states( 'sensor.tracker_date_tomorrow'))}}\""
}
}
],
"mode": "single"
},
"blueprint_inputs": null,
"context": {
"id": "XXX",
"parent_id": "XXX",
"user_id": null
}
},
"logbookEntries": [
{
"name": "A octopus test",
"message": "triggered by event 'folder_watcher'",
"source": "event 'folder_watcher'",
"entity_id": "automation.a_octopus_test",
"context_id": "XXX",
"when": 1690192507.996688,
"domain": "automation"
},
{
"when": 1690192513.319752,
"state": "on",
"entity_id": "light.office_light",
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "A octopus test",
"context_message": "triggered by event 'folder_watcher'",
"context_source": "event 'folder_watcher'",
"context_entity_id": "automation.a_octopus_test"
}
]
}
"```