Services

FLARE’s services are Home Assistant actions that any automation or script can call, and the blueprint is built on them. Developer Tools → Actions shows the same fields as this page.

Service Description
flare.apply_lighting Sets lights to a brightness and colour, leaving alone any that someone else has changed
flare.turn_off Turns lights off for now, so FLARE turns them on again later
flare.compute_curve The curve’s brightness and colour for any moment
flare.claims_check Whether FLARE would leave each light alone
flare.claims_record Records a change you’re about to make as FLARE’s
flare.claims_clear Discards claims, so FLARE sets the lights again
flare.claims_override Marks lights as changed by someone else, so FLARE leaves them alone
flare.compute_scene_coverage Which of a room’s lights a scene sets
flare.resolve_target The entities a target reaches
flare.export_schedule A schedule’s settings as YAML
flare.import_schedule Sets a schedule from YAML

In the field tables, a schedule is passed as its device ID. In a template, device_id() of any of its entities gives you that, such as device_id('sensor.home_flare') for the Home schedule. A room is passed as room_id, usually the calling automation’s own entity ID, {{ this.entity_id }}; see rooms.

On this page
  1. flare.apply_lighting
    1. Fields
    2. Brightness levels
    3. Response data
  2. flare.turn_off
    1. flare.turn_off or light.turn_off?
    2. Fields
    3. Good to know
  3. flare.compute_curve
    1. Fields
    2. Response data
  4. flare.claims_check
    1. Fields
    2. Response data
  5. flare.claims_record
    1. Fields
    2. Good to know
  6. flare.claims_clear
    1. Fields
    2. Response data
  7. flare.claims_override
    1. Fields
  8. flare.compute_scene_coverage
    1. Fields
    2. Response data
  9. flare.resolve_target
    1. Fields
    2. Response data
  10. flare.export_schedule
    1. Fields
    2. Response data
  11. flare.import_schedule
    1. Fields
    2. Good to know
  12. Two-step bulbs
  13. In your own automations
    1. Keeping a room on the curve
    2. Sending the commands yourself

flare.apply_lighting

Use this action to set lights to a brightness and colour temperature, turning on any that are off. It skips lights that are unavailable, already close to the target, or changed by something else (see override protection).

action: flare.apply_lighting
data:
  entities: [light.kitchen_1, light.kitchen_2]
  brightness: "{{ state_attr('sensor.home_flare', 'brightness') }}"
  color_temp_kelvin: "{{ state_attr('sensor.home_flare', 'color_temp_kelvin') }}"
  transition: 2
  brightness_levels: { light.kitchen_2: 60 }
  room_id: "{{ this.entity_id }}"

This sets both kitchen lights to the Home schedule’s current colour temperature, with light.kitchen_1 at the schedule’s brightness and light.kitchen_2 at 60.

Fields

Field Required Description
brightness
0–255
unless every light has a level The brightness for every light that isn’t in brightness_levels. 0 turns the lights off, as it does for light.turn_on.
brightness_levels
map of entity ID to level
no A brightness for individual lights, in place of brightness. See brightness levels.
color_temp_kelvin
Kelvin
yes The colour temperature.
entities
list of light entity IDs
yes The lights to set.
force
boolean; default false
no Sets every light, including ones someone else has changed. The change is still recorded as FLARE’s.
dry_run
boolean; default false
no Works out what would be sent and returns it, without sending anything or recording claims.
min_brightness_change
percent, 0–25; default from FLARE → Settings → Configure
no A light within this percentage of the target brightness, or 2 if that’s more, isn’t sent anything, and still matches its claim. See tolerances.
min_color_temp_change
mireds, 0–50; default from FLARE → Settings → Configure
no A light within this many mireds of the target colour temperature isn’t sent anything, and still matches its claim. For an rgb_color target, the channels’ differences added together can be up to twice this.
prefer_rgb_color
boolean; default false
no Sends rgb_color instead of color_temp_kelvin to lights that support RGB.
rgb_color
[r, g, b] or null
no The colour for RGB lights when prefer_rgb_color is on. The schedule sensor’s rgb_color attribute is the colour temperature converted to RGB. Ignored if prefer_rgb_color is off.
room_entities
list of light entity IDs
no The room’s lights, which FLARE releases together once none of them is on. Without it, the lights this room’s calls have set.
room_id
text
no The room to record the change for, usually the calling automation: {{ this.entity_id }}. Without it, FLARE records nothing and doesn’t leave any light alone. See rooms.
transition
seconds, 0–300; default 0
no How long the change takes. Two-step bulbs spend half of it on brightness and half on colour.

