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 Mi Air Purifier 3C (zhimi.airpurifier.mb4) support #117

Open
MarcE85 opened this issue Dec 4, 2020 · 61 comments
Open

Add Mi Air Purifier 3C (zhimi.airpurifier.mb4) support #117

MarcE85 opened this issue Dec 4, 2020 · 61 comments

Comments

@MarcE85
Copy link

MarcE85 commented Dec 4, 2020

Hey,

could you please add support for the Xiaomi Air purifier C3.
miiocli info attached:

Model: zhimi.airpurifier.mb4
Hardware version: esp32
Firmware version: 2.0.8

Regards Marc

@arturdobo
Copy link

@MarcE85 I received this air purifier couple of days ago and now I'm working on that

@arturdobo
Copy link

It turned out to be a little bit more difficult than I thought. First, the following issue needs to be resolved in python-miio

@asiersan
Copy link

Im interested un this integration too

@arturdobo
Copy link

rytilahti/python-miio#899 has been created in python-miio

@TomStarren
Copy link

I'm also interested in this integration, any ideas in which timeframe this can be added?

@arturdobo
Copy link

@TomStarren as I mentioned above, first PR in python-miio needs to be merged. So it's good to ask there about reviewing status ;)

@syssi syssi changed the title Support zhimi.airpurifier.mb4 Add zhimi.airpurifier.mb4 support Jan 18, 2021
@syssi syssi changed the title Add zhimi.airpurifier.mb4 support Add Mi Air Purifier 3C (zhimi.airpurifier.mb4) support Jan 18, 2021
@arturdobo
Copy link

rytilahti/python-miio#899 has been merged

@asiersan
Copy link

asiersan commented Feb 7, 2021

rytilahti/python-miio#899 has been merged

So now??

@arturdobo
Copy link

Once the newest version of python-miio is released, integration with 3C in this repo can be added 😉

@syssi What's the relation between this repo and the same code in the HA repo? I saw there is some problem regarding adding new integrations with Xiaomi devices to HA using the old way. Could you more details? Is there any work in progress to improve that?

@syssi
Copy link
Owner

syssi commented Feb 9, 2021

@arturdobo Take a look at this paragraph: https://github.com/syssi/xiaomi_airpurifier/#what-is-the-difference-between-this-custom-component-and-the-one-in-home-assistant-core

One point is missing: We are abusing attributes to provide the values of some properties (temperature, humiditiy, etc.) at the moment. This isn't allowed anymore. A device (the Air Purifier) must register multiple entities (fan, sensor, binary_sensor, switch, etc.) now. The xiaomi_miio component must be refactored. @starkillerOG is doing some great work here already (rytilahti/python-miio#929). I'm trying to provide support as much as I can.

@syssi
Copy link
Owner

syssi commented Feb 9, 2021

Feel free to provide a pull request for this custom component as first step to support your device. I'm trying to refactor the component to be merged as official HA component again some day.

@asiersan
Copy link

Any update?

@arturdobo
Copy link

nope

@nefsolive
Copy link

We need wait update "zhimi.airpurifier.mb4"

@arturdobo
Copy link

Things a little bit changed and now it'd be better to wait until this is merged. Then I believe the newest version of python-miio will be released so adding a new device should be easier.

@nefsolive
Copy link

As soon as it becomes possible to work zhimi.airpurifier.mb4, I also hope to find a possible plugin for domoticz

@arturdobo
Copy link

arturdobo commented Feb 21, 2021

Does domoticz use python-miio directly, or is there any middleware?

@nefsolive
Copy link

Like this on https://github.com/xiaoyao9184/DomoticzXiaomiPlugins and this plugin use python-miio. But i think, they need be updated too!

@arturdobo
Copy link

At the first glance, it looks like only the only thing you need is to python-miio be released. Maybe it'd be good to open an issue regarding that.

@nefsolive
Copy link

Yes arturdobo! Maybe that's it. I'll wait for the update. May it be soon, i hope.

@postscriptumpl
Copy link

@arturdobo support for 3C is already implemented in python-miio. Any chance to expect this functionality here soon?
Thanks for the support!

@arturdobo
Copy link

arturdobo commented Mar 10, 2021

@postscriptumpl yeah, I know, because I was the author 😆 I've just created this following issue rytilahti/python-miio#969

@postscriptumpl
Copy link

