I’m trying to create a ‘dummy’ light in Home Assistant that I can expose to Alexa. The intention is to make this dummy light do different things depending on which Alexa device was ‘last called’. Similar to an Alexa-enabled group (native to the Alexa app) containing an Alexa device and one or more lights, but I want to use a different word other than ‘lights’ (I want to use ‘lights’ for lamps, and ‘main lights’ for ceiling lights).
I’ve achieved this already with a simple on/off, and some input button helpers and a couple of automations, but I want to include brightness as well, hence wanting to use a light template entity.
All I want is to trigger an input_button helper when it’s turned on, another input_button helper when it’s turned off, and set the value of an input_number helper when the brightness is changed. I don’t need to track the on/off state.
Here’s what I have so far:
light:
- platform: template
lights:
context_light:
friendly_name: "Context-Sensitive Light"
turn_on:
service: input_button.press
data:
entity_id: input_button.context_aware_main_light_on
turn_off:
service: input_button.press
data:
entity_id: input_button.context_aware_main_light_off
set_level:
service: input_number.set_value
data:
entity_id: input_number.context_aware_light_brightness
brightness: "{{ states('input_number.context_aware_light_brightness') | int }}"
The input number helper is configured with a min value of 0, max of 255 with step of 1.
Turning the light on/off successfully triggers an automation that performs a different action depending on which Alexa was ‘last called’. However, setting the brightness does not work - instead I get the below error:
Any idea where I’m going wrong? Thanks in advance.