thomasloven / lovelace-slider-entity-row

🔹 Add sliders to entity cards
MIT License
824 stars 130 forks source link

MQTT climate slider is not correct if min/max_temp are configured #271

Open HelgeBoehme opened 1 year ago

HelgeBoehme commented 1 year ago

My Home Assistant version: 2023.3.1 Frontend 20230302.0 - latest slider-entity-row: 17.3.0

My lovelace configuration method (GUI or yaml): both

What I am doing: I created integration from https://www.home-assistant.io/integrations/climate.mqtt/ and configured min and max_temp and step (in my case 7.5, 25 and 0.5). Then I added custom:slider-entity-row using that climate entity.

What I expected to happen: Slider swings between min and max value with configured step. On mouse-button-release, new value is submitted to entity.

What happened instead: Slider always jumps to max value +1 (26 in my case). Moving slider only shows integer value changes. After mouse-button-release, slider jumps back to max value. The max value (25) is submitted to the entity regardless from position of release. If I remove min/max_temp from the config, I can use the slider with the default range at integer steps.

For comparison I created input-number with the same range and step. Here everything works as expected.

Minimal steps to reproduce:

mqtt:
  climate:
    - name: Heizung Wohnzimmer
      object_id: comet_wohnzimmer
      unique_id: climate.comet_wohnzimmer
      temperature_unit: C
      initial: 7.5
      min_temp: 7.5
      max_temp: 25.0
      precision: 0.5
      temp_step: 0.5
[...]
input_number:
  comet_wohnzimmer_temp_set:
    name: Heizung Wohnzimmer
    min: 7.5
    max: 25
    step: 0.5
    unit_of_measurement: °C
    icon: mdi:thermometer
    cards:
      - type: entities
        entities:
          - entity: climate.comet_wohnzimmer
            type: custom:slider-entity-row
          - entity: input_number.comet_wohnzimmer_temp_set
            type: custom:slider-entity-row

image

Workaround: Adding same values to custom:slider-entity-row:

          - entity: climate.comet_wohnzimmer
            type: custom:slider-entity-row
            min: 7.5
            max: 25
            step: 0.5    

By putting an X in the boxes ([X]) below, I indicate that I:

thomasloven commented 12 months ago

Could you show what the attributes of your climate entity looks like in developer-tools/state ? Open your Home Assistant instance and show your state developer tools.

Something like this bild

HelgeBoehme commented 12 months ago

Hello Thomas, mine looks like this:

image

I'm still using the workaround from above.

thomasloven commented 12 months ago

That max_temp does not at all agree with the configuration code you posted. I suggest you start by finding out why that is.

HelgeBoehme commented 12 months ago

Hello Thomas, I just checked. My max_temp changed from 25.0 to 28.5 since I created the bug description. But I can still reproduce if I remove the workaround from my custom:slider-entity-row definition. FYI, the attributes window, keylock and topic are just added by json_attributes_template and do not interact with this bug. I'm still using version 17.3.0, and HA core 2023.3.6.