i need help with a template that i’m trying to make:
this is the template:
ac_on:
friendly_name: AC
unit_of_measurement: 'On'
value_template: >
{% set total = 0 %}
{% if is_state('climate.mzgn_slvn', 'on') %}
{% set total = total + 1 %}
{% endif %}
{% if is_state('climate.mzgn_khdr_shynh', 'on') %}
{% set total = total + 1 %}
{% endif %}
{{total}}
So far so good, the only catch that i have is that i need is 2 more unit of measurement in to the same template beside the ‘On’ , the 2 are:
‘Cool’
‘Heat’
No, you can’t change units of measurement on the fly like that.
What you can do is create a sensor that displays your 3 different text values depending on the state of another entity
No, you don’t need 3 sensors you only need 1
What are your templates for generating your 3 sensors above ?
I assume that you are just using this for display purposes as you seem to have the ability to generate sensors on the 3 states ?
Are these mutually exclusive, i.e. can only 1 of these be on at any one time ?
If not is there a pattern ?
the template is for determine if the ac is on,
basically i have 3 modes: on, heat, cool
Than i present the entity as button in order to determine if the ac is on or not.
this is the sensor:
if the state of the ac is on, the state number will change to 1 as it should.
but if i turning on the ac from hassio to the state Cool, it will not change. it will stay 0 because i’m checking the unit_of_measurement: ‘On’ and not cool and heat.
Sorry, I think I have gotten the wrong end of the stick (I don’t understand you)
Are you trying to switch the Air Conditioner to one of 3 states : ‘on’, ‘cool’ and ‘heat’ ?
What about ‘off’ ?
Or are you trying to display what status the AC is currently in : On, Off, Heat, Cool ???
What entity is exposed into HA ?
When you query its states in the “developer tools” - “template” editor, what do you get ?
For example : -
When I ask to resolve - “{{ states.media_player.pi_nas01 }}”
(This is a media player entity on my system)
I get : -
“<template state media_player.pi_nas01=playing; volume_level=0.2, is_volume_muted=False, media_content_type=music, media_duration=334, media_position=93, media_position_updated_at=2019-10-07T14:29:42.041516+01:00, media_title=How Big, How Blue, How Beautiful, media_artist=Florence + The Machine, media_album_name=How Big, How Blue, How Beautiful, friendly_name=Pi-NAS01, entity_picture=/api/media_player_proxy/media_player.pi_nas01?token=5b3320d10be894f3400525b5a3bb620acf9566867585c6ef5bba494f8f1b6b4c&cache=90a17d8c8ef37274, supported_features=58303 @ 2019-10-07T09:27:13.051154+01:00>”
I’ll take you’re word for that. In North America, the word ‘air-conditoner’ (AC) implies it is only capable of cooling whereas ‘heat pump’ can do both (cool and heat).
This template selects all climate entities whose state is not off, counts and reports the result.
Another neat solution, I hadn’t appreciated the multiple states and when I did the intended template would have been very large.
Technically an air conditioner is a heat pump too.
Normally the smaller units just have a fan heater built in.
Otherwise they are fairly standard (compressor, expansion vessel, fan and piping between)
Here is an example : -
Technically speaking but, at least in North America, not practically if it doesn’t produce heat inside the dwelling. Like I said, a heat pump that doesn’t produce heat (inside) is (in NA) called an air-conditioner.
It’s not universal and the units are not of high capacity and you have to search hard for them. They are a bit of a half way solution though ideal for small rooms where the convenience of having two devices in one (high on a wall) is a major boon.
If you just said “Air Conditioner”, most people would assume it would only be capable of cooling.
And both technically and practically anything that takes heat from point A to point B is a heat pump, no matter the direction. Merely because your naming convention does not follow the actual science does not mean the principle does not apply. We’ve already covered that US names are not universally adopted.
Edit: Europe is just as guilty, heat pump is usually assumed to be ground heat recovery