Comments (5)
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.
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.
@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.
Yes, this would help. This was my first solution. But then I wrote my own script using Pyscript.
from ha-dual-smart-thermostat.
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)
- [feat] validate preset modes by target temperatures Failed to call service climate/set_preset_mode... HOT 2
- Ccurrently the heat/cool fuction is not working with the fan-mode HOT 4
- EventType and StrEnum was deprecated ....in HA Core 20255. HOT 1
- "latest beta" unable to set hvac mode after selecting preset HOT 5
- Fan hot tolerance issue HOT 13
- [Bug?] Set temps don't restore on HA boot if a preset is set when HA restarts HOT 5
- [Request] Set temperature value based on target_temp_* values when switching HVAC_Mode while Preset is set HOT 3
- Invalid HVAC mode: None HOT 8
- can tolerance values be linked to input_number? HOT 1
- run blower fan for circulation HOT 6
- Feature Request: Enable/disable fan_hot_tolerance based on outside air temperature HOT 3
- Fan speed HOT 7
- Support dry mode HOT 4
- Update Bug HOT 1
- Expose some settings via entity id's. HOT 12
- Preset selection not removed when manually changing target temp HOT 3
- Typo In An Example YAML In Installation Section
- [BUG] Component won't run on Core v2024.3.1 - config warns about exception HOT 2
- disable Heat/Cool Mode HOT 6
- Always turn on Cool, regardless of last mode and doesn't revert to mode if HASS is restarted, not turn off when HASS shuts down HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ha-dual-smart-thermostat.