From 922a92094dc0e9db80308c13874a42898f6a3e1d Mon Sep 17 00:00:00 2001 From: Home Assistant Version Control Date: Wed, 26 Aug 2026 17:55:28 +0000 Subject: [PATCH] .ha_mcp/logs/mcp_usage.jsonl, automations.yaml --- .ha_mcp/logs/mcp_usage.jsonl | 2 ++ automations.yaml | 59 ++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/.ha_mcp/logs/mcp_usage.jsonl b/.ha_mcp/logs/mcp_usage.jsonl index f9bf21f9..e0c21acb 100644 --- a/.ha_mcp/logs/mcp_usage.jsonl +++ b/.ha_mcp/logs/mcp_usage.jsonl @@ -2922,3 +2922,5 @@ {"timestamp": "2026-08-26T17:49:38.007628+00:00", "tool_name": "ha_get_automation_traces", "parameters": {"automation_id": "automation.office_manual_meeting_status_busy_light_working_hours", "run_id": "a7220735365674c35847e1cbc0d022d5", "limit": 10, "deduplicate": true, "detailed": true, "sections": null, "offset": 0, "order": "newest", "ctx": {"_STATE_TTL_SECONDS": 86400}}, "execution_time_ms": 6.405830383300781, "success": true, "error_message": null, "response_size_bytes": 2186, "user_context": null} {"timestamp": "2026-08-26T17:54:14.026157+00:00", "tool_name": "ha_config_set_automation", "parameters": {"config": null, "identifier": "automation.office_manual_meeting_status_busy_light_working_hours", "python_transform": "config['triggers'].append({'trigger': 'homeassistant', 'event': 'start', 'id': 'ha_started'}); new_branch = {'alias': '--- HA RESTART: SET INITIAL LIGHT STATE ---', 'conditions': [{'condition': 'template', 'value_template': \"{{ trigger.id == 'ha_started' }}\"}], 'sequence': [{'choose': [{'alias': 'Work hours, not away, in meeting: Red', 'conditions': [{'condition': 'template', 'value_template': \"{{ is_work_hours and not is_away and is_state('input_boolean.in_a_meeting', 'on') }}\"}], 'sequence': [{'action': 'light.turn_on', 'target': {'entity_id': 'light.night_light'}, 'data': {'brightness_pct': 100, 'rgb_color': [255, 0, 0]}}]}, {'alias': 'Work hours, not away, not in meeting: Green', 'conditions': [{'condition': 'template', 'value_template': \"{{ is_work_hours and not is_away and is_state('input_boolean.in_a_meeting', 'off') }}\"}], 'sequence': [{'action': 'light.turn_on', 'target': {'entity_id': 'light.night_light'}, 'data': {'brightness_pct': 30, 'rgb_color': [5, 245, 45]}}]}, {'alias': 'After hours or away, motion on and dark: Warm light', 'conditions': [{'condition': 'template', 'value_template': \"{{ (not is_work_hours or is_away) and is_dark and is_state('binary_sensor.night_light_occupancy', 'on') }}\"}], 'sequence': [{'action': 'light.turn_on', 'target': {'entity_id': 'light.night_light'}, 'data': {'brightness_pct': 40, 'color_temp_kelvin': 2700}}]}, {'alias': 'After hours or away, no motion or not dark: Light off', 'conditions': [{'condition': 'template', 'value_template': \"{{ not is_work_hours or is_away }}\"}], 'sequence': [{'action': 'light.turn_off', 'target': {'entity_id': 'light.night_light'}}]}]}]}; config['actions'][0]['choose'].insert(0, new_branch)", "config_hash": "92a53d9976cc3182", "category": null, "wait": true, "MandatoryBPS": true, "BestPracticeKey": null}, "execution_time_ms": 68.53771209716797, "success": false, "error_message": "{\n \"success\": false,\n \"error\": {\n \"code\": \"VALIDATION_FAILED\",\n \"message\": \"Expression raised at runtime: KeyError: 'choose'\",\n \"suggestion\": \"Verify referenced keys/indices exist in the input\",\n \"suggestions\": [\n \"Verify referenced keys/indices exist in the input\",\n \"Check that types match (e.g. dict vs list operations)\",\n \"Use .get(key, default) to handle missing keys\",\n \"Expression: config['triggers'].append({'trigger': 'homeassistant', 'event': 'start', 'id': 'ha_started'}); new_b...\",\n \"For Home Assistant best-practice guidance, call ha_get_skill_guide(skill='home-assistant-best-practices') and consult the relevant reference file before retrying.\"\n ]\n },\n \"action\": \"python_transform\",\n \"identifier\": \"automation.office_manual_meeting_status_busy_light_working_hours\"\n}", "response_size_bytes": null, "user_context": null} {"timestamp": "2026-08-26T17:55:02.943157+00:00", "tool_name": "ha_config_get_automation", "parameters": {"identifier": "automation.office_manual_meeting_status_busy_light_working_hours"}, "execution_time_ms": 111.51552200317383, "success": true, "error_message": null, "response_size_bytes": 3801, "user_context": null} +{"timestamp": "2026-08-26T17:55:22.818112+00:00", "tool_name": "ha_config_set_automation", "parameters": {"config": null, "identifier": "automation.office_manual_meeting_status_busy_light_working_hours", "python_transform": "config['triggers'].append({'trigger': 'homeassistant', 'event': 'start', 'id': 'ha_started'}); new_branch = {'alias': '--- HA RESTART: SET INITIAL LIGHT STATE ---', 'conditions': [{'condition': 'template', 'value_template': \"{{ trigger.id == 'ha_started' }}\"}], 'sequence': [{'choose': [{'alias': 'Work hours, not away, in meeting: Red', 'conditions': [{'condition': 'template', 'value_template': \"{{ is_work_hours and not is_away and is_state('input_boolean.in_a_meeting', 'on') }}\"}], 'sequence': [{'action': 'light.turn_on', 'target': {'entity_id': 'light.night_light'}, 'data': {'brightness_pct': 100, 'rgb_color': [255, 0, 0]}}]}, {'alias': 'Work hours, not away, not in meeting: Green', 'conditions': [{'condition': 'template', 'value_template': \"{{ is_work_hours and not is_away and is_state('input_boolean.in_a_meeting', 'off') }}\"}], 'sequence': [{'action': 'light.turn_on', 'target': {'entity_id': 'light.night_light'}, 'data': {'brightness_pct': 30, 'rgb_color': [5, 245, 45]}}]}, {'alias': 'After hours or away, motion on and dark: Warm light', 'conditions': [{'condition': 'template', 'value_template': \"{{ (not is_work_hours or is_away) and is_dark and is_state('binary_sensor.night_light_occupancy', 'on') }}\"}], 'sequence': [{'action': 'light.turn_on', 'target': {'entity_id': 'light.night_light'}, 'data': {'brightness_pct': 40, 'color_temp_kelvin': 2700}}]}, {'alias': 'After hours or away, no motion or not dark: Light off', 'conditions': [{'condition': 'template', 'value_template': \"{{ not is_work_hours or is_away }}\"}], 'sequence': [{'action': 'light.turn_off', 'target': {'entity_id': 'light.night_light'}}]}]}]}; config['actions'][1]['choose'].insert(0, new_branch)", "config_hash": "92a53d9976cc3182", "category": null, "wait": true, "MandatoryBPS": true, "BestPracticeKey": null}, "execution_time_ms": 1232.365369796753, "success": true, "error_message": null, "response_size_bytes": 62440, "user_context": null} +{"timestamp": "2026-08-26T17:55:27.697205+00:00", "tool_name": "ha_config_get_automation", "parameters": {"identifier": "automation.office_manual_meeting_status_busy_light_working_hours"}, "execution_time_ms": 79.4680118560791, "success": true, "error_message": null, "response_size_bytes": 5399, "user_context": null} diff --git a/automations.yaml b/automations.yaml index 54463041..fe8f7615 100644 --- a/automations.yaml +++ b/automations.yaml @@ -2299,6 +2299,9 @@ - id: work_day_ended trigger: time at: '18:00:00' + - trigger: homeassistant + event: start + id: ha_started conditions: [] actions: - variables: @@ -2307,6 +2310,62 @@ is_away: '{{ is_state(''input_boolean.away_mode'', ''on'') }}' is_dark: '{{ states(''sensor.night_light_illuminance'') | float(0) < 15 }}' - choose: + - alias: '--- HA RESTART: SET INITIAL LIGHT STATE ---' + conditions: + - condition: template + value_template: '{{ trigger.id == ''ha_started'' }}' + sequence: + - choose: + - alias: 'Work hours, not away, in meeting: Red' + conditions: + - condition: template + value_template: '{{ is_work_hours and not is_away and is_state(''input_boolean.in_a_meeting'', + ''on'') }}' + sequence: + - action: light.turn_on + target: + entity_id: light.night_light + data: + brightness_pct: 100 + rgb_color: + - 255 + - 0 + - 0 + - alias: 'Work hours, not away, not in meeting: Green' + conditions: + - condition: template + value_template: '{{ is_work_hours and not is_away and is_state(''input_boolean.in_a_meeting'', + ''off'') }}' + sequence: + - action: light.turn_on + target: + entity_id: light.night_light + data: + brightness_pct: 30 + rgb_color: + - 5 + - 245 + - 45 + - alias: 'After hours or away, motion on and dark: Warm light' + conditions: + - condition: template + value_template: '{{ (not is_work_hours or is_away) and is_dark and is_state(''binary_sensor.night_light_occupancy'', + ''on'') }}' + sequence: + - action: light.turn_on + target: + entity_id: light.night_light + data: + brightness_pct: 40 + color_temp_kelvin: 2700 + - alias: 'After hours or away, no motion or not dark: Light off' + conditions: + - condition: template + value_template: '{{ not is_work_hours or is_away }}' + sequence: + - action: light.turn_off + target: + entity_id: light.night_light - alias: '--- WORKING HOURS MODE ---' conditions: - condition: template