Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 107786

Trigger.to_state to variable?

$
0
0

Hi everybody,

I am trying to convert multiple automations into one, using trigger.to_state to determine what is supposed to happen.

alias: Triggertest
description: ""
triggers:
  - trigger: time
    at: input_datetime.triggertest_az_00
  - trigger: time
    at: input_datetime.triggertest_az_01
  - trigger: time
    at: input_datetime.triggertest_wz_00
  - trigger: time
    at: input_datetime.triggertest_wz_01
conditions: []
actions:
  - variables: {}
mode: single

How do I go from here? I would like to use input_number.set_value, where the pattern is input_number.triggertest_az_00, input_number.triggertest_az_01, input_number.triggertest_wz_00, input_number.triggertest_wz_01, depending on the entity_id of the input_datetime, which triggers this automation.

Concrete example:

if triggered by input_datetime.triggertest_az_00, then input_number.set_value the entity input_number.triggertest_az_current to the value of input_number.triggertest_az_00. Then, of course:

if triggered by input_datetime.triggertest_wz_01, then input_number.set_value the entity input_number.triggertest_wz_current to the value of input_number.triggertest_wz_01.

So always set xyz_current (where xyz is the abbreviation for the room) to the input_numbers state, which it gets from the input_datetimes entity id.

Basically, what’s going on here is that at certain I want climate entities to be set to specific values. There is always (...)_00 up to (...)_04 per room. Currently, these are all separate automations - and they are using trigger ids.

However, this seems like a case for trigger.to_(...), right? I just can’t figure out how to do it.

Hopefully I have explained this in a way people can understand. If not, sorry, please ask and I’ll try my best to clearify.

Thank you in advance for your help :slight_smile:

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 107786

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>