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

Add support for deerma.humidifier.jsq2w #381

Open
mrbaloghakos opened this issue Oct 8, 2024 · 27 comments
Open

Add support for deerma.humidifier.jsq2w #381

mrbaloghakos opened this issue Oct 8, 2024 · 27 comments

Comments

@mrbaloghakos
Copy link

Xiaomi Smart Humidifier 2
https://www.mi.com/global/product/xiaomi-smart-humidifier-2/specs

@mrbaloghakos
Copy link
Author

Logger: homeassistant.components.xiaomi_miio
Source: components/xiaomi_miio/init.py:162
integration: Xiaomi Miio (documentation, issues)
First occurred: 10:06:55 PM (1 occurrences)
Last logged: 10:06:55 PM

Unsupported device found! Please create an issue at https://github.com/syssi/xiaomi_airpurifier/issues and provide the following data: deerma.humidifier.jsq2w

@michael-hermsen
Copy link

For me the same

Logger: homeassistant.components.xiaomi_miio
Bron: components/xiaomi_miio/init.py:162
integratie: Xiaomi Miio (documentatie, problemen)
Eerst voorgekomen: 08:34:47 (1 gebeurtenissen)
Laatst gelogd: 08:34:47

Unsupported device found! Please create an issue at https://github.com/syssi/xiaomi_airpurifier/issues and provide the following data: deerma.humidifier.jsq2w

@fbarriga
Copy link

Same here

@msmitka
Copy link

msmitka commented Oct 14, 2024

Same

@ostgardh
Copy link

ostgardh commented Oct 15, 2024

same

@barnabas-kovacs
Copy link

Same here. Many Thanks!

@saschachina
Copy link

I don't think anyone will do anything here, they always refer to the custom component (https://github.com/syssi/xiaomi_airpurifier), see also #361

@syssi
Copy link
Owner

syssi commented Oct 20, 2024

The device is supported here. What do you miss?

@saschachina
Copy link

The device is supported here. What do you miss?

The .jsqs is supported not the .jsq2w

Logger: miio.miot_device
Quelle: /usr/local/lib/python3.12/site-packages/miio/miot_device.py:172
Erstmals aufgetreten: 16:54:59 (2 Vorkommnisse)
Zuletzt protokolliert: 16:55:29

Unable to find mapping for deerma.humidifier.jsq2w, falling back to deerma.humidifier.jsqs

@syssi
Copy link
Owner

syssi commented Oct 22, 2024

If you use this custom component instead of the official one the device is supported.

@saschachina
Copy link

If you use this custom component instead of the official one the device is supported.

Just so I understand, you say .jsq2w is supported by the custom component, then why do I get a warning in the logs like I showed before? I know that the device is not supported in the official integration so I am forced to use the custom component.

Another question, why is it not possible to integrate the device in the official integration?

@syssi
Copy link
Owner

syssi commented Oct 23, 2024

Just so I understand, you say .jsq2w is supported by the custom component, then why do I get a warning in the logs like I showed before? I know that the device is not supported in the official integration so I am forced to use the custom component.

The users above are using the offical component:

Source: components/xiaomi_miio/init.py:162

Another question, why is it not possible to integrate the device in the official integration?

It is possible but it takes a lot of time per model and there are so many different models available. Furthermore it requires a lot of testing (using the real hardware in best case). In best case a owner of the device should take over and do the job.

@saschachina
Copy link

Just so I understand, you say .jsq2w is supported by the custom component, then why do I get a warning in the logs like I showed before? I know that the device is not supported in the official integration so I am forced to use the custom component.

The users above are using the offical component:

Source: components/xiaomi_miio/init.py:162

Another question, why is it not possible to integrate the device in the official integration?

It is possible but it takes a lot of time per model and there are so many different models available. Furthermore it requires a lot of testing (using the real hardware in best case). In best case a owner of the device should take over and do the job.

First of all, i would like to thank you and everyone who invests time and effort in our smart home, i really appreciate it and am very grateful.

I also understand that a new device can't be integrated straight away because it requires a lot of work and someone has to have the device on site.

The .jsqs already works, I don't know much about it but I think only minor adjustments are necessary for the .jsq2w.

Unfortunately I don't have the skills to read out anything, I can only support with testing.

@franqenstein
Copy link

Also stuck with this problem, please help to fix )

deerma.humidifier.jsq2w

im also here if someone need to test something

@i4mr000t
Copy link

i4mr000t commented Dec 3, 2024

  1. Install this Integration from HACS:
    image
  2. Download this Token Extractor Tool: https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor/releases/latest/download/token_extractor.exe
  3. Enter Username, Password (from Xiaomi APP) and DONT CHOOSE A SERVER so its checking all available Servers (I got 3 different tokens, notice all).
  4. go into your configuration.yaml File and enter:
fan:
  - platform: xiaomi_miio_airpurifier
    name: Xiaomi Smart Humidifier 2
    host: <YOUR_IP_OF_HUMIDIFIER>
    token: <ONE_OF_THE_TOKENS_YOU_NOTICED_FROM_THE_SCRIPT>
    model: deerma.humidifier.jsq2w
  1. Restart Homeassistant and Enjoy! :-)

INFO: I had to try different tokens, one was working and i can control the humidifier now.
Try all Tokens you received from point 2, if one is not working start with point 4 again and replace the token with another one. Restart Homeassistant and check again if its working.

@franqenstein
Copy link

@i4mr000t thank for your respones.

Plese tell me is there any way to make ha identify it as humidifier ?

Now its working just as fan

@i4mr000t
Copy link

i4mr000t commented Dec 4, 2024

@i4mr000t thank for your respones.

Plese tell me is there any way to make ha identify it as humidifier ?

Now its working just as fan

Your Welcome! :-)
Im not really sure what you mean but I think no because you cannot declare it as humidifier the integration doesnt allow this.

But maybe you can do some template sensor to get what you want. There are attributes in this fan entity.

For example:

platform: template
sensors:
  airpurifier_temperature:
    friendly_name: Xiaomi Smart Humidifier 2 Temperature
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.temperature }}"
    unit_of_measurement: "°C"
  airpurifier_humidity:
    friendly_name: Xiaomi Smart Humidifier 2 Humidity
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.humidity }}"
    unit_of_measurement: "%"
    icon_template: mdi:water-percent
  airpurifier_model:
    friendly_name: Xiaomi Smart Humidifier 2 Model
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.model }}"
  airpurifier_mode:
    friendly_name: Xiaomi Smart Humidifier 2 Mode
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.mode }}"
    icon_template: mdi:auto-mode
  airpurifier_buzzer:
    friendly_name: Xiaomi Smart Humidifier 2 Buzzer
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.buzzer }}"
    icon_template: mdi:volume-high
  airpurifier_target_humidity:
    friendly_name: Xiaomi Smart Humidifier 2 Target Humidity
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.target_humidity }}"
    icon_template: mdi:water-percent
    unit_of_measurement: "%"
  airpurifier_led:
    friendly_name: Xiaomi Smart Humidifier 2 LED
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.led }}"
    icon_template: mdi:lightbulb
  airpurifier_no_water:
    friendly_name: Xiaomi Smart Humidifier 2 No Water
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.no_water }}"
    icon_template: mdi:water
  airpurifier_water_tank_detached:
    friendly_name: Xiaomi Smart Humidifier 2 Watertank Detached
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.water_tank_detached }}"
    icon_template: mdi:storage-tank-outline
  airpurifier_water_wet_protection:
    friendly_name: Xiaomi Smart Humidifier 2 Water Protection
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.wet_protection }}"
    icon_template: mdi:water-off-outline

INFO:
{{ states.<THIS_HAVE_TO_BE_YOUR_ENTITY_YOU_SET_BEFORE_IN_YOUR_CONFIGURATION.YAML>.attributes.temperature }}

INFO 2:
I separated my template sensors in homeassistant from configuration.yaml. if you haven't you need to change the following code a little bit.

In configuration.yaml:

sensor:
  - platform: template
    sensors:
      airpurifier_aqi:
        friendly_name: Air Purifier Air Quality Index
        value_template: '{{ states.fan.xiaomi_air_purifier.attributes.aqi }}'          <---- You need to change that (read INFO)
        icon_template: mdi:weather-windy

Then you have different template sensors.

image

After that you need some actions to set for example the target humidity to 50% but as for now i didnt do it.
I can put my code here later.

@i4mr000t
Copy link

i4mr000t commented Dec 4, 2024

@i4mr000t thank for your respones.

Plese tell me is there any way to make ha identify it as humidifier ?

Now its working just as fan

I did something like that:

image

You can use it like a humidity entity. If you mean that with your question before

@saschachina
Copy link

  1. Install this Integration from HACS:
    image
  2. Download this Token Extractor Tool: https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor/releases/latest/download/token_extractor.exe
  3. Enter Username, Password (from Xiaomi APP) and DONT CHOOSE A SERVER so its checking all available Servers (I got 3 different tokens, notice all).
  4. go into your configuration.yaml File and enter:
fan:
  - platform: xiaomi_miio_airpurifier
    name: Xiaomi Smart Humidifier 2
    host: <YOUR_IP_OF_HUMIDIFIER>
    token: <ONE_OF_THE_TOKENS_YOU_NOTICED_FROM_THE_SCRIPT>
    model: deerma.humidifier.jsq2w
  1. Restart Homeassistant and Enjoy! :-)

INFO: I had to try different tokens, one was working and i can control the humidifier now. Try all Tokens you received from point 2, if one is not working start with point 4 again and replace the token with another one. Restart Homeassistant and check again if its working.

Hi there, i tried again with "jsq2w" but got again something in the log:

Logger: miio.miot_device
Quelle: /usr/local/lib/python3.12/site-packages/miio/miot_device.py:172
Erstmals aufgetreten: 17:05:49 (5 Vorkommnisse)
Zuletzt protokolliert: 17:07:49

Unable to find mapping for deerma.humidifier.jsq2w, falling back to deerma.humidifier.jsqs

@i4mr000t
Copy link

i4mr000t commented Dec 4, 2024

  1. Install this Integration from HACS:
    image
  2. Download this Token Extractor Tool: https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor/releases/latest/download/token_extractor.exe
  3. Enter Username, Password (from Xiaomi APP) and DONT CHOOSE A SERVER so its checking all available Servers (I got 3 different tokens, notice all).
  4. go into your configuration.yaml File and enter:
fan:
  - platform: xiaomi_miio_airpurifier
    name: Xiaomi Smart Humidifier 2
    host: <YOUR_IP_OF_HUMIDIFIER>
    token: <ONE_OF_THE_TOKENS_YOU_NOTICED_FROM_THE_SCRIPT>
    model: deerma.humidifier.jsq2w
  1. Restart Homeassistant and Enjoy! :-)

INFO: I had to try different tokens, one was working and i can control the humidifier now. Try all Tokens you received from point 2, if one is not working start with point 4 again and replace the token with another one. Restart Homeassistant and check again if its working.

Hi there, i tried again with "jsq2w" but got again something in the log:

Logger: miio.miot_device
Quelle: /usr/local/lib/python3.12/site-packages/miio/miot_device.py:172
Erstmals aufgetreten: 17:05:49 (5 Vorkommnisse)
Zuletzt protokolliert: 17:07:49

Unable to find mapping for deerma.humidifier.jsq2w, falling back to deerma.humidifier.jsqs

I had the same Problem, try another Token

@KeinPlandavonviel
Copy link

KeinPlandavonviel commented Jan 3, 2025

@i4mr000t thank for your respones.
Plese tell me is there any way to make ha identify it as humidifier ?
Now its working just as fan

I did something like that:

image

You can use it like a humidity entity. If you mean that with your question before

Hello and thanks for your help here.
I have now integrated the humidifier, but I don't know how to set the humidity.
Can you please help me?

configuration.yaml

fan:

  • platform: xiaomi_miio_airpurifier
    name: Xiaomi Smart Humidifier 2
    host: xx.xx.xx.xx
    token: xxxxxx
    model: deerma.humidifier.jsq2w

sensors.yaml

  • platform: template
    sensors:
    airpurifier_temperature:
    friendly_name: Xiaomi Smart Humidifier 2 Temperature
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.temperature }}"
    unit_of_measurement: "°C"
    airpurifier_humidity:
    friendly_name: Xiaomi Smart Humidifier 2 Humidity
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.humidity }}"
    unit_of_measurement: "%"
    icon_template: mdi:water-percent
    airpurifier_model:
    friendly_name: Xiaomi Smart Humidifier 2 Model
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.model }}"
    airpurifier_mode:
    friendly_name: Xiaomi Smart Humidifier 2 Mode
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.mode }}"
    icon_template: mdi:auto-mode
    airpurifier_buzzer:
    friendly_name: Xiaomi Smart Humidifier 2 Buzzer
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.buzzer }}"
    icon_template: mdi:volume-high
    airpurifier_target_humidity:
    friendly_name: Xiaomi Smart Humidifier 2 Target Humidity
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.target_humidity }}"
    icon_template: mdi:water-percent
    unit_of_measurement: "%"
    airpurifier_led:
    friendly_name: Xiaomi Smart Humidifier 2 LED
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.led }}"
    icon_template: mdi:lightbulb
    airpurifier_no_water:
    friendly_name: Xiaomi Smart Humidifier 2 No Water
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.no_water }}"
    icon_template: mdi:water
    airpurifier_water_tank_detached:
    friendly_name: Xiaomi Smart Humidifier 2 Watertank Detached
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.water_tank_detached }}"
    icon_template: mdi:storage-tank-outline
    airpurifier_water_wet_protection:
    friendly_name: Xiaomi Smart Humidifier 2 Water Protection
    value_template: "{{ states.fan.xiaomi_smart_humidifier_2.attributes.wet_protection }}"
    icon_template: mdi:water-off-outline

