artem-sedykh / mini-humidifier

Minimalistic humidifier card for Home Assistant Lovelace UI
MIT License
156 stars 26 forks source link

Target humidity slider does not appear for MQTT humidifier #70

Open ivlis opened 3 years ago

ivlis commented 3 years ago

I'm trying to get an MQTT dehumidifier working with this card (https://www.home-assistant.io/integrations/humidifier.mqtt/).

After configuration, the target humidity slider won't appear on the card. My Tasmota-based no-frills dehumidifier does not have any modes, just an on/off and humidity setting.

Here is my config:

type: custom:mini-humidifier
entity: humidifier.basement_dehumidifier
power:
  type: toggle
indicators:
  humidity:
    icon: mdi:water
    unit: '%'
    source:
      entity: sensor.basement_climate_humidity
  temperature:
    source:
      entity: sensor.basement_climate_temperature
target_humidity:
  hide: 'off'
  unit: '%'
  min: 10
  max: 80
  step: 5
  attribute: humidity
  mapper: (current_value, entity, humidifier_entity) => current_value
  change_action: |
    (selected, state, entity) => {
      const options = { entity_id: entity.entity_id, humidity: selected };
      return this.call_service('humidifier', 'set_humidity', options);
    }

Here is how the card looks like:

image

HA Version: 2021.9.5

alexschwantes commented 3 years ago

I had the same issue using a Generic Hygrostat in HA. Your question actually helped me along the way to find a fix for it.

Essentially you need to add the following undocumented setting for it to show

target_humidity:
  disabled: false

Also, note that you have hide: 'off' when it should be hide: false

I found this setting by looking at the code here https://github.com/artem-sedykh/mini-humidifier/blob/master/src/configurations/xiaomi_miio/zhimi_humidifier_cb1.js which had a disabled setting for the target_humidity.

Also, I got it working without including the change_action setting

target_humidity:
  icon: mdi:water
  unit: '%'
  min: 30
  max: 80
  step: 10
  hide: false
  hide_indicator: false
  disabled: false
  state:
    attribute: humidity