rogro82 / hass-variables

Home Assistant variables component

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: Template inside a variable

poudenes opened this issue · comments

Hi All,

Is it possible to do something like this:

adaptive_kelvin:
    value: "{{ states.switch.adaptive_lighting_sensor.attributes.color_temp_kelvin | round(0)}}"
    attributes:
      friendly_name: 'Adaptive Kelvin'
      icon: mdi:theme-light-dark

And use this variable "adaptive_kelvin" into automation? something like this:

- service: light.turn_on
   data:
     entity_id: light.livingroom_all
     brightness_pct: 100
     kelvin: "{{ [variable.adaptive_kelvin] }}"

kind regards,

Nobody can tell me if this is possible?

Have you tried?

Using states of the variables in my automations here without issues

Have you tried?

Using states of the variables in my automations here without issues

Can you show me some code? I tried some things but im not that good in coding.. hehe

states.switch.adaptive_lighting_sensor.attributes.color_temp_kelvin should be something like:
state_attr('switch.adaptive_lighting_sensor.attributes','color_temp_kelvin')
Look at https://www.home-assistant.io/docs/configuration/templating#states