Closed BradleyFord closed 4 months ago
Hi, sorry for late reply. As mentioned it is not possible to defined/create new hvac modes in HA. Therefore you need to map you function value into hardcoded hvac modes:
hvac_modes:
- "dry"
- "off"
- "cool"
- "fan_only"
shall become
hvac_modes:
- "dry"
- "off"
- "cool"
- "fan"
and you also need to make similar change in othe parts of your configuration like hvac_mode_template
and set_hvac_mode
Don't worry HA documentation was also misleading for me. Simply HVACMode.FAN_ONLY value is fan
and not fan_only
. I added list of modes into new version of readme to decrease this confusion. ;-)
Thank you for that.
I managed to get my templates working with some help from GravySeal; I have posted it below for anyone elses reference.
The key point in this example is that I am ready 2 seperate entities to determine on/off and the mode.
climate:
- platform: climate_template
unique_id: l1_ac_parents
name: L1_AC_parents
icon_template: mdi:air-conditioner
hvac_modes:
- "dry"
- "off"
- "cool"
- "fan"
swing_modes:
- "off"
- "vertical"
fan_modes:
- "auto"
- "low"
- "medium"
- "high"
min_temp: 24
max_temp: 30
current_temperature_template: "{{ states('sensor.bacnet_roomtemp_001') }}"
target_temperature_template: "{{ states('number.bacnet_tempadjust_001') }}"
hvac_mode_template: "{% if states('binary_sensor.bacnet_startstopstatus_001') == 'off' %}off{% elif states('sensor.bacnet_airconmodestatus_001') == '1' %}cool{% elif states('sensor.bacnet_airconmodestatus_001') == '3'%}fan{% elif states('sensor.bacnet_airconmodestatus_001') == '5'%}dry{% else %}off{% endif %}"
fan_mode_template: "{% if states('sensor.bacnet_airflowratestatus_001') == '4' %}auto{% elif states('sensor.bacnet_airflowratestatus_001') == '1'%}low{% elif states('sensor.bacnet_airflowratestatus_001') == '3'%}medium{% elif states('sensor.bacnet_airflowratestatus_001') == '2'%}high{% else %}off{% endif %}"
set_hvac_mode: # send the climates current state.
- service: select.select_option
target:
entity_id: select.bacnet_airconmodecommand_001
data:
option: "{% if hvac_mode == 'cool' %}1{% elif hvac_mode == 'fan' %}3{% elif hvac_mode == 'dry' %}5{% elif hvac_mode == 'off' %}1{% endif %}"
- service: "{% if hvac_mode == 'off' %}switch.turn_off{% else %}switch.turn_on{% endif %}"
target:
entity_id: switch.bacnet_startstopcommand_001
set_fan_mode: # send the climates current state.
- service: select.select_option
target:
entity_id: select.bacnet_airflowratecommand_001
data:
option: "{% if fan_mode == 'low' %}1{% elif fan_mode == 'medium' %}2{% elif fan_mode == 'high' %}3{% elif fan_mode == 'auto' %}4{% endif %}"
set_temperature:
- service: number.set_value
data:
value: "{{ temperature }}"
target:
entity_id: number.bacnet_tempadjust_001
The problem
I have data coming in via BACNET, of which all the ACs are coming into one huge device... that is NOT a climate entity. Hence I need to link my generic entities to the set_HVAC_mode, set_target_temperature, etc. In terms of reading in data everything is working perfectly
The challenge I am having is mapping the outputs back down to entities.
In the case of MODE, there are 2 entities:
Note that these entities are all numeric, hence I am using a template to convert the number into the respective text. I think my template to convert back to numeric is ok.
But some some reason nothing seems to be working... you can see the error that appears when I try to change mode.
The error is the same for set_fan_mode as well, but I know once I figure out set_hvac_mode it will be the same adjustments needed.
There is a seperate complication, but that is something to solve later. Essentially the entity for turning the AC on or off is seperate from the MODE setting.
What version of Template Climate has the issue?
Latest
What version of Home Assistant are you running?
Latest
What type of installation are you running?
Home Assistant OS
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
No response