Can a !input in a blueprint be used in a data_template?


I’m new to HASS, and starting to automate “things”.

I’ve bought “Leroy Merlin” (ADEO)(zigbee) rgb light bulbs, which come with a remote, and I’m trying to correctly automate these…

I’m facing a couple of issues, but I’ll only talk about the remote issue for now.

I’ve downloaded a “philips hue dimmer switch” blueprint, which I’m trying to modify to handle the enki/adeo/lexman remote. That remote has way more buttons, and I’m trying for now to get the “step_hue” and “step_saturation” to work.

I successfully attached these buttons to ZHA events , but I’m failing in implementing a “step” for the hue and saturation as lights don’t have such services …

I tried with this :

  - conditions:
    - '{{ command == ''step_saturation'' }}'
    - '{{ cluster_id == 768 }}'
    - '{{ endpoint_id == 1 }}'
    - '{{ args == [1, 26, 5] }}'
    - service: light.turn_on
      target: !input 'light'
            - '{{state_attr(''!input light'' , ''hs_color'')[0]+10}}'
            - '{{state_attr(''!input light'', ''hs_color'')[1]}}'

But this gives me undef errors in the logs. I also tried to set a variable with the “!input light”, but then I’m getting yet another error…

AttributeError: ‘dict’ object has no attribute ‘lower’

So question : can the “!input” objects be used somehow in automation templates ?


No, put it in a single use variable and access it through the variable.

  my_var: !input myjunk


    somefield: "{{ state_attr(my_var ...

Also, my_var may be an object, so you might have to access properties inside it depending on what it is.


Ah thanks… at first I got the dict issue, but with this, it works :

- variables:
    thelight: !input 'light'

            - '{{state_attr(thelight["entity_id"], ''hs_color'')[0]+10}}'
            - '{{state_attr(thelight["entity_id"], ''hs_color'')[1]}}'
        transition: 0.001

Now, I’ll go on searching how to handle buttons when they are held pushed (to handle dimming while holding - the remote sends a “stop” event when the button is released)

Thanks && Regards !

you don’t need the [""] you can just get it like this:


So, final solution is (I will post my blueprint when it works ok :wink: ) :

- variables:
    thelight: !input 'light'
            - '{{state_attr(thelight.entity_id, ''hs_color'')[0]+20}}'
            - '{{state_attr(thelight.entity_id, ''hs_color'')[1]}}'
        transition: 0.001

Many thanks :]

1 Like

as a sidebar, it could also be done like this:

        hs_color: >
          {% set h, s = state_attr(thelight.entity_id, "hs_color") %}
          {{ [ h + 20, s ] }}