Git Product home page Git Product logo

Comments (5)

ALERTua avatar ALERTua commented on June 12, 2024 2

https://gist.github.com/ALERTua/0e89f5279dd0e1de7ee270c9e718d8d2
based on https://github.com/custom-components/pyscript and https://github.com/ALERTua/ha_pyscript_modules

from ha-dual-smart-thermostat.

dugancom avatar dugancom commented on June 12, 2024

Hello, this was my need too but it doesn't seem that the component is designed to control one unit that has both a heat and cool function. My attempt was to set both the heater and cooler parameters to the same switch but it seems like it only uses the first one.

from ha-dual-smart-thermostat.

neoKushan avatar neoKushan commented on June 12, 2024

@ALERTua @dugancom does this help? I had the same issue as you guys (plus another annoying issue), I wanted to use this component to control an AC unit that I use for both heating and cooling, but with an external sensor because the one in the Unit is borderline useless.

To do this, I created two template switches that control the AC unit in different ways:

- platform: template
  switches:
    office_aircon_cool:
      value_template: "{{is_state('climate.office_ac', 'cool')}}"
      turn_on:
        - service: climate.set_hvac_mode
          data:
            hvac_mode: cool
          target:
            entity_id: climate.office_ac
        - service: climate.set_temperature
          data:
            hvac_mode: cool
            temperature: "{{state_attr('climate.office_smart_thermostat', 'target_temp_low') | round(0, 'floor') }}"
          target:
            entity_id: climate.office_ac
      turn_off:
        service: climate.set_hvac_mode
        data:
          hvac_mode: "fan_only"
        target:
          entity_id: climate.office_ac
    office_aircon_heat:
      value_template: "{{is_state('climate.office_ac', 'heat')}}"
      turn_on:
        - service: climate.set_hvac_mode
          data:
            hvac_mode: heat
          target:
            entity_id: climate.office_ac
        - service: climate.set_temperature
          data:
            hvac_mode: heat
            temperature: "{{state_attr('climate.office_smart_thermostat', 'target_temp_high') | round(0, 'ceiling') }}"
          target:
            entity_id: climate.office_ac
      turn_off:
        service: climate.set_hvac_mode
        data:
          hvac_mode: "fan_only"
        target:
          entity_id: climate.office_ac

A couple of things to note here, as it might not be relevant to you:

My AC is really stupid, when you power it off it won't accept additional commands until it has done its power-off-clean-cycle, which can take up to 20mins to do - not ideal when I just want it to keep the temperature in check, so for these switches the "Off" function just sets the AC to fan-only mode, which will let it quickly switch back to heat or cool mode when it needs to.

My AC's built-in temperature sensor is also terrible but it tries to use it regardless, so in order to get it to actually heat or cool based off of the external temperature, I set the target temperature in the service call to a rounded number (up if heating, down if cooling) - so if you set the temperature to say 22.4, it'll be 22 in cooling mode or 23 in heating mode

Finally, with those two switches defined, I use them in this dual smart thermostat like so:

climate:
  - platform: dual_smart_thermostat
    name: Office smart Thermostat
    heater: switch.office_aircon_heat
    cooler: switch.office_aircon_cool
    target_sensor: sensor.lumi_lumi_weather_temperature
    min_temp: 18
    max_temp: 26
    target_temp: 22
    target_temp_high: 22.0
    target_temp_low: 21.0
    cold_tolerance: 0.3
    hot_tolerance: 0.3
    min_cycle_duration:
      seconds: 5
    initial_hvac_mode: "heat_cool" # hvac mode will reset to this value after restart
    heat_cool_mode: true
    keep_alive:
      minutes: 3
    away: # this preset will be available for all hvac modes
      temperature: 7
      target_temp_low: 7
      target_temp_high: 30
    anti_freeze: # this preset will be available for all hvac modes
      temperature: 7
      target_temp_low: 7
      target_temp_high: 30
    comfort: # this preset will be available for all hvac modes
      temperature: 22
      target_temp_low: 21.0
      target_temp_high: 22.0
    home: # this preset will be available only for heat or cool hvac mode
      temperature: 21
    precision: 0.1

I have defined the anti_freeze and away profile for scheduling purposes, they're just there to effectively turn the AC off because I can't find a good way to actually switch it off since the "off" mode in both is defined as fan mode. Hope all that makes sense.

from ha-dual-smart-thermostat.

ALERTua avatar ALERTua commented on June 12, 2024

Yes, this would help. This was my first solution. But then I wrote my own script using Pyscript.

from ha-dual-smart-thermostat.

neoKushan avatar neoKushan commented on June 12, 2024

I'd be interested in learning more about your solution, @ALERTua, if you have something you're able to share?

from ha-dual-smart-thermostat.

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.