Giter VIP home page Giter VIP logo

Comments (10)

harisma-git avatar harisma-git commented on May 31, 2024 3

I have exact the same problem. I dont think this is normal :/

from hass-template-climate.

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

You can pass a variable to a script when you call it in Home Assistant.

let's consider we have the following script:

# Example script
script:
  my_script:
    sequence:
      - service: notify.mobile_app
        data:
          message: "Received value: {{ value }}"

Now let's call the above example script with an automation and pass a value in a variable:

automation:
  - alias: Call Script with Variable
    trigger:
      platform: state
      entity_id: binary_sensor.motion_sensor
      to: 'on'
    action:
      - service: script.turn_on
        entity_id: script.my_script
        data_template:
          value: "Hello, World!"

So in the case of the set_hvac_mode you'll do something like this:

    set_hvac_mode:
      - service: script.turn_on
        entity_id: script.my_script
        data_template:
          value: "{{ hvac_mode }}"

I hope this helps.

from hass-template-climate.

tchlyah avatar tchlyah commented on May 31, 2024 1

@harisma-git I have the same issue, have you been able to find a way to do it ?

from hass-template-climate.

elliotwestlake avatar elliotwestlake commented on May 31, 2024

The way you can do this is by using the variable that gets exposed to the action:

    set_hvac_mode:
      - service: esphome.bedroom
        data:
          hvac_mode: "{{ hvac_mode }}"

Actions are essentially scripts, and they expose variables for you to use.

Hope this helps!

from hass-template-climate.

harisma-git avatar harisma-git commented on May 31, 2024

The way you can do this is by using the variable that gets exposed to the action:

    set_hvac_mode:
      - service: esphome.bedroom
        data:
          hvac_mode: "{{ hvac_mode }}"

Actions are essentially scripts, and they expose variables for you to use.

Hope this helps!

But how can i achieve this when i calling a script to set the hvac mode? I use this integration to send commands to a knx bus, without hvac_mode_template i call a script and the commands to knx are working fine but i dont have synchronization with wall mounts controllers of the aircondition. When i use hvac_mode_template i have the synchronization but i can not command them (run the scripts). Any idea would be extremely helpfully.

from hass-template-climate.

harisma-git avatar harisma-git commented on May 31, 2024

Unfortunately, no. I have it without synchronization :/

from hass-template-climate.

tchlyah avatar tchlyah commented on May 31, 2024

Unfortunately, no. I have it without synchronization :/

Thanks @harisma-git.

@jcwillox any ideas ?

from hass-template-climate.

jabronimus avatar jabronimus commented on May 31, 2024

@Tonguc-Endem I dont think this is SUPPOSED to be how this works, but it does seem to work!

from hass-template-climate.

meute avatar meute commented on May 31, 2024

@harisma-git I have the same issue, have you been able to find a way to do it ?

Same issue for me

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.