I would like to have highest priority options for automation jobs. Sadly, even I have scheduled automation to run at exact time, ones every two days I see jobs failing because execution has taken more time than normally. Also, the execution start time might be on last hundred milliseconds. My automation job what I have issues normally takes ~0.20s and at least I have seen ~1.70s execution times. Problems occurs automation job what is doing "few" service: "homeassistant.update_entity" (at xx:14:59, xx:29:59, xx:44:59 and xx:59:59) because I need to have 15min net metering calculations from energy.
Is your system super bogged down? I’ve never had a time based automation fail or even delay.
Automation performance is going to be heavily influenced by both your hardware and the number of automations, addons, etc that you’re running.
So first question is what hardware are you running on? What’s your CPU load? Memory usage?
How many automations do you have? How many automations are being triggered at the exact timeframe in question?
Platform: raspberry pi 4 8GB
CPU load average: ~11%
Memory load average: 17%
M2 disk usage: 5.6%
Triggers at that time when there have been issues there is no others triggers or automations running.
Enabled automations: 70, (total amount automations: 122)
For the addons i have only: esphome, file editor, hdd tools, influxdb, mosquitto broker, samba share, SQLite Web, terminal & ssh, zigbee2mqtt. (one new installed after first issues had occured, but that is not yet running node-red)
Also one extra comment, normally automation is failing when everyone is sleeping… So no manual triggers or extra loads to system.
Example screenshots of failing trigger.
And here is actual trace of it:
{
"trace": {
"last_step": "action/7/else/1",
"run_id": "4452f5524571ef3aab6c37064da5ed03",
"state": "stopped",
"script_execution": "finished",
"timestamp": {
"start": "2023-06-25T23:00:04.430541+00:00",
"finish": "2023-06-25T23:00:05.776652+00:00"
},
"domain": "automation",
"item_id": "1684441522547",
"trigger": "time pattern",
"trace": {
"trigger/3": [
{
"path": "trigger/3",
"timestamp": "2023-06-25T23:00:04.430708+00:00",
"changed_variables": {
"this": {
"entity_id": "automation.refresh_quarter_hourly_last_second",
"state": "on",
"attributes": {
"last_triggered": "2023-06-25T22:44:59.101685+00:00",
"mode": "single",
"current": 0,
"id": "1684441522547",
"friendly_name": "Refresh Quarter-Hourly Last Second "
},
"last_changed": "2023-06-16T21:38:01.285468+00:00",
"last_updated": "2023-06-25T22:44:59.294040+00:00",
"context": {
"id": "01H3TBPPJXCY0E39902M6YMKTT",
"parent_id": null,
"user_id": null
}
},
"trigger": {
"id": "3",
"idx": "3",
"alias": null,
"platform": "time_pattern",
"now": "2023-06-26T02:00:04.270457+03:00",
"description": "time pattern"
}
}
}
],
"action/0": [
{
"path": "action/0",
"timestamp": "2023-06-25T23:00:04.538089+00:00",
"changed_variables": {
"context": {
"id": "01H3TCJAPEGH8XPJK9YJDZ7YBP",
"parent_id": null,
"user_id": null
}
},
"result": {
"params": {
"domain": "homeassistant",
"service": "update_entity",
"service_data": {},
"target": {
"entity_id": [
"sensor.em3_net_energy_kwh_quarter_hourly_last_second",
"sensor.em3_net_return_quarter_hourly_last_second",
"sensor.em3_net_solar_energy_own_usage_quarter_hourly_last_second"
]
}
},
"running_script": false,
"limit": 10
}
}
],
"action/1": [
{
"path": "action/1",
"timestamp": "2023-06-25T23:00:05.285816+00:00",
"result": {
"delay": 0.05,
"done": true
}
}
],
"action/2": [
{
"path": "action/2",
"timestamp": "2023-06-25T23:00:05.353792+00:00",
"result": {
"params": {
"domain": "homeassistant",
"service": "update_entity",
"service_data": {},
"target": {
"entity_id": [
"sensor.em3_net_energy_bought_quarter_hourly_last_second",
"sensor.em3_net_energy_selling_sum_quarter_hourly_last_second",
"sensor.em3_net_solar_energy_own_usage_sum_quarter_hourly_last_second",
"sensor.em3_net_electricity_purhase_price_without_tax_and_transfer_quarter_hourly_last_second",
"sensor.solar_panels_roi_sum_quarter_hourly_last_second",
"sensor.em3_net_house_energy_usage_quarter_hourly_last_second",
"sensor.em3_net_electricity_transfer_cost_quarter_hourly_last_second"
]
}
},
"running_script": false,
"limit": 10
}
}
],
"action/3": [
{
"path": "action/3",
"timestamp": "2023-06-25T23:00:05.521727+00:00",
"result": {
"delay": 0.05,
"done": true
}
}
],
"action/4": [
{
"path": "action/4",
"timestamp": "2023-06-25T23:00:05.674204+00:00",
"result": {
"params": {
"domain": "homeassistant",
"service": "update_entity",
"service_data": {},
"target": {
"entity_id": [
"sensor.em3_net_solar_energy_own_usage_sum_quarter_hourly_last_second_monthly",
"sensor.em3_quarter_hourly_based_net_energy_kwh_last_second_monthly",
"sensor.em3_quarter_hourly_based_net_solar_energy_own_usage_kwh_last_second_daily",
"sensor.em3_quarter_hourly_based_net_solar_energy_own_usage_kwh_last_second_monthly",
"sensor.em3_quarter_hourly_based_net_sold_kwh_last_second_daily",
"sensor.em3_quarter_hourly_based_net_sold_kwh_last_second_monthly",
"sensor.em3_quarter_hourly_based_net_energy_kwh_last_second_daily",
"sensor.em3_net_energy_bought_quarter_hourly_last_second_daily",
"sensor.em3_net_energy_bought_quarter_hourly_last_second_monthly",
"sensor.em3_net_solar_energy_own_usage_sum_quarter_hourly_last_second_daily",
"sensor.em3_net_electricity_purhase_price_without_tax_and_transfer_quarter_hourly_last_second_daily",
"sensor.em3_net_electricity_purhase_price_without_tax_and_transfer_quarter_hourly_last_second_monthly",
"sensor.solar_panels_roi_sum_quarter_hourly_last_second_daily",
"sensor.solar_panels_roi_sum_quarter_hourly_last_second_monthly",
"sensor.em3_quarter_hourly_based_net_house_energy_usage_kwh_last_second_daily",
"sensor.em3_quarter_hourly_based_net_house_energy_usage_kwh_last_second_monthly",
"sensor.em3_net_electricity_transfer_cost_quarter_hourly_last_second_daily",
"sensor.em3_net_electricity_transfer_cost_quarter_hourly_last_second_monthly"
]
}
},
"running_script": false,
"limit": 10
}
}
],
"action/5": [
{
"path": "action/5",
"timestamp": "2023-06-25T23:00:05.753383+00:00"
}
],
"action/5/if": [
{
"path": "action/5/if",
"timestamp": "2023-06-25T23:00:05.753534+00:00",
"result": {
"result": false
}
}
],
"action/5/if/condition/0": [
{
"path": "action/5/if/condition/0",
"timestamp": "2023-06-25T23:00:05.753588+00:00",
"result": {
"result": false,
"entities": []
}
}
],
"action/6": [
{
"path": "action/6",
"timestamp": "2023-06-25T23:00:05.754057+00:00",
"result": {
"choice": "else"
}
}
],
"action/6/if": [
{
"path": "action/6/if",
"timestamp": "2023-06-25T23:00:05.754149+00:00",
"result": {
"result": false
}
}
],
"action/6/if/condition/0": [
{
"path": "action/6/if/condition/0",
"timestamp": "2023-06-25T23:00:05.754199+00:00",
"result": {
"result": false,
"entities": []
}
}
],
"action/6/else/0": [
{
"path": "action/6/else/0",
"timestamp": "2023-06-25T23:00:05.756322+00:00",
"result": {
"params": {
"domain": "input_text",
"service": "set_value",
"service_data": {
"value": 21.20981013,
"entity_id": [
"input_text.em3_net_energy_selling_sum_quarter_hourly_last_second_monthly"
]
},
"target": {
"entity_id": [
"input_text.em3_net_energy_selling_sum_quarter_hourly_last_second_monthly"
]
}
},
"running_script": false,
"limit": 10
}
}
],
"action/6/else/1": [
{
"path": "action/6/else/1",
"timestamp": "2023-06-25T23:00:05.761047+00:00",
"result": {
"params": {
"domain": "input_text",
"service": "set_value",
"service_data": {
"value": 96.75939309,
"entity_id": [
"input_text.solar_panels_roi_sum_quarter_hourly_last_second_monthly"
]
},
"target": {
"entity_id": [
"input_text.solar_panels_roi_sum_quarter_hourly_last_second_monthly"
]
}
},
"running_script": false,
"limit": 10
}
}
],
"action/7": [
{
"path": "action/7",
"timestamp": "2023-06-25T23:00:05.763479+00:00",
"result": {
"choice": "else"
}
}
],
"action/7/if": [
{
"path": "action/7/if",
"timestamp": "2023-06-25T23:00:05.763611+00:00",
"result": {
"result": false
}
}
],
"action/7/if/condition/0": [
{
"path": "action/7/if/condition/0",
"timestamp": "2023-06-25T23:00:05.763663+00:00",
"result": {
"result": false,
"entities": []
}
}
],
"action/7/else/0": [
{
"path": "action/7/else/0",
"timestamp": "2023-06-25T23:00:05.764595+00:00",
"result": {
"params": {
"domain": "input_text",
"service": "set_value",
"service_data": {
"value": 0,
"entity_id": [
"input_text.em3_net_energy_selling_sum_quarter_hourly_last_second_daily"
]
},
"target": {
"entity_id": [
"input_text.em3_net_energy_selling_sum_quarter_hourly_last_second_daily"
]
}
},
"running_script": false,
"limit": 10
}
}
],
"action/7/else/1": [
{
"path": "action/7/else/1",
"timestamp": "2023-06-25T23:00:05.770026+00:00",
"result": {
"params": {
"domain": "input_text",
"service": "set_value",
"service_data": {
"value": 0,
"entity_id": [
"input_text.solar_panels_roi_sum_quarter_hourly_last_second_daily"
]
},
"target": {
"entity_id": [
"input_text.solar_panels_roi_sum_quarter_hourly_last_second_daily"
]
}
},
"running_script": false,
"limit": 10
}
}
]
},
"config": {
"id": "1684441522547",
"alias": "Refresh Quarter-Hourly Last Second ",
"description": "",
"trigger": [
{
"platform": "time_pattern",
"minutes": "14",
"seconds": "59"
},
{
"platform": "time_pattern",
"minutes": "29",
"seconds": "59"
},
{
"platform": "time_pattern",
"minutes": "44",
"seconds": "59"
},
{
"platform": "time_pattern",
"seconds": "59",
"minutes": "59"
}
],
"condition": [],
"action": [
{
"service": "homeassistant.update_entity",
"data": {},
"target": {
"entity_id": [
"sensor.em3_net_energy_kwh_quarter_hourly_last_second",
"sensor.em3_net_return_quarter_hourly_last_second",
"sensor.em3_net_solar_energy_own_usage_quarter_hourly_last_second"
]
}
},
{
"delay": {
"hours": 0,
"minutes": 0,
"seconds": 0,
"milliseconds": 50
}
},
{
"service": "homeassistant.update_entity",
"data": {},
"target": {
"entity_id": [
"sensor.em3_net_energy_bought_quarter_hourly_last_second",
"sensor.em3_net_energy_selling_sum_quarter_hourly_last_second",
"sensor.em3_net_solar_energy_own_usage_sum_quarter_hourly_last_second",
"sensor.em3_net_electricity_purhase_price_without_tax_and_transfer_quarter_hourly_last_second",
"sensor.solar_panels_roi_sum_quarter_hourly_last_second",
"sensor.em3_net_house_energy_usage_quarter_hourly_last_second",
"sensor.em3_net_electricity_transfer_cost_quarter_hourly_last_second"
]
}
},
{
"delay": {
"hours": 0,
"minutes": 0,
"seconds": 0,
"milliseconds": 50
}
},
{
"service": "homeassistant.update_entity",
"data": {},
"target": {
"entity_id": [
"sensor.em3_net_solar_energy_own_usage_sum_quarter_hourly_last_second_monthly",
"sensor.em3_quarter_hourly_based_net_energy_kwh_last_second_monthly",
"sensor.em3_quarter_hourly_based_net_solar_energy_own_usage_kwh_last_second_daily",
"sensor.em3_quarter_hourly_based_net_solar_energy_own_usage_kwh_last_second_monthly",
"sensor.em3_quarter_hourly_based_net_sold_kwh_last_second_daily",
"sensor.em3_quarter_hourly_based_net_sold_kwh_last_second_monthly",
"sensor.em3_quarter_hourly_based_net_energy_kwh_last_second_daily",
"sensor.em3_net_energy_bought_quarter_hourly_last_second_daily",
"sensor.em3_net_energy_bought_quarter_hourly_last_second_monthly",
"sensor.em3_net_solar_energy_own_usage_sum_quarter_hourly_last_second_daily",
"sensor.em3_net_electricity_purhase_price_without_tax_and_transfer_quarter_hourly_last_second_daily",
"sensor.em3_net_electricity_purhase_price_without_tax_and_transfer_quarter_hourly_last_second_monthly",
"sensor.solar_panels_roi_sum_quarter_hourly_last_second_daily",
"sensor.solar_panels_roi_sum_quarter_hourly_last_second_monthly",
"sensor.em3_quarter_hourly_based_net_house_energy_usage_kwh_last_second_daily",
"sensor.em3_quarter_hourly_based_net_house_energy_usage_kwh_last_second_monthly",
"sensor.em3_net_electricity_transfer_cost_quarter_hourly_last_second_daily",
"sensor.em3_net_electricity_transfer_cost_quarter_hourly_last_second_monthly"
]
}
},
{
"if": [
{
"condition": "template",
"value_template": "{{ now().strftime('%H%S') == 2359 }}"
}
],
"then": [
{
"service": "input_text.set_value",
"data": {
"value": "{{ states('sensor.em3_quarter_hourly_based_net_house_energy_usage_kwh_last_second_daily') }}"
},
"target": {
"entity_id": "input_text.last_period_em3_net_house_energy_usage_quarter_hourly_based_daily"
}
},
{
"service": "input_text.set_value",
"data": {
"value": "{{ states('sensor.em3_quarter_hourly_based_net_usage_kwh_last_second_daily') }}"
},
"target": {
"entity_id": "input_text.last_period_em3_net_energy_quarter_hourly_based_daily"
}
},
{
"service": "input_text.set_value",
"data": {
"value": "{{ states('sensor.em3_net_energy_bought_quarter_hourly_last_second_daily') }}"
},
"target": {
"entity_id": "input_text.last_period_em3_net_energy_bought_quarter_hourly_based_daily"
}
}
]
},
{
"if": [
{
"condition": "template",
"value_template": " {{ now().strftime('%d%H%M') | int == 10014 }}"
}
],
"then": [
{
"service": "input_text.set_value",
"data": {
"value": "{{ states('sensor.em3_net_energy_selling_sum_quarter_hourly') | float(0) | round(8) }}"
},
"target": {
"entity_id": "input_text.em3_net_energy_selling_sum_quarter_hourly_last_second_monthly"
}
},
{
"service": "input_text.set_value",
"data": {
"value": "{{ states('sensor.solar_panels_roi_sum_quarter_hourly') | float(0) | round(8) }}"
},
"target": {
"entity_id": "input_text.solar_panels_roi_sum_quarter_hourly_last_second_monthly"
}
}
],
"else": [
{
"service": "input_text.set_value",
"data": {
"value": "{{ (states('input_text.em3_net_energy_selling_sum_quarter_hourly_last_second_monthly') | float(0) | round(8) + states('sensor.em3_net_energy_selling_sum_quarter_hourly') | float(0) | round(8)) | round(8) }}"
},
"target": {
"entity_id": "input_text.em3_net_energy_selling_sum_quarter_hourly_last_second_monthly"
}
},
{
"service": "input_text.set_value",
"data": {
"value": "{{ (states('input_text.solar_panels_roi_sum_quarter_hourly_last_second_monthly') | float(0) | round(8) + states('sensor.solar_panels_roi_sum_quarter_hourly') | float(0) | round(8)) | round(8) }}"
},
"target": {
"entity_id": "input_text.solar_panels_roi_sum_quarter_hourly_last_second_monthly"
}
}
]
},
{
"if": [
{
"condition": "template",
"value_template": " {{ now().strftime('%H%M') | int == 14 }}"
}
],
"then": [
{
"service": "input_text.set_value",
"data": {
"value": "{{ states('sensor.em3_net_energy_selling_sum_quarter_hourly') | float(0) | round(8) }}"
},
"target": {
"entity_id": "input_text.em3_net_energy_selling_sum_quarter_hourly_last_second_daily"
}
},
{
"service": "input_text.set_value",
"data": {
"value": "{{ states('sensor.solar_panels_roi_sum_quarter_hourly') | float(0) | round(8) }}"
},
"target": {
"entity_id": "input_text.solar_panels_roi_sum_quarter_hourly_last_second_daily"
}
}
],
"else": [
{
"service": "input_text.set_value",
"data": {
"value": "{{ (states('input_text.em3_net_energy_selling_sum_quarter_hourly_last_second_daily') | float(0) | round(8) + states('sensor.em3_net_energy_selling_sum_quarter_hourly') | float(0) | round(8)) | round(8) }}"
},
"target": {
"entity_id": "input_text.em3_net_energy_selling_sum_quarter_hourly_last_second_daily"
}
},
{
"service": "input_text.set_value",
"data": {
"value": "{{ (states('input_text.solar_panels_roi_sum_quarter_hourly_last_second_daily') | float(0) | round(8) + states('sensor.solar_panels_roi_sum_quarter_hourly') | float(0) | round(8)) | round(8) }}"
},
"target": {
"entity_id": "input_text.solar_panels_roi_sum_quarter_hourly_last_second_daily"
}
}
]
}
],
"mode": "single",
"trace": {
"stored_traces": 96
}
},
"blueprint_inputs": null,
"context": {
"id": "01H3TCJAPEGH8XPJK9YJDZ7YBP",
"parent_id": null,
"user_id": null
}
},
"logbookEntries": [
{
"name": "Refresh Quarter-Hourly Last Second ",
"message": "triggered by time pattern",
"source": "time pattern",
"entity_id": "automation.refresh_quarter_hourly_last_second",
"context_id": "01H3TCJAPEGH8XPJK9YJDZ7YBP",
"when": 1687734004.430846,
"domain": "automation"
}
]
}