Ups...that was not very smart of me 🙈 Anyway I keep fingers crossed 🤞🏻😁

@postscriptumpl
Copy link

@arturdobo a shy reminder ☺️ python released 😁

@arturdobo
Copy link

Chase me, if it's not done till end of this week

@asiersan
Copy link

Yes is working, but not in local only in cloud

@bartohz
Copy link

bartohz commented Apr 16, 2021

hello with this integration works https://github.com/al-one/hass-xiaomi-miot
Новый точечный рисунок (3)
Новый точечный рисунок

Cheers for this! Works well so far.

@juavinas
Copy link

Hello,
how you setup, what it is worked? Xiaomi_miot, I installed from HACS. What need to do next?

@bartohz
Copy link

bartohz commented Apr 19, 2021

Hello,
how you setup, what it is worked? Xiaomi_miot, I installed from HACS. What need to do next?

Once you install it via HACS, go into Configuration > Integrations > Add New Integration and search for Xiaomi Miot. From the dropdown menu the first option is to sign into your account and the second will be to manually add it. I added mine manually, you'll need to get your device IP and token. After that it'll show up as any other entity and you can control it from there. :)

@fredyerne
Copy link

fredyerne commented Apr 25, 2021

Hello,
I just installed https://github.com/al-one/hass-xiaomi-miot via HACS, but after restart there is no new "integration" for Xiaomi:

image

image

any hint on what I do wrong?

Thanks!

Update - solved:
what a shame - simple browser caching issue :-(

@alesoft73
Copy link

@syssi You have predictions for this device integration ??
Many thanks ;)

@Disturbx
Copy link

Disturbx commented May 8, 2021

We need an update..

@bartohz
Copy link

bartohz commented May 8, 2021

We need an update..

It's been a while for sure.. If you haven't tried the above suggestion of using Miot I definitely recommend it, I've had it running flawlessly for the past 3 weeks.

@zawias
Copy link

zawias commented May 17, 2021

Hello,
how you setup, what it is worked? Xiaomi_miot, I installed from HACS. What need to do next?

Once you install it via HACS, go into Configuration > Integrations > Add New Integration and search for Xiaomi Miot. From the dropdown menu the first option is to sign into your account and the second will be to manually add it. I added mine manually, you'll need to get your device IP and token. After that it'll show up as any other entity and you can control it from there. :)

Do you have manual rotation control in favorite mode?

@bartohz
Copy link

bartohz commented May 17, 2021

Hello,
how you setup, what it is worked? Xiaomi_miot, I installed from HACS. What need to do next?

Once you install it via HACS, go into Configuration > Integrations > Add New Integration and search for Xiaomi Miot. From the dropdown menu the first option is to sign into your account and the second will be to manually add it. I added mine manually, you'll need to get your device IP and token. After that it'll show up as any other entity and you can control it from there. :)

Do you have manual rotation control in favorite mode?

Not as far as I know and the manual mode doesn't have as many steps. I generally just set the favourite mode in the Xiaomi app and leave it at that. Then HA will just read that.

@forast3r
Copy link

forast3r commented May 17, 2021

Hello,
how you setup, what it is worked? Xiaomi_miot, I installed from HACS. What need to do next?

Once you install it via HACS, go into Configuration > Integrations > Add New Integration and search for Xiaomi Miot. From the dropdown menu the first option is to sign into your account and the second will be to manually add it. I added mine manually, you'll need to get your device IP and token. After that it'll show up as any other entity and you can control it from there. :)

Do you have manual rotation control in favorite mode?

Use the **xiaomi_miot.**set_property service in HA

@zawias
Copy link

zawias commented May 17, 2021

Witam,
jak konfigurujesz, na czym to działa? Xiaomi_miot, zainstalowałem z HACS. Co dalej?

Po zainstalowaniu go przez HACS przejdź do Konfiguracja> Integracje> Dodaj nową integrację i wyszukaj Xiaomi Miot. Z menu rozwijanego pierwszą opcją jest zalogowanie się na swoje konto, a drugą będzie ręczne dodanie. Dodałem mój ręcznie, musisz uzyskać adres IP i token swojego urządzenia . Następnie pojawi się jako każda inna jednostka i możesz nią sterować z tego miejsca. :)

Czy masz ręczną kontrolę obrotów w ulubionym trybie?

Użyj usługi Climate.set_property w HA