Brightness levels

Value Effect
1–255 Sets the light to this brightness.
0 Turns the light off.
null or false Leaves the light alone, whether it’s on or off.

Response data

Optional. With response_variable, the response is what was sent, or with dry_run, what would be sent. groups is a list with one entry for each brightness, and each entry has these fields:

  • brightness: The brightness the group’s lights are sent, or 0 for lights being turned off.
  • needing_off: Lights that need turning off.
  • combined: Lights sent brightness and colour temperature in one command.
  • two_step: Lights sent brightness and colour temperature as two commands.
  • combined_rgb, two_step_rgb: The same, for lights sent rgb_color.

Lights that are unavailable, already close to the target, or changed by someone else aren’t in any list.

groups:
  - brightness: 200
    needing_off: []
    combined: [light.kitchen_1]
    two_step: []
    combined_rgb: []
    two_step_rgb: []
  - brightness: 100
    needing_off: []
    combined: []
    two_step: [light.kitchen_2]
    combined_rgb: []
    two_step_rgb: []

flare.turn_off

Use this action to turn lights off while keeping them controlled. It sets each light’s claim to off before turning it off, so the light still matches its claim and comes on with the rest of the room next time.

action: flare.turn_off
data:
  entities: [light.kitchen_1, light.kitchen_2]
  transition: 15

flare.turn_off or light.turn_off?

Both turn the light off, but they leave its claim saying different things:

  light.turn_off flare.turn_off
The light’s claim Still says what FLARE last set, such as on at 180 Says off
The light’s status overridden, once it has been off for 30 seconds, since it doesn’t match its claim controlled, since it matches its claim
The next time the room’s lights are turned on It’s left off It’s set with the rest, so it comes on

Either way, once none of the room’s claimed lights is on, the room deletes its claims, and every light is set the next time the room’s lights are turned on. So if you’re turning the whole room off, it makes no difference which you use.

Use light.turn_off when you want a light to stay off while the rest of the room is on, such as a lamp switched off for the evening. Use flare.turn_off when a room has emptied but a nightlight stays on, so the other lights come on again when someone returns. In a room that’s still in use, a light turned off with flare.turn_off comes back on at the next update.

Fields

Field Required Description
entities
list of light entity IDs
yes The lights to turn off.
transition
seconds, 0–300; default 0
no How long the change takes.

Good to know

  • It turns off every light it’s given, including lights someone else has changed. To turn off only the lights FLARE is still setting, call claims_check first.
  • A light FLARE isn’t driving is just turned off, as light.turn_off would.

flare.compute_curve

Use this action to work out the curve’s phase, brightness and colour at any moment, for phase start times and curve settings you give it, without needing a schedule.

action: flare.compute_curve
data:
  morning: "{{ today_at('06:00') | as_timestamp }}"
  day: "{{ today_at('08:00') | as_timestamp }}"
  evening: "{{ today_at('18:00') | as_timestamp }}"
  night: "{{ today_at('22:00') | as_timestamp }}"
  evening_brightness: 150
  at: "{{ today_at('20:00') | as_timestamp }}"
response_variable: curve

Fields

