I am trying to create a light automation blueprint, which changes light brightness, temperature and color depending on presence, time and current room illuminance.
I have a pretty good idea how to do it, but in the moment, the automation generated by the blueprint doesn’t even start. ![]()
I am a seasoned C# developer but completely new to python. I have stripped down the blueprint to isolate the error and now I am stuck with the error
"TypeError: 'int' object is not iterable".
I don’t see any code where I try to iterate an int variable.
Here comes the complete trace with the error and the automation config:
{
"trace": {
"last_step": null,
"run_id": "ab87b02b8e864e1c3a9ab2e5502d24b4",
"state": "stopped",
"script_execution": null,
"timestamp": {
"start": "2025-11-13T17:57:54.050867+00:00",
"finish": "2025-11-13T17:57:54.051606+00:00"
},
"domain": "automation",
"item_id": "1763056465127",
"error": "TypeError: 'int' object is not iterable",
"trigger": null,
"trace": {},
"config": {
"mode": "restart",
"variables": {
"target_lux": 300,
"motion_timeout": 1,
"light_entity": [
"light.box_rechts"
],
"motion_entity": [
"binary_sensor.prasenzmelder_buro_uli_anwesenheit"
],
"lux_entity": "sensor.prasenzmelder_buro_uli_beleuchtungsstarke",
"current_lux": "{{ states[lux_entity].state | float(0) }}",
"lux_deficit": "{{ [0, target_lux - current_lux] | max }}",
"required_brightness": "{{ (lux_deficit / target_lux * 255) | int | min(255) }}"
},
"triggers": [
{
"trigger": "state",
"entity_id": [
"binary_sensor.prasenzmelder_buro_uli_anwesenheit"
],
"to": "on",
"id": "motion_detected"
},
{
"trigger": "state",
"entity_id": [
"binary_sensor.prasenzmelder_buro_uli_anwesenheit"
],
"to": "off",
"for": {
"minutes": "{{ motion_timeout }}"
},
"id": "motion_timeout"
},
{
"trigger": "time_pattern",
"minutes": "/5",
"id": "periodic_update"
},
{
"trigger": "state",
"entity_id": "sensor.prasenzmelder_buro_uli_beleuchtungsstarke",
"id": "lux_changed"
}
],
"actions": [
{
"choose": [
{
"alias": "Bewegung erkannt oder zu dunkel -> Licht an/anpassen",
"conditions": [
{
"or": [
{
"condition": "trigger",
"id": "motion_detected"
},
{
"condition": "trigger",
"id": "periodic_update"
},
{
"condition": "trigger",
"id": "lux_changed"
}
]
},
{
"condition": "template",
"value_template": "{{ current_lux < target_lux }}"
}
],
"sequence": [
{
"if": [
{
"condition": "template",
"value_template": "{{ required_brightness > 0 }}"
}
],
"then": [
{
"action": "light.turn_on",
"target": {
"entity_id": "{{ light_entity }}"
},
"data": {
"brightness": "{{ required_brightness }}",
"color_temp_kelvin": 3000,
"transition": 2
}
}
],
"else": [
{
"action": "light.turn_off",
"target": {
"entity_id": "{{ light_entity }}"
},
"data": {
"transition": 2
}
}
]
}
]
},
{
"alias": "Es ist hell genug -> Licht aus",
"conditions": [
{
"condition": "template",
"value_template": "{{ current_lux > target_lux }}"
}
],
"sequence": [
{
"action": "light.turn_off",
"target": {
"entity_id": "{{ light_entity }}"
},
"data": {
"transition": 5
}
}
]
},
{
"alias": "Bewegungs-Timeout -> Licht aus",
"conditions": [
{
"condition": "trigger",
"id": "motion_timeout"
}
],
"sequence": [
{
"action": "light.turn_off",
"target": {
"entity_id": "{{ light_entity }}"
},
"data": {
"transition": 3
}
}
]
}
]
}
],
"conditions": [],
"id": "1763056465127",
"alias": "Auto Light White",
"description": ""
},
"blueprint_inputs": {
"id": "1763056465127",
"alias": "Auto Light White",
"description": "",
"use_blueprint": {
"path": "homeassistant/autolight_white.yaml",
"input": {
"light_target": [
"light.box_rechts"
],
"motion_sensor": [
"binary_sensor.prasenzmelder_buro_uli_anwesenheit"
],
"lux_sensor": "sensor.prasenzmelder_buro_uli_beleuchtungsstarke",
"motion_timeout": 1
}
}
},
"context": {
"id": "01K9Z5VS82APTSQQ11SNQX9BGY",
"parent_id": "01K9Z5VS82NEKKKKCSXYM2MT7H",
"user_id": null
}
},
"logbookEntries": []
}