Mówisz o tym ? U mnie nie działa.
image

@forast3r
Copy link

Witam,
jak konfigurujesz, na czym to działa? Xiaomi_miot, zainstalowałem z HACS. Co dalej?

Po zainstalowaniu go przez HACS przejdź do Konfiguracja> Integracje> Dodaj nową integrację i wyszukaj Xiaomi Miot. Z menu rozwijanego pierwszą opcją jest zalogowanie się na swoje konto, a drugą będzie ręczne dodanie. Dodałem mój ręcznie, musisz uzyskać adres IP i token swojego urządzenia . Następnie pojawi się jako każda inna jednostka i możesz nią sterować z tego miejsca. :)

Czy masz ręczną kontrolę obrotów w ulubionym trybie?

Użyj usługi Climate.set_property w HA

Mówisz o tym ? U mnie nie działa.
image

There was a typo in the service name, try developer tools, Service. The value in rpm:

service: xiaomi_miot.set_property
data:
  entity_id: climate.xiaomi_mc5_374e
  field: custom_service.favorite_speed
  value: 1500

We better ask for support in miiot threads...sorry for the noise

@nervous-inhuman
Copy link

I'm trying to get this Air Purifier to work nicely with denysdovhan/purifier-card

image

Not everything is working (e.g. Power ON/OFF button; ON/OFF State; AQI on top of the purifier), as the card expects the Air Purifier to be a fan entity, with service calls for it hardcoded.

For anyone wanting to do the same, here's my card config:

type: custom:purifier-card
entity: climate.3c_air_purifier
aqi:
  - entity: climate.3c_air_purifier
    attriubte: environment.pm2_5_density
stats:
  - attribute: filter.filter_life_level
    unit: '%'
    subtitle: Filter Remaining
  - attribute: custom_service.moto_speed_rpm
    unit: RPM
    subtitle: Motor Speed
  - attribute: environment.pm2_5_density
    unit: µg/m³
    subtitle: AQI
actions:
  - name: Silent
    icon: mdi:weather-night
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: air_purifier.mode
      value: 1
  - name: 25%
    icon: mdi:circle-slice-2
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: custom_service.favorite_speed
      value: 550
  - name: 50%
    icon: mdi:circle-slice-4
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: custom_service.favorite_speed
      value: 1100
  - name: 75%
    icon: mdi:circle-slice-6
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: custom_service.favorite_speed
      value: 1650
  - name: 100%
    icon: mdi:circle-slice-8
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: custom_service.favorite_speed
      value: 2200
  - name: Auto
    icon: mdi:brightness-auto
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: air_purifier.mode
      value: 0
show_name: true
show_state: true
show_toolbar: true
compact_view: false

@asiersan
Copy link

asiersan commented Jun 5, 2021

I'm trying to get this Air Purifier to work nicely with denysdovhan/purifier-card

image

Not everything is working (e.g. Power ON/OFF button; ON/OFF State; AQI on top of the purifier), as the card expects the Air Purifier to be a fan entity, with service calls for it hardcoded.

For anyone wanting to do the same, here's my card config:

type: custom:purifier-card
entity: climate.3c_air_purifier
aqi:
  - entity: climate.3c_air_purifier
    attriubte: environment.pm2_5_density
stats:
  - attribute: filter.filter_life_level
    unit: '%'
    subtitle: Filter Remaining
  - attribute: custom_service.moto_speed_rpm
    unit: RPM
    subtitle: Motor Speed
  - attribute: environment.pm2_5_density
    unit: µg/m³
    subtitle: AQI
actions:
  - name: Silent
    icon: mdi:weather-night
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: air_purifier.mode
      value: 1
  - name: 25%
    icon: mdi:circle-slice-2
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: custom_service.favorite_speed
      value: 550
  - name: 50%
    icon: mdi:circle-slice-4
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: custom_service.favorite_speed
      value: 1100
  - name: 75%
    icon: mdi:circle-slice-6
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: custom_service.favorite_speed
      value: 1650
  - name: 100%
    icon: mdi:circle-slice-8
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: custom_service.favorite_speed
      value: 2200
  - name: Auto
    icon: mdi:brightness-auto
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: air_purifier.mode
      value: 0
show_name: true
show_state: true
show_toolbar: true
compact_view: false

what are you using to integrate as a climate????

@Nebur692
Copy link

Nebur692 commented Jun 6, 2021

