artem-sedykh / mini-humidifier

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

Support for deerma.humidifier.mjjsq #18

Closed x6ryK3Bomur6hm closed 4 years ago

x6ryK3Bomur6hm commented 4 years ago

I am using the custom HACS component Xiaomi Mi Air Purifier to integrate my Xiaomi Mijia SCK0A45 humidifier (model: deerma.humidifier.mjjsq). It works great, but now I want a nice frontend with this card.

Unfortunately, I added the card but nothing happens. No errors but no card shows up.

Can you add support for this model humidifier? Many thanks!

artem-sedykh commented 4 years ago

I can add full customization of the map, i.e. each indicator and button will be configured for any service and sending values. Now I’m making a card for my air conditioner, there will be such functionality, I will add it later for a humidifier

That's what I get for an air conditioner:

- type: custom:mini-climate
  entity: climate.dahatsu
  indicators:
    humidity:
      icon: mdi:water
      unit: '%'
      fixed: 1
      source:
        entity: sensor.sensor_temp_hum_pre_kitchen_humidity
    power_consumption:
      icon: mdi:flash
      unit: 'W'
      fixed: 1
      source:
        entity: sensor.dahatsu_power
#.......... othre custom indicators
  buttons:
    light:
    icon: mdi:lightbulb-on-outline
    state:
      attribute: light
    turn_off:
      service: mqtt.publish
      data:
        topic: dahatsu/light/set
        payload: off
        retain: false
        qos: 1
#.......... othre buttons

image

What do you think of this configuration?

x6ryK3Bomur6hm commented 4 years ago

Looks great! very clean and informative. Color changes of the icons based on the on/off status etc would be nice as well.

artem-sedykh commented 4 years ago

so, I almost finished with a card for the air conditioner mini-climate-card
customization of the behavior of the buttons will be off with this plugin.
You can completely set your own behavior and data source for each button and indicator

x6ryK3Bomur6hm commented 4 years ago

Hi, I tried the mini-climate card, but it gives me the error: Specify an entity from within the fan domain.

My config:

artem-sedykh commented 4 years ago

Hi! this card only supports climate domain, deerma.humidifier.mjjsq for deerma.humidifier.mjjsq I am currently completing a mini-humidifier plugin, configuration will be similar to mini-climate-card.
thanks for the error! I will correct the text, there should be a climate.

artem-sedykh commented 4 years ago

Added the ability to customize the plugin to configure other humidifiers. v2.0.1 Read readme file, there will be questions write to me.

x6ryK3Bomur6hm commented 4 years ago

Thanks! Looks great.

For me, the line: return this.call_service('xiaomi_miio', 'fan_set_target_humidity', options); Should be: return this.call_service('fan', 'xiaomi_miio_set_target_humidity', options); Otherwise it wouldn't work. The service call it calls for me is fan.xiaomi_miio_set_target_humidity.

I have a question on the depth indicator. My humidifier does not have a 'depth' attribute, but it does have a 'no water' attribute that can be either true or false. It is possible to rework the depth indicator into an indicator showing that the water tank is empty?

artem-sedykh commented 4 years ago

I made a plugin so you can reconfigure everything as you need.
In readme it is written how to hide the indicator and add a new one, and there is also a sorting setting.

- type: custom:mini-humidifier
  entity: fan.xiaomi_miio_device
  indicators:
    depth:
      hide: on
    power:
      icon: mdi:power-plug
      source:
        values:
          'on': 'power is on!'
          'off': 'power is off!'
        entity: switch.ac_power
        # since the current execution context is an indicator config, we can use this.source.values to get values
        mapper: value => this.source.values[value]
- type: custom:mini-humidifier
  entity: fan.xiaomi_miio_device
  indicators:
    depth:
      hide: on
#custom attribute example
    power:
      icon: mdi:power-plug
     #sort order
      order: 0
      source:
        values:
          'true': 'power is on!'
          'false': 'power is off!'
        attribute: custom_power_attribute
        # since the current execution context is an indicator config, we can use this.source.values to get values
        mapper: value => this.source.values[value]

As you configure everything, you can throw off your config, add it to readme.

x6ryK3Bomur6hm commented 4 years ago

Thanks, managed it!

I made a config as clean as possible, may still change it in future but like this card very much. Attached my config for anyone perhaps interested. My humidifier type is deerma.humidifier.mjjsq

humidifier config.txt

artem-sedykh commented 4 years ago

Version 2.2.2 is released. The default configuration for deerma.humidifier.mjjsq is available.