Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Row of buttons for preset modes ? #153

Open
cartoristal opened this issue Jun 12, 2024 · 3 comments
Open

Row of buttons for preset modes ? #153

cartoristal opened this issue Jun 12, 2024 · 3 comments

Comments

@cartoristal
Copy link

Hello! First of all : loving this card, it is great. I succcessfully managed to get a button leading to a dropdown to select the preset mode. I am wondering if there is a possibility to get a row of buttons instead ? I can only manage to have one toggle-button, but not multiple buttons (one for each preset mode).

Thanks !

type: custom:mini-climate 
entity: climate.pass_actuator_3
temperature:
  unit: °C
  round: 1
  source:
    entity: sensor.indoor_outdoor_meter_36c7
buttons:
  preset_mode:
    type: dropdown
    location: main
    icon: mdi:thermometer
    state:
      attribute: preset_mode
    active: state => state == 'comfort'
    source:
      frost_protection: frost_protection
      comfort: comfort
      comfort-1: comfort-1
    change_action: >
      (selected, state, entity) => this.call_service('climate',
      'set_preset_mode', { entity_id: entity.entity_id, preset_mode: selected })
@regevbr
Copy link
Collaborator

regevbr commented Jun 13, 2024

Here is an example:

image

type: custom:mini-climate
entity: climate.living_room
toggle:
  default: true
buttons:
  cool:
    icon: mdi:snowflake
    state:
      mapper: |
        (state) => state === 'cool' ? 'on' : 'off'
    toggle_action: >
      (state, entity) => this.call_service('climate', 'set_preset_mode', {
      entity_id: entity.entity_id, preset_mode: 'cool' })
  heat:
    icon: mdi:weather-sunny-alert
    state:
      mapper: |
        (state) => state === 'heat' ? 'on' : 'off'
    toggle_action: >
      (state, entity) => this.call_service('climate', 'set_preset_mode', {
      entity_id: entity.entity_id, preset_mode: 'heat' })

@cartoristal
Copy link
Author

cartoristal commented Jun 13, 2024

Amazing !
Thank you so much for taking the time : it works like a charm 👍

Still trying to figure out how to add the name of the currently selected preset (eco, frost_protection, comfort-2, comfort-1, comfort...) in an indicator. If you know how to do it - super interested in your thoughts. Otherwise, will keep looking and come back here with the solution

@giggo
Copy link

giggo commented Nov 20, 2024

I would be interested in a solution for names as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants