Please help with automation

No now you need to figure out the next part. I.e. you didn’t change any of the entity_id’s in the template. Second, in a previous post, i mentioned that you’d need to change trigger.to_state.state to the correct entity. You haven’t done that.

  topeni:
    alias: 'Spousteni topeni'
    sequence:
      - service_template: >
          {% set t = trigger.to_state.state | float %}
          {% set state_a = is_state('switch.a', 'on') %}
          {% set state_b = is_state('switch.b', 'on') %}
          {% if t > 40 %}
            switch.turn_{{ 'off' if state_b else 'on' }}
          {% else %}
            switch.turn_{{ 'off' if state_a else 'on' }}
          {% endif %}
        data_template:
          entity_id: >
            {% set t = trigger.to_state.state | float %}
            {% set state_a = is_state('switch.a', 'on') %}
            {% set state_b = is_state('switch.b', 'on') %}
            {% if t > 40 %}
              switch.{{ 'b' if state_b else 'a' }}
            {% else %}
              switch.{{ 'a' if state_a else 'b' }}
            {% endif %}

OK, at least that’s a bit better.

Now see @petro’s last reply and fix those things next.

Now added temperature sensor which will provide temperature data:

  topeni:
    alias: 'Spousteni topeni'
    sequence:
      - service_template: >
          {% set t = sensor.aku_teplota | float %}
          {% set state_a = is_state('switch.a', 'on') %}
          {% set state_b = is_state('switch.b', 'on') %}
          {% if t > 40 %}
            switch.turn_{{ 'off' if state_b else 'on' }}
          {% else %}
            switch.turn_{{ 'off' if state_a else 'on' }}
          {% endif %}
        data_template:
          entity_id: >
            {% set t = sensor.aku_teplota | float %}
            {% set state_a = is_state('switch.a', 'on') %}
            {% set state_b = is_state('switch.b', 'on') %}
            {% if t > 40 %}
              switch.{{ 'b' if state_b else 'a' }}
            {% else %}
              switch.{{ 'a' if state_a else 'b' }}
            {% endif %}

No that won’t work either. :roll_eyes:

It’s getting tiresome at this point…

Ok, looking at the states templating docs, is this the correct way to get the state?

sensor.aku_teplota

Maybe you didn´t understood. I know I must change those “switch A and B” but I don´t have prepared real switches yet… will be done shortly… but I asked which “A´s” and “B´s” should change…maybe I will post config after switches will be prepared…

Fair enough, but you still didn’t answer my question here

sensor.aku_teplota is my temperature sensor which shows values like:

 sensor.aku_teplota	65.7	unit_of_measurement: °C
friendly_name: AKU teplota

Ok, again, did you click on the link and look at the docs ? It literally tells you how to properly get the state for a template. What you have is not correct.

Not to be disrespectful but I’m honestly shocked that you’ve been a member of this forum for over 3 years and we are having to lead you kicking and screaming towards the basics.

states.sensor.aku_teplota

Nope, read the docs again and try again. Hint it’s very close to what you found.

states(‘sensor.aku_teplota’)

You got it.

@petro Thank you very much for your help. I had to slightly modified my diagram. I forgot to watch yet another switch. Could you help me with script which will run as described here? I also added real names of switches used in diagram as A, B and C.

topeni-2

@petro please any idea?

I can’t speak for @petro (because I’m not a mind reader…) but I would think that the silence you are getting is because, even tho you have been a member of this forum (and so presumably using HA for almost as long) for over 3 years, you have no good grasp of the basics and still want other people to write the code for you without even trying it yourself.

And what’s worse is that even tho petro already kindly did that for you once you now come back again with just a minor modification to your flow chart above and again want others to write you a new set of code.

Just try to look at his code and figure it out. then try to write something with the new information in your flow chart.

Really, you’re going to have to put some effort into this yourself and try to learn how to do this. If you give it an honest effort and are truly stuck, I’m sure someone can help guide you in the right direction. Otherwise, no one wants to do all of the work for your system.

1 Like

Words, words, words… After I will find a solution I will share. As usually. Do you share yours or you just make words, words, words…?

Usually I share.

Unless someone shows that they aren’t interested in trying to figure things out at all on their own, then it becomes “just words, words, words”. And why would it be anything other than that if the person you are trying to help doesn’t have any interest in retaining the information so they don’t have to keep coming back asking for others to do all the work for them again. At that point “words, words, words” are just as useful to that person as the actual answer. And way easier to type.

I know for a fact that you’ve lost any interest in being helped by at least three people who are otherwise very generous with their time in helping others.

1 Like