Field Required Description
at
Unix timestamp; default now
no The moment to work out the values for.
day, evening, morning, night
Unix timestamp
yes When each phase starts today. If night is earlier than morning, Night starts after midnight, and Evening runs until then.
<phase>_brightness
0–255; default Morning 255, Day 255, Evening 180, Night 80
no The phase’s brightness.
<phase>_brightness_transition
minutes, 0–1440; default Morning 60, Day 65, Evening 60, Night 30
no How long before the phase ends its brightness starts changing to the next phase’s.
<phase>_kelvin
Kelvin, 1000–10000; default Morning 6667, Day 6667, Evening 3200, Night 2700
no The phase’s colour temperature.
<phase>_kelvin_transition
minutes, 0–1440; default Morning 60, Day 1440, Evening 60, Night 30
no How long before the phase ends its colour temperature starts changing to the next phase’s.

<phase> is morning, day, evening or night, so evening_brightness is Evening’s brightness. The defaults are the values a new schedule starts with, and transitions explains how a transition shapes the curve.

Response data

  • phase: Morning, Day, Evening or Night.
  • brightness: The brightness, 0–255.
  • color_temp_kelvin: The colour temperature, in Kelvin.
  • rgb_color: The colour temperature converted to RGB, as [r, g, b].
phase: Evening
brightness: 150
color_temp_kelvin: 3200
rgb_color: [255, 184, 123]

flare.claims_check

Use this action to find out whether FLARE would leave each light alone, for lights you set yourself with override protection. It changes nothing.

action: flare.claims_check
data:
  entities: [light.kitchen_1]
response_variable: check

Fields

Field Required Description
entities
list of light entity IDs
yes The lights to check.
min_brightness_change
percent, 0–25; default from FLARE → Settings → Configure
no A light within this percentage of a claimed brightness, or 2 if that’s more, matches it.
min_color_temp_change
mireds, 0–50; default from FLARE → Settings → Configure
no A light within this many mireds of a claimed colour temperature matches it. For a claimed RGB colour, the channels’ differences added together can be up to twice this.

Response data

results is keyed by entity ID, and each entry has these fields:

  • blocked: true if FLARE would leave the entity alone.
  • status: controlled, overridden, mismatched, untracked, off or unavailable. See inspecting tracked state.
  • matched_via: Which claim the entity matched, and how: latest-context, latest-value, observed-context or observed-value. null if it matched neither.
  • rooms: The rooms the light is one of, by the room_id each named.
results:
  light.kitchen_1:
    blocked: false
    status: controlled
    matched_via: latest-context
    rooms: [automation.kitchen_lighting]

flare.claims_record

Use this action to record a change you’re about to make, so a later claims_check treats it as FLARE’s. Call it just before you change the entities, with the values you’re about to send.

action: flare.claims_record
data:
  entities: [light.kitchen_1]
  room_id: "{{ this.entity_id }}"
  targets:
    light.kitchen_1: { brightness: 200, color_temp_kelvin: 3000 }

Fields

Field Required Description
entities
list of light entity IDs
yes The lights you’re about to change.
room_entities
list of light entity IDs
no The room’s lights, as for apply_lighting.
room_id
text
yes The room to record the claim for, usually your automation: {{ this.entity_id }}.
targets
map of entity ID to values
no What you’re about to send each entity: brightness and either color_temp_kelvin or rgb_color.

Good to know

  • Without targets, the claim holds only the change’s context, which Home Assistant drops after five seconds. A bulb that’s slower than that to report back doesn’t match its claim, so it becomes overridden.
  • A light running an effect that keeps changing its colour won’t match its claim. Use a scene for it instead, or hand it over with a null brightness in the blueprint.

flare.claims_clear

Use this action to discard claims, so FLARE sets the entities again on its next update. It’s for a light that’s overridden in a room that never goes fully dark. FLARE’s Clear button does the same for every light.

action: flare.claims_clear
data:
  entities: [light.kitchen_1]

