I created an automation that sends me a message when the fridge is left open for more than 10 minutes and repeats sending me a message every 10min.
However some time the Message triggers as soon as I open the the fridge, not after 10 minutes is left open
Here is Automation and Good and BadTrace
AUTOMATION
alias: Fridge Open for X Minutes with Repeat
description: ""
trigger:
- platform: time_pattern
minutes: /10
condition:
- or:
- type: is_open
condition: device
device_id: c6f39af9eb083ffaf219296a47b0f69e
entity_id: binary_sensor.freezer_door
domain: binary_sensor
- type: is_open
condition: device
device_id: c6f39af9eb083ffaf219296a47b0f69e
entity_id: binary_sensor.refrigerator_door
domain: binary_sensor
- type: is_temperature
condition: device
device_id: c6f39af9eb083ffaf219296a47b0f69e
entity_id: sensor.frezer_temp
domain: sensor
above: -5
- type: is_temperature
condition: device
device_id: a111781782ec1184bcb67432e5c7c6e2
entity_id: sensor.chest_frezer_temperature_2
domain: sensor
above: -5
- type: is_open
condition: device
device_id: a111781782ec1184bcb67432e5c7c6e2
entity_id: binary_sensor.chest_freezer_door_2
domain: binary_sensor
action:
- service: tts.google_say
data:
entity_id: media_player.all_the_speakers
message: >-
Freezers open, Temp:{{ states('sensor.frezer_temp') }} and {{
states('sensor.chest_frezer_temperature_2') }} Celsius
- service: telegram_bot.send_message
data:
message: >-
Freezers Open, Temp {{ states('sensor.frezer_temp') }} and {{
states('sensor.chest_frezer_temperature_2') }} Celsius
mode: single
.
.
.
.
TRACE OF WHEN SEND MESSAGE IMMEDIATELLY "WRONGLY"
{
"trace": {
"last_step": "action/1",
"run_id": "ffac88494bfd8eae05f2fa58dbaef906",
"state": "stopped",
"script_execution": "finished",
"timestamp": {
"start": "2022-11-19T03:50:00.002557+00:00",
"finish": "2022-11-19T03:50:03.985045+00:00"
},
"domain": "automation",
"item_id": "1668207670052",
"trigger": "time pattern",
"trace": {
"trigger/0": [
{
"path": "trigger/0",
"timestamp": "2022-11-19T03:50:00.002926+00:00",
"changed_variables": {
"this": {
"entity_id": "automation.fridge_open_for_x_minutes_with_repeat",
"state": "on",
"attributes": {
"last_triggered": "2022-11-19T03:10:00.004838+00:00",
"mode": "single",
"current": 0,
"id": "1668207670052",
"friendly_name": "Fridge Open for X Minutes with Repeat"
},
"last_changed": "2022-11-12T00:48:25.268483+00:00",
"last_updated": "2022-11-19T03:10:04.515861+00:00",
"context": {
"id": "01GJ6XTHT251763DJK2RJ5APS2",
"parent_id": null,
"user_id": null
}
},
"trigger": {
"id": "0",
"idx": "0",
"alias": null,
"platform": "time_pattern",
"now": "2022-11-18T19:50:00.001233-08:00",
"description": "time pattern"
}
}
}
],
"condition/0": [
{
"path": "condition/0",
"timestamp": "2022-11-19T03:50:00.003093+00:00",
"result": {
"result": true
}
}
],
"condition/0/conditions/0": [
{
"path": "condition/0/conditions/0",
"timestamp": "2022-11-19T03:50:00.003215+00:00",
"result": {
"result": false
}
},
{
"path": "condition/0/conditions/0",
"timestamp": "2022-11-19T03:50:00.003293+00:00",
"result": {
"result": false
}
}
],
"condition/0/conditions/0/entity_id/0": [
{
"path": "condition/0/conditions/0/entity_id/0",
"timestamp": "2022-11-19T03:50:00.003391+00:00",
"result": {
"result": false,
"state": "off",
"wanted_state": "on"
}
}
],
"condition/0/conditions/1": [
{
"path": "condition/0/conditions/1",
"timestamp": "2022-11-19T03:50:00.003659+00:00",
"result": {
"result": true
}
},
{
"path": "condition/0/conditions/1",
"timestamp": "2022-11-19T03:50:00.003738+00:00",
"result": {
"result": true
}
}
],
"condition/0/conditions/1/entity_id/0": [
{
"path": "condition/0/conditions/1/entity_id/0",
"timestamp": "2022-11-19T03:50:00.003831+00:00",
"result": {
"result": true,
"state": "on",
"wanted_state": "on"
}
}
],
"action/0": [
{
"path": "action/0",
"timestamp": "2022-11-19T03:50:00.009258+00:00",
"changed_variables": {
"context": {
"id": "01GJ703SJ2NY8JR2C85VA9DTZX",
"parent_id": null,
"user_id": null
}
},
"result": {
"params": {
"domain": "tts",
"service": "google_say",
"service_data": {
"entity_id": "media_player.all_the_speakers",
"message": "Freezers open, Temp:-18.6 and -17.4 Celsius"
},
"target": {}
},
"running_script": false,
"limit": 10
}
}
],
"action/1": [
{
"path": "action/1",
"timestamp": "2022-11-19T03:50:02.757001+00:00",
"result": {
"params": {
"domain": "telegram_bot",
"service": "send_message",
"service_data": {
"message": "Freezers Open, Temp -18.6 and -17.4 Celsius"
},
"target": {}
},
"running_script": false,
"limit": 10
}
}
]
},
"config": {
"id": "1668207670052",
"alias": "Fridge Open for X Minutes with Repeat",
"description": "",
"trigger": [
{
"platform": "time_pattern",
"minutes": "/10"
}
],
"condition": [
{
"or": [
{
"type": "is_open",
"condition": "device",
"device_id": "c6f39af9eb083ffaf219296a47b0f69e",
"entity_id": "binary_sensor.freezer_door",
"domain": "binary_sensor"
},
{
"type": "is_open",
"condition": "device",
"device_id": "c6f39af9eb083ffaf219296a47b0f69e",
"entity_id": "binary_sensor.refrigerator_door",
"domain": "binary_sensor"
},
{
"type": "is_temperature",
"condition": "device",
"device_id": "c6f39af9eb083ffaf219296a47b0f69e",
"entity_id": "sensor.frezer_temp",
"domain": "sensor",
"above": -5
},
{
"type": "is_temperature",
"condition": "device",
"device_id": "a111781782ec1184bcb67432e5c7c6e2",
"entity_id": "sensor.chest_frezer_temperature_2",
"domain": "sensor",
"above": -5
},
{
"type": "is_open",
"condition": "device",
"device_id": "a111781782ec1184bcb67432e5c7c6e2",
"entity_id": "binary_sensor.chest_freezer_door_2",
"domain": "binary_sensor"
}
]
}
],
"action": [
{
"service": "tts.google_say",
"data": {
"entity_id": "media_player.all_the_speakers",
"message": "Freezers open, Temp:{{ states('sensor.frezer_temp') }} and {{ states('sensor.chest_frezer_temperature_2') }} Celsius"
}
},
{
"service": "telegram_bot.send_message",
"data": {
"message": "Freezers Open, Temp {{ states('sensor.frezer_temp') }} and {{ states('sensor.chest_frezer_temperature_2') }} Celsius"
}
}
],
"mode": "single"
},
"blueprint_inputs": null,
"context": {
"id": "01GJ703SJ2NY8JR2C85VA9DTZX",
"parent_id": null,
"user_id": null
}
},
"logbookEntries": [
{
"name": "Fridge Open for X Minutes with Repeat",
"message": "triggered by time pattern",
"source": "time pattern",
"entity_id": "automation.fridge_open_for_x_minutes_with_repeat",
"context_id": "01GJ703SJ2NY8JR2C85VA9DTZX",
"when": 1668829800.004369,
"domain": "automation"
},
{
"when": 1668829800.991107,
"state": "idle",
"entity_id": "media_player.all_the_speakers",
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Fridge Open for X Minutes with Repeat",
"context_message": "triggered by time pattern",
"context_source": "time pattern",
"context_entity_id": "automation.fridge_open_for_x_minutes_with_repeat"
},
{
"when": 1668829802.739962,
"state": "playing",
"entity_id": "media_player.all_the_speakers",
"context_event_type": "automation_triggered",
"context_domain": "automation",
"context_name": "Fridge Open for X Minutes with Repeat",
"context_message": "triggered by time pattern",
"context_source": "time pattern",
"context_entity_id": "automation.fridge_open_for_x_minutes_with_repeat"
}
]
}
TRACE OF WHEN SENDS MESSAGE CORRECTLY AFTER 10 MINUTES
{
"trace": {
"last_step": "condition/0/conditions/4/entity_id/0",
"run_id": "a5008ec9bdcc0837ac08aede634b6e34",
"state": "stopped",
"script_execution": "failed_conditions",
"timestamp": {
"start": "2022-11-19T04:00:00.004665+00:00",
"finish": "2022-11-19T04:00:00.006904+00:00"
},
"domain": "automation",
"item_id": "1668207670052",
"trigger": "time pattern",
"trace": {
"trigger/0": [
{
"path": "trigger/0",
"timestamp": "2022-11-19T04:00:00.004884+00:00",
"changed_variables": {
"this": {
"entity_id": "automation.fridge_open_for_x_minutes_with_repeat",
"state": "on",
"attributes": {
"last_triggered": "2022-11-19T03:50:00.004498+00:00",
"mode": "single",
"current": 0,
"id": "1668207670052",
"friendly_name": "Fridge Open for X Minutes with Repeat"
},
"last_changed": "2022-11-12T00:48:25.268483+00:00",
"last_updated": "2022-11-19T03:50:03.980972+00:00",
"context": {
"id": "01GJ703SJ2NY8JR2C85VA9DTZX",
"parent_id": null,
"user_id": null
}
},
"trigger": {
"id": "0",
"idx": "0",
"alias": null,
"platform": "time_pattern",
"now": "2022-11-18T20:00:00.001957-08:00",
"description": "time pattern"
}
}
}
],
"condition/0": [
{
"path": "condition/0",
"timestamp": "2022-11-19T04:00:00.005013+00:00",
"result": {
"result": false
}
}
],
"condition/0/conditions/0": [
{
"path": "condition/0/conditions/0",
"timestamp": "2022-11-19T04:00:00.005120+00:00",
"result": {
"result": false
}
},
{
"path": "condition/0/conditions/0",
"timestamp": "2022-11-19T04:00:00.005185+00:00",
"result": {
"result": false
}
}
],
"condition/0/conditions/0/entity_id/0": [
{
"path": "condition/0/conditions/0/entity_id/0",
"timestamp": "2022-11-19T04:00:00.005271+00:00",
"result": {
"result": false,
"state": "off",
"wanted_state": "on"
}
}
],
"condition/0/conditions/1": [
{
"path": "condition/0/conditions/1",
"timestamp": "2022-11-19T04:00:00.005506+00:00",
"result": {
"result": false
}
},
{
"path": "condition/0/conditions/1",
"timestamp": "2022-11-19T04:00:00.005571+00:00",
"result": {
"result": false
}
}
],
"condition/0/conditions/1/entity_id/0": [
{
"path": "condition/0/conditions/1/entity_id/0",
"timestamp": "2022-11-19T04:00:00.005651+00:00",
"result": {
"result": false,
"state": "off",
"wanted_state": "on"
}
}
],
"condition/0/conditions/2": [
{
"path": "condition/0/conditions/2",
"timestamp": "2022-11-19T04:00:00.005838+00:00",
"result": {
"result": false
}
},
{
"path": "condition/0/conditions/2",
"timestamp": "2022-11-19T04:00:00.005901+00:00",
"result": {
"result": false
}
}
],
"condition/0/conditions/2/entity_id/0": [
{
"path": "condition/0/conditions/2/entity_id/0",
"timestamp": "2022-11-19T04:00:00.005980+00:00",
"result": {
"result": false,
"state": -16.5,
"wanted_state_above": -5
}
}
],
"condition/0/conditions/3": [
{
"path": "condition/0/conditions/3",
"timestamp": "2022-11-19T04:00:00.006173+00:00",
"result": {
"result": false
}
},
{
"path": "condition/0/conditions/3",
"timestamp": "2022-11-19T04:00:00.006238+00:00",
"result": {
"result": false
}
}
],
"condition/0/conditions/3/entity_id/0": [
{
"path": "condition/0/conditions/3/entity_id/0",
"timestamp": "2022-11-19T04:00:00.006313+00:00",
"result": {
"result": false,
"state": -17.9,
"wanted_state_above": -5
}
}
],
"condition/0/conditions/4": [
{
"path": "condition/0/conditions/4",
"timestamp": "2022-11-19T04:00:00.006494+00:00",
"result": {
"result": false
}
},
{
"path": "condition/0/conditions/4",
"timestamp": "2022-11-19T04:00:00.006560+00:00",
"result": {
"result": false
}
}
],
"condition/0/conditions/4/entity_id/0": [
{
"path": "condition/0/conditions/4/entity_id/0",
"timestamp": "2022-11-19T04:00:00.006638+00:00",
"result": {
"result": false,
"state": "off",
"wanted_state": "on"
}
}
]
},
"config": {
"id": "1668207670052",
"alias": "Fridge Open for X Minutes with Repeat",
"description": "",
"trigger": [
{
"platform": "time_pattern",
"minutes": "/10"
}
],
"condition": [
{
"or": [
{
"type": "is_open",
"condition": "device",
"device_id": "c6f39af9eb083ffaf219296a47b0f69e",
"entity_id": "binary_sensor.freezer_door",
"domain": "binary_sensor"
},
{
"type": "is_open",
"condition": "device",
"device_id": "c6f39af9eb083ffaf219296a47b0f69e",
"entity_id": "binary_sensor.refrigerator_door",
"domain": "binary_sensor"
},
{
"type": "is_temperature",
"condition": "device",
"device_id": "c6f39af9eb083ffaf219296a47b0f69e",
"entity_id": "sensor.frezer_temp",
"domain": "sensor",
"above": -5
},
{
"type": "is_temperature",
"condition": "device",
"device_id": "a111781782ec1184bcb67432e5c7c6e2",
"entity_id": "sensor.chest_frezer_temperature_2",
"domain": "sensor",
"above": -5
},
{
"type": "is_open",
"condition": "device",
"device_id": "a111781782ec1184bcb67432e5c7c6e2",
"entity_id": "binary_sensor.chest_freezer_door_2",
"domain": "binary_sensor"
}
]
}
],
"action": [
{
"service": "tts.google_say",
"data": {
"entity_id": "media_player.all_the_speakers",
"message": "Freezers open, Temp:{{ states('sensor.frezer_temp') }} and {{ states('sensor.chest_frezer_temperature_2') }} Celsius"
}
},
{
"service": "telegram_bot.send_message",
"data": {
"message": "Freezers Open, Temp {{ states('sensor.frezer_temp') }} and {{ states('sensor.chest_frezer_temperature_2') }} Celsius"
}
}
],
"mode": "single"
},
"blueprint_inputs": null,
"context": {
"id": "01GJ70P3G4AB23QVT90XX5G2JS",
"parent_id": null,
"user_id": null
}
},
"logbookEntries": []
}