For when the integration with the zhimi.airpurifier.mb4?

@suarezcp87
Copy link

I'm trying to get this Air Purifier to work nicely with denysdovhan/purifier-card
image
Not everything is working (e.g. Power ON/OFF button; ON/OFF State; AQI on top of the purifier), as the card expects the Air Purifier to be a fan entity, with service calls for it hardcoded.
For anyone wanting to do the same, here's my card config:

type: custom:purifier-card
entity: climate.3c_air_purifier
aqi:
  - entity: climate.3c_air_purifier
    attriubte: environment.pm2_5_density
stats:
  - attribute: filter.filter_life_level
    unit: '%'
    subtitle: Filter Remaining
  - attribute: custom_service.moto_speed_rpm
    unit: RPM
    subtitle: Motor Speed
  - attribute: environment.pm2_5_density
    unit: µg/m³
    subtitle: AQI
actions:
  - name: Silent
    icon: mdi:weather-night
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: air_purifier.mode
      value: 1
  - name: 25%
    icon: mdi:circle-slice-2
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: custom_service.favorite_speed
      value: 550
  - name: 50%
    icon: mdi:circle-slice-4
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: custom_service.favorite_speed
      value: 1100
  - name: 75%
    icon: mdi:circle-slice-6
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: custom_service.favorite_speed
      value: 1650
  - name: 100%
    icon: mdi:circle-slice-8
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: custom_service.favorite_speed
      value: 2200
  - name: Auto
    icon: mdi:brightness-auto
    service: xiaomi_miot.set_property
    service_data:
      entity_id: climate.3c_air_purifier
      field: air_purifier.mode
      value: 0
show_name: true
show_state: true
show_toolbar: true
compact_view: false

what are you using to integrate as a climate????

I am using this https://github.com/al-one/hass-xiaomi-miot

@asiersan
Copy link

asiersan commented Jun 6, 2021

Me too, and mine is shown as fan

@nervous-inhuman
Copy link

That's odd, I'm also using the al-one/hass-xiaomi-miot integration, however it's using the climate entity for me.

@Quotenjunkie
Copy link

Any update regarding the integration?

@TpHa1
Copy link

TpHa1 commented Aug 9, 2021

Me too, and mine is shown as fan

the climate entity for me, How change to fan?

@a-x-
Copy link

a-x- commented Oct 14, 2021

JFYI,
@suarezcp87 @forast3r

xiaomi_miot.set_property
Does not work any more. For me, at least.

exception log
TypeError: set_property() got an unexpected keyword argument 'field'
2021-10-14 17:48:25 ERROR (MainThread) [homeassistant.components.automation.living_vent_start_fan_faster] Living: vent start—fan faster: Error executing script. Unexpected error for call_service at pos 1: set_property() got an unexpected keyword argument 'field'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 371, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 571, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1492, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1527, in _execute_service
    await handler.job.target(service_call)
  File "/config/custom_components/xiaomi_miot/__init__.py", line 365, in async_service_handler
    await getattr(dvc, fun)(**params)
  File "/config/custom_components/xiaomi_miot/__init__.py", line 1313, in async_set_property
    return await self.hass.async_add_executor_job(partial(self.set_property, *args, **kwargs))
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)

and, +1 who was set mb4 as a climate?! It should be a fan.


Also, xiaomi_miot.set_property is too hard. Separate entities was huge simpler in automatization

@a-x-
Copy link

a-x- commented Oct 14, 2021

My ha core Version
core-2021.9.6

miot-auto: v0.4.6

@a-x-
Copy link

a-x- commented Oct 14, 2021

Can I help with code? Is some one have not enough time?
I cannot use my 3C purifier a half of year…

@zawias
Copy link

zawias commented Oct 15, 2021

I also have this problem when invoking the service set_property custom_service.favorite_speed:
"Call-service error. set_property() got an unexpected keyword argument 'field'"
Anyone know how to fix this?

@Trunkenstein
Copy link

@syssi If you need a device for testing / adding support, just send me a message (If your location is right, I'm "right in the neighborhood") , I could lend it to you after the heavy pollen season

@syssi
Copy link
Owner

syssi commented May 13, 2022

Lol. Funny suggestion. Where are you from?

@Trunkenstein
Copy link

Cologne area, near the border of the SU license plates. I'll can send you an email if you're interested.

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

No branches or pull requests