Fields

Field Required Description
entities
list of light entity IDs
yes The lights to clear.

Response data

Optional. cleared lists the entities that had a claim to discard.

flare.claims_override

Use this action to mark lights as changed by someone else, so FLARE leaves them alone.

You don’t usually need it. A light with a claim becomes overridden by itself once something else changes it and it stops matching its claim. It’s for lights with no claim yet, such as when your automation turns lights on in a dark room and you want FLARE to leave them as they are. Without it, they’re untracked, so the room’s next update sets them to the curve.

It marks each entity whether it’s on or off. A light marked this way stays overridden until its room goes dark, its claims are cleared, or a forced flare.apply_lighting takes it back. Flares call it before turning a room off or setting it to a brightness or colour.

action: flare.claims_override
data:
  entities: [light.kitchen_1]
  room_id: "{{ this.entity_id }}"

Fields

Field Required Description
entities
list of light entity IDs
yes The lights to mark.
room_entities
list of light entity IDs
no The room’s lights, as for apply_lighting.
room_id
text
yes The room that releases them once it’s dark, usually the automation driving them.

flare.compute_scene_coverage

Use this action to find out which of a set of lights a scene sets, so you can apply the scene and set the other lights yourself.

action: flare.compute_scene_coverage
data:
  scene_entity_id: scene.kitchen_night
  scope_entities: [light.kitchen_1, light.kitchen_2, light.kitchen_strip]
  target_entities: [light.kitchen_1, light.kitchen_2]
response_variable: coverage

Fields

Field Required Description
scene_entity_id
scene entity ID
yes The scene to check.
scope_entities
list of entity IDs
yes Every entity the scene is allowed to set, usually the room’s lights and other entities on the same devices.
target_entities
list of entity IDs
yes The lights to check.

Response data

  • scene_valid: true if the scene exists and every entity it sets is in scope_entities.
  • covered_entities: The entities the scene sets.
  • uncovered_entities: The entries in target_entities that the scene doesn’t set. If scene_valid is false, this is all of them.
scene_valid: true
covered_entities: [light.kitchen_1]
uncovered_entities: [light.kitchen_2]

flare.resolve_target

Use this action to get the list of entities that an action on a target would reach, such as the lights in an area.

action: flare.resolve_target
target:
  area_id: kitchen
response_variable: kitchen

Fields

It takes a target, as an action such as light.turn_on does: any mix of entity_id, device_id, area_id, floor_id and label_id.

Response data

  • entities: Every entity the target reaches, of any domain, sorted. Home Assistant decides which entities those are, in the same way as when you call an action on that target:
    • An entity you name directly is always included.
    • An entity reached through a device, area, floor or label is left out if it’s hidden.
    • An entity reached through a device, area or floor is also left out if it’s a configuration or diagnostic entity. If a label is on the entity itself, it’s kept.
entities: [binary_sensor.kitchen_motion, light.kitchen_1, light.kitchen_2]

flare.export_schedule

Use this action to get a schedule’s settings as YAML, in the format described under copying a schedule.

action: flare.export_schedule
data:
  schedule_device_id: "{{ device_id('sensor.home_flare') }}"
response_variable: exported

Fields

Field Required Description
schedule_device_id
schedule device ID
yes The schedule to export.

Response data

  • schedule: The schedule as YAML text, keyed by phase.

flare.import_schedule

Use this action to set a schedule from YAML, in the format described under copying a schedule.

action: flare.import_schedule
data:
  schedule_device_id: "{{ device_id('sensor.home_flare') }}"
  schedule:
    night:
      time: "23:00"

This moves the start of Night to 23:00 and leaves every other setting as it is.

Fields

Field Required Description
schedule
YAML text, or YAML written in the call
yes The settings to apply, keyed by phase. Any setting it leaves out keeps its current value.
schedule_device_id
schedule device ID
yes The schedule to set.

Good to know

  • If any part of schedule has an error, such as an unknown setting, an invalid time or a value out of range, none of it is applied, and the error message says what’s wrong.

Two-step bulbs

Some bulbs can’t change brightness and colour temperature in one command: they jump to the new value, or ignore one of the two. FLARE sends these bulbs two commands, brightness first and then colour, each taking half the transition. It recognises them in two ways:

  • By make and model, from the Two-step bulb models field under FLARE → Settings → Configure. It holds one pattern per line, matched case-insensitively against "<manufacturer> <model>", and * matches anything, so *TRADFRI bulb* and IKEA* both work. The field is pre-filled with FLARE’s default patterns. Your saved list replaces those defaults entirely, so you can remove a pattern as well as add one. If you save the field empty, FLARE uses the defaults again.
  • By label: give the light or its device a label created with the name no_combined_transition. FLARE matches the label’s ID, which comes from the name it was created with, so renaming another label to this won’t work.

Once you’ve saved your own list, a later FLARE release that adds a pattern won’t change it, so you’ll need to add new bulbs yourself. Keep patterns specific, because a bulb that doesn’t need two commands transitions less smoothly when it gets them.

In your own automations

If your lights already run on automations of your own, or in Node-RED or AppDaemon, you don’t have to replace them with the blueprint to get the curve and have hand-set lights left alone: anything that can call a Home Assistant action can call these services. The blueprint is one automation built on them.

Keeping a room on the curve

You need a schedule for the values. If you want FLARE to leave hand-set lights alone, pass the automation itself as the room. This keeps the kitchen on the curve:

alias: Kitchen lighting
triggers:
  - trigger: event
    event_type: flare_tick
    event_data:
      area_id: kitchen
conditions:
  - condition: template
    value_template: "{{ area_entities('kitchen') | select('match', '^light\\.') | select('is_state', 'on') | list | count > 0 }}"
actions:
  - action: flare.apply_lighting
    data:
      entities: "{{ area_entities('kitchen') | select('match', '^light\\.') | select('is_state', 'on') | list }}"
      brightness: "{{ state_attr('sensor.home_flare', 'brightness') }}"
      color_temp_kelvin: "{{ state_attr('sensor.home_flare', 'color_temp_kelvin') }}"
      transition: 5
      room_id: "{{ this.entity_id }}"
      room_entities: "{{ area_entities('kitchen') | select('match', '^light\\.') | list }}"

It runs on the kitchen’s tick and only passes lights that are on, since apply_lighting turns on everything it’s given. Turning the room on and off is left to you.

Sending the commands yourself

If you want to send light.turn_on yourself and still have FLARE leave hand-set lights alone:

  1. flare.claims_check to find out whether someone else has changed the light.
  2. flare.claims_record with what you’re about to send, so FLARE recognises it next time.
  3. Your own light.turn_on.

For example, this script sets the porch light to a warm 60%, unless someone has changed it since the script last set it:

alias: Porch light warm
sequence:
  - action: flare.claims_check
    data:
      entities: [light.porch]
    response_variable: check
  - condition: template
    value_template: "{{ not check.results['light.porch'].blocked }}"
  - action: flare.claims_record
    data:
      entities: [light.porch]
      room_id: "{{ this.entity_id }}"
      targets:
        light.porch: { brightness: 153, color_temp_kelvin: 2200 }
  - action: light.turn_on
    target:
      entity_id: light.porch
    data:
      brightness: 153
      color_temp_kelvin: 2200

targets needs the brightness and either color_temp_kelvin or rgb_color you’re sending. FLARE checks the light against it later, so a light running an effect that keeps changing its colour won’t be recognised. For that, use a scene or hand the light over with a null brightness in the blueprint instead.

If your automation turns lights off while some of the room’s lights stay on, use flare.turn_off; see flare.turn_off or light.turn_off?.


This site uses Just the Docs, a documentation theme for Jekyll.