Giter VIP home page Giter VIP logo

Comments (2)

Tonguc-Endem avatar Tonguc-Endem commented on May 31, 2024 1

Your problem is that when you're calling your services, you're using values from the template-cliame entity. However, at that point the climate entity is not holding the new values you've selected from the card interface. So you're just passing the unchanged value before you change it.

What you need to do is to use the specific variables provided by the template for the appropriate action you want to do.

here is a suggestion:

  set_temperature:
    - service: modbus.write_register
      data:
        hub: fancoil_hub
        slave: 2
        address: 231
        value: "{{ temperature | int * 10}}"

  set_hvac_mode:
    - service: modbus.write_register
      data:
        hub: fancoil_hub
        slave: 2
        address: 233
        value: |-
          {%- if hvac_mode ==  'heat' -%}
            3
          {%- else -%}
            5
          {%- endif -%}

  set_fan_mode:
    - service: modbus.write_register
      data:
        hub: fancoil_hub
        slave: 2
        address: 201
        value: >
          {% if fan_mode == 'auto') %}
          {{ states('sensor.fc_soggiorno_prg') | int | bitwise_and(65528) }}
          {% elif fan_mode == 'low') %}
          {{ states('sensor.fc_soggiorno_prg') | int | bitwise_and(65530) | bitwise_or(2) }}
          {% elif fan_mode == 'medium') %}
          {{ states('sensor.fc_soggiorno_prg') | int | bitwise_and(65529) | bitwise_or(1) }}
          {% else %}
          {{ states('sensor.fc_soggiorno_prg') | int | bitwise_and(65531) | bitwise_or(3) }}
          {% endif %}

  set_swing_mode:
    - service: modbus.write_register
      data:
        hub: fancoil_hub
        slave: 2
        address: 201
        value: >
          {% if swing_mode == 'on') %}
          {{ states('sensor.fc_soggiorno_prg') | int | bitwise_or(128) }}
          {% else %}
          {{ states('sensor.fc_soggiorno_prg') | int | bitwise_and(65407) }}
          {% endif %}

from hass-template-climate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.