Skip to content

Instantly share code, notes, and snippets.

@peyanski
Created August 20, 2025 06:44
Show Gist options
  • Save peyanski/82f6c1246a03fa975022f919fb7d441b to your computer and use it in GitHub Desktop.
Save peyanski/82f6c1246a03fa975022f919fb7d441b to your computer and use it in GitHub Desktop.
alias: AI-Driven Lighting Control
description: Uses AI Task to adjust lighting based on home state
triggers:
- entity_id:
- binary_sensor.bedroom_motion
to: "on"
trigger: state
actions:
- data:
instructions: >-
Analyze the following home state:
Time: {{ now().strftime('%H:%M') }}
Bedroom Light Level: {{ states('sensor.bedroom_illuminance') }} lux
Outdoor Light Level: {{ states('sensor.yard_illuminance') }} lux
Bedroom Blinds: {{ states('cover.bedroom_blinds') }}
Bedroom Blinds current position: {{ state_attr("cover.bedroom_blinds",
"current_position") }} %
Suggest lighting settings for the living room. Should the lights turn
on? (yes/no) - Recommended brightness (0-100%)
Provide the response in the format: lights_on <yes/no> brightness
<integer>
structure:
lights_on:
selector:
text: null
brightness:
selector:
number: null
task_name: analyze home light state
response_variable: ai_response
action: ai_task.generate_data
- condition: template
value_template: "{{ ai_response.data.lights_on == 'yes' }}"
- action: light.turn_on
target:
entity_id: light.bedroom_light
data:
brightness_pct: "{{ ai_response.data.brightness }}"
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment