I’ve had trouble with setting light colours and things like that. I’ve found a spec for this, now is more reliable
- spec:
name: set_light_color
description: Sets a color value for a light entity. Only call this function
when the user explicitly gives a color, and not warm, cold or cool.
parameters:
type: object
properties:
color:
type: string
description: The color to set
entity_id:
type: string
description: The light entity_id retrieved from available devices.
It must start with the light domain, followed by dot character.
required:
- color
- entity_id
function:
type: script
sequence:
- service: light.turn_on
data:
color_name: '{{color}}'
target:
entity_id: '{{entity_id}}'
- spec:
name: set_light_brightness
description: Sets a brightness value for a light entity. Only call this
function when the user explicitly gives you a percentage value.
parameters:
type: object
properties:
brightness:
type: string
description: The brightness percentage to set.
entity_id:
type: string
description: The light entity_id retrieved from available devices.
It must start with the light domain, followed by dot character.
required:
- brightness
- entity_id
function:
type: script
sequence:
- service: light.turn_on
data:
brightness_pct: '{{brightness}}'
target:
entity_id: '{{entity_id}}'
- spec:
name: set_light_warm
description: Sets a light entity to its warmest temperature.
parameters:
type: object
properties:
entity_id:
type: string
description: The light entity_id retrieved from available devices.
It must start with the light domain, followed by dot character.
required:
- entity_id
function:
type: script
sequence:
- service: light.turn_on
data:
kelvin: '{{state_attr(entity_id, "min_color_temp_kelvin")}}'
target:
entity_id: '{{entity_id}}'
- spec:
name: set_light_cold
description: Sets a light entity to its coldest or coolest temperature,
only call this function when user explicitly asks for cold or cool temperature of the light.
parameters:
type: object
properties:
entity_id:
type: string
description: The light entity_id retrieved from available devices.
It must start with the light domain, followed by dot character.
required:
- entity_id
function:
type: script
sequence:
- service: light.turn_on
data:
kelvin: '{{state_attr(entity_id, "max_color_temp_kelvin")}}'
target:
entity_id: '{{entity_id}}'