Open dpositive opened 3 years ago
+1 just starting to get my head around using the card, but preset is not mentioned anywhere here. p.s. also just discovered 'decluttering-card.js' - which is excellent as you can create a template for mini-climate, and then easily replicate for each (in my case radiator with TRV).
@dpositive - I have it working...
ok, so I have 'hijacked' fan_mode, hardcoded MY set of preset mode values, and used the climate service to set it on selection. Using fan_mode means that you can easily put the dropdown in 'secondary info'.
But also, see a similar 'button' dropdown. For me, this is less nice because you have to access it through the three dots expander.. but if you actually have 'fan_mode' in your heating/cooling system, then it may be a good option rather than hijacking fan_mode as preset_mode.
br,
Simon
you can use buttons
buttons:
preset_mode:
type: dropdown
location: main
icon: 'mdi:thermometer'
state:
attribute: preset_mode
active: state => state == 'comfort'
source:
eco: Fenster auf
sleep: Schlafen
away: Abwesend
comfort: Komfort
change_action: >
(selected, state, entity) => this.call_service('climate',
'set_preset_mode', { entity_id: entity.entity_id, preset_mode: selected })
Hi, I generally like the idea to use a button for the preset mode. However I would like to see the selected profile (name) on the card. I tried to show it somehow as an indicator. But I have no idea how I can define the attribute as an source for that. Anyone any idea?
from the docs:
First of all thanks for the prompt reply. However, I am still quite a newbie, copy/paste works pretty good for me, but mostly I don’t have a real understanding of the code. Therefore, could you give me a; example?I really don’t know what format of code / lines I have to use. I do have the entity (climate.badunten_hk8_2) the attribute is ‚preset-mode‘, how do I get this as source for the indicator and can specify naming for the different states of the preset-modes (day,night,auto) Would be great if you could help me out. Thanks
indicators:
preset_mode:
icon: 'mdi:approximately-equal'
source:
attribute: preset_mode
I strongly suggest to learn the yml files structure and syntax
If that doesn't work, try adding the entity
key with your entity next to the attribute
key
Yes, I amid you are right, 8 should learn more systematically about yaml;-) So far I am trying to do this by copy/paste learning by doing, so far quite effective. However, I tried to change the names of the presets, to make it more readable
preset_mode: icon: mdi:approximately-equal source: attribute: preset_mode values: Profile 1: normal Profile 2: Abgesenkt
but that doesn’t work, although it works similar for other indicators.
battery: icon: mdi:battery source: values: 'on': kritisch 'off': normal entity: binary_sensor.heizkorper_kinderzimmer_low_bat mapper: value => this.source.values[value]
Any idea?
Got it: (trial and error ;-) )
preset_mode: icon: mdi:approximately-equal source: values: boost: Heizprog. Maximal Profile 1: Heizprog. Automatik Profile 2: Heizprog. Abgesenkt Profile 3: Heizprog. Heizen None: Kein Prog gewählt attribute: preset_mode mapper: value => this.source.values[value]
that works! Thanks for the help and hopefully it will help others as well
Got it: (trial and error ;-) )
preset_mode: icon: mdi:approximately-equal source: values: boost: Heizprog. Maximal Profile 1: Heizprog. Automatik Profile 2: Heizprog. Abgesenkt Profile 3: Heizprog. Heizen None: Kein Prog gewählt attribute: preset_mode mapper: value => this.source.values[value]
that works! Thanks for the help and hopefully it will help others as well
another tip - read this on how to present code in github comment so it will readable
Thanks, will try to observe. Much to learn for an old man ;-) My last coding ,experience, was basic, well, yes some years ago 😂
I have a problem with displaying icons in hvac_mode. In this case, The mode selection works in preset_mode. Where is the mistake?
hvac_mode: source: comfort: name: Комфотр icon: mdi:home-thermometer-outline sleep: name: Ночью icon: mdi:power-sleep away: name: Нет Дома icon: mdi:exit-run none: name: Выключено icon: mdi:home-off-outline change_action: | (selected, entity) => this.call_service('climate', 'set_preset_mode', { entity_id: entity.entity_id, preset_mode: selected })
what is the state of your entity? It seems that is is not one of the values you provided in source...
I would like to see the current preset and change it, but I don’t know how to get the preset information.