@KeinPlandavonviel
Copy link

KeinPlandavonviel commented Jan 3, 2025

I found a solution for me, but your card looks a lot better. I add inputnumbers in configuration.yaml

input_number:
airhumidifier_target_humidity:
name: Zielluftfeuchtigkeit
min: 1
max: 99
step: 1

and in automations.yaml

  • alias: Select target humidity by slider
    trigger:
    platform: state
    entity_id: input_number.airhumidifier_target_humidity
    action:

    • service: xiaomi_miio_airpurifier.fan_set_target_humidity
      data_template:
      entity_id: fan.xiaomi_smart_humidifier_2
      humidity: '{{ states.input_number.airhumidifier_target_humidity.state|int }}'
  • alias: Monitor target humidity and update slider
    trigger:
    platform: state
    entity_id: sensor.airhumidifier_target_humidity
    action:
    service: input_number.set_value
    entity_id: input_number.airhumidifier_target_humidity
    data_template:
    value: '{{ states.fan.xiaomi_smart_humidifier_2.attributes.target_humidity }}'

@Larrax
Copy link

Larrax commented Jan 7, 2025

@i4mr000t thank for your respones.
Plese tell me is there any way to make ha identify it as humidifier ?
Now its working just as fan

I did something like that:

image

You can use it like a humidity entity. If you mean that with your question before

Thanks for the help @i4mr000t. I managed to add jsq2w to HA, thanks to this thread.

Also, your UI looks superb! Would you mind sharing the configuration for it?
My humidifier entity is just a "fan" and cannot be used directly with the default humidifier tab. And I am having hard time setting up anything but on/off for the dashboard.

@i4mr000t
Copy link

i4mr000t commented Jan 10, 2025

@Larrax

My humidifier is also just a fan. I´m using some input template sensors and automations to get it. Follow the preview post from @KeinPlandavonviel he´s describing it very good.

Here is my template for the Humidifier Card posted above:

You need some aditional plugins:
https://github.com/custom-cards/stack-in-card
https://github.com/thomasloven/lovelace-layout-card
https://github.com/piitaya/lovelace-mushroom
https://github.com/thomasloven/lovelace-card-mod

I hope thats all....

type: custom:stack-in-card
mode: vertical
cards:
  - type: custom:layout-card
    layout_type: custom:grid-layout
    cards:
      - type: custom:mushroom-chips-card
        alignment: start
        view_layout:
          grid-area: chips_main_buttons
        chips:
          - type: entity
            entity: fan.xiaomi_smart_humidifier_2
            card_mod:
              style: |
                ha-card {
                  border-style: none;
                  box-shadow: 0px 0px;
                }
            icon: mdi:power
          - type: spacer
          - type: entity
            entity: sensor.airpurifier_temperature
            icon: mdi:thermometer
            card_mod:
              style: |
                ha-card {
                  border-style: none;
                  box-shadow: 0px 0px;
                }
          - type: entity
            entity: sensor.airpurifier_humidity
            card_mod:
              style: |
                ha-card {
                  border-style: none;
                  box-shadow: 0px 0px;
                        }
      - type: custom:mushroom-chips-card
        alignment: end
        view_layout:
          grid-view: chips_main_buttons_end
        chips:
          - type: template
            entity: sensor.airpurifier_no_water
            icon: "{{ iif(states(entity) == 'True', 'mdi:connection', '') }}"
            card_mod:
              style: |
                ha-card {
                  border-style: none;
                  box-shadow: 0px 0px;
                }                  
      - type: tile
        entity: input_number.airhumidifier_target_humidity
        name: Luftbefeuchter Wohnzimmer
        state_content:
          - preset_mode
          - humidity
        features:
          - type: numeric-input
        view_layout:
          grid-area: humidifier
        card_mod:
          style: |
            ha-card {
              border-style: none;
              box-shadow: 0px 0px;
            }            
            ha-tile-icon {
              --tile-color: #008083;
            }
      - type: custom:mushroom-template-card
        primary: |-
          {% if states(entity) == "False" %} 100%          {% else %}
           0%{% endif %}
        secondary: Wasserstand
        icon: >-
          {% if states(entity) == "False" %} mdi:cup           {% else %}
          mdi:cup-outline {% endif %}
        entity: sensor.airpurifier_water_tank_detached
        layout: vertical
        icon_color: >-
          {% if states(entity) == "False" %} #008083           {% else %}
          #FD5901 {% endif %}
        card_mod:
          style: |
            ha-card {
              border-style: none;
              box-shadow: 0px 0px;
            }        
      - type: custom:mushroom-chips-card
        alignment: end
        chips:
          - type: template
            icon: >-
              {{ iif(states(entity) == 'on', 'mdi:volume-high',
              'mdi:volume-variant-off') }}
            icon_color: "{{ iif(states(entity) == 'on', '#008083', 'gray') }}"
            tap_action:
              action: toggle
            entity: switch.airpurifier_buzzer
            card_mod:
              style: |
                ha-card {
                  border-style: none;
                  box-shadow: 0px 0px;
                }
          - type: template
            icon: >-
              {{ iif(states(entity) == 'off', 'mdi:lightbulb',
              'mdi:lightbulb-on') }}
            icon_color: "{{ iif(states(entity) == 'on', '#008083', 'gray') }}"
            tap_action:
              action: toggle
            entity: switch.airpurifier_led
            card_mod:
              style: |
                ha-card {
                  border-style: none;
                  box-shadow: 0px 0px;
                }
        view_layout:
          grid-area: chips_button
      - type: custom:mushroom-chips-card
        chips:
          - type: template
            icon: mdi:numeric-1-box
            icon_color: >-
              {% set current_mode = state_attr('fan.xiaomi_smart_humidifier_2',
              'mode') %} {% set check_status =
              states('fan.xiaomi_smart_humidifier_2') %} {{ iif((current_mode ==
              1) * (check_status == 'on'), '#008083', '') }}
            tap_action:
              action: call-service
              service: fan.set_preset_mode
              target:
                entity_id: fan.xiaomi_smart_humidifier_2
              data:
                preset_mode: Low
            card_mod:
              style: |
                ha-card {
                  border-style: none;
                  box-shadow: 0px 0px;
                }
          - type: template
            icon: mdi:numeric-2-box
            icon_color: >-
              {% set current_mode = state_attr('fan.xiaomi_smart_humidifier_2',
              'mode') %} {% set check_status =
              states('fan.xiaomi_smart_humidifier_2') %}

              {{ iif((current_mode == 2) * (check_status == 'on'), '#008083',
              '') }}
            tap_action:
              action: call-service
              service: fan.set_preset_mode
              target:
                entity_id: fan.xiaomi_smart_humidifier_2
              data:
                preset_mode: Mid
            card_mod:
              style: |
                ha-card {
                  border-style: none;
                  box-shadow: 0px 0px;
                }
          - type: template
            icon: mdi:numeric-3-box
            icon_color: >-
              {% set current_mode = state_attr('fan.xiaomi_smart_humidifier_2',
              'mode') %} {% set check_status =
              states('fan.xiaomi_smart_humidifier_2') %}

              {{ iif((current_mode == 3) * (check_status == 'on'), '#008083',
              '') }}
            tap_action:
              action: call-service
              service: fan.set_preset_mode
              target:
                entity_id: fan.xiaomi_smart_humidifier_2
              data:
                preset_mode: High
            card_mod:
              style: |
                ha-card {
                  border-style: none;
                  box-shadow: 0px 0px;
                }
          - type: template
            icon: mdi:alpha-a-box
            icon_color: >-
              {% set current_mode = state_attr('fan.xiaomi_smart_humidifier_2',
              'mode') %} {% set check_status =
              states('fan.xiaomi_smart_humidifier_2') %}

              {{ iif((current_mode == 4) * (check_status == 'on'), '#008083',
              '') }}
            tap_action:
              action: call-service
              service: fan.set_preset_mode
              target:
                entity_id: fan.xiaomi_smart_humidifier_2
              data:
                preset_mode: Auto
            card_mod:
              style: |
                ha-card {
                  border-style: none;
                  box-shadow: 0px 0px;
                }          
        view_layout:
          grid-area: chips_state
    layout:
      grid-template-columns: 70% 30%
      grid-template-rows: auto
      grid-template-areas: |
        "chips_main_buttons chips_main_buttons_end"
        "humidifier water_level"
        "chips_state chips_button"

@Larrax
Copy link

Larrax commented Jan 12, 2025

Thanks a lot, @i4mr000t!!
Would you mind putting that config into the code block (use ``` above and below) with the correct indentation?
I have been trying to fix that for several hours now 😄 Got that somehow working, but it is not 100%.

@i4mr000t
Copy link

@Larrax Done ☑️

@Larrax
Copy link

Larrax commented Jan 12, 2025

Thanks again!
Let me also remind anyone else reading this to start by adding the custom sensors, switches, input numbers & automations as described in the docs.

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