From State when device isn't the trigger

Thank you, but how do I do this, I’ve been searching for ages

Have a look at the example in the documentation for Input Text. Your version will look something like this:

      - service: input_text.set_value
          entity_id: input_text.small_bedroom
          value: "{{ states('climate.small_bedroom') }}"

Thank you, I was reading that action as a result of the automation not as setting a variable.

It’s still not working, now the thermostat doesn’t turn back on.

          - if:
              - condition: template
                value_template: "{{ trigger.to_state.state == 'on' }}"
              - service: input_text.set_value
                  entity_id: input_text.bedroom
                  value: "{{ states('climate.bedroom') }}"
              - service: climate.set_hvac_mode
                  entity_id: climate.bedroom
                  hvac_mode: "off"
              - service: climate.set_hvac_mode
                  entity_id: climate.bedroom
                  hvac_mode:  "{{ states('input_text.bedroom') }}"

if I replace that last line with

                  hvac_mode:  heat

or cool , or fan_only, it turns back on in the mode I specified.

I have managed to work out other automations eventually, but this has me stumped at every turn

Go to Developer Tools > States and find input_text.bedroom. What is its state value?

Also, what is reported in the automation’s trace (the trace for the version where hvac_mode uses a template)?

No entities found for input_text.bedroom or input_text

in developer tools templates value: “{{ states(‘climate.bedroom’) }}” results in a string value: “heat”

Triggered by the state of light.bedroom_light at 30 March 2023 at 18:37:38
Choose: Option 1 executed
Stopped because an error was encountered at 30 March 2023 at 18:37:38 (runtime: 0.04 seconds)

expected HVACMode or one of 'off', 'heat', 'cool', 'heat_cool', 'auto', 'dry', 'fan_only' for dictionary value @ data['hvac_mode']

If there’s no entity called input_text.bedroom then it means you overlooked to create it before you referenced it in your automation.

That did it, it works in every thermostat mode.

My next task is to have it as 1 automation for all my therms & windows . I have a boost automation that handles all the therms, but it only has the 1 trigger , not 2 like this one :smiley: I think that’s for another day

Thank you for your patience

1 Like