Git Product home page Git Product logo

homebridge-miot's Introduction

homebridge-miot

verified-by-homebridge homebridge-miot mit-license follow-me-on-twitter join-discord

homebridge-miot is a plugin for homebridge which allows you to control any device supporting the miot protocol from Xiaomi!
The goal is to add Homekit support to miot devices and make them fully controllable from the native Homekit iOS app and Siri.

Feedback and contribution is helpful and will improve the plugin!

If your device is not supported please create a request and specify the device model and type.

Features

  • Integrates miot devices into Homekit
  • Detect device types automatically via miot spec or by local device implementations
  • Fully customizable Homekit accessories
  • Homekit automations for your miot devices

Supported device types

  • Fan
  • Ceiling Fan
  • Heater
  • Humidifier
  • Dehumidifier
  • Air Purifier
  • Air Conditioner
  • Outlet
  • Curtain
  • Fresh Air System
  • Robot Cleaner - Room Cleaning guide
  • Light
  • Airer
  • Oven
  • Air Fryer
  • Coffee Machine
  • Camera
  • Bath Heater
  • Kettle
  • Thermostat
  • Switch
  • Air Monitor
  • Cooker
  • Speaker
  • Contact Sensor
  • Gateway
  • Video Doorbell
  • Pet Feeder
  • Temperature Humidity Sensor
  • Submersion Sensor
  • Plant Monitor
  • Motion Sensor

More device types will be added!

For a full list of supported devices by model check here: all supported devices by model.

Even if your device is not on the supported devices list, worry not! The plugin will use the miot spec to categorize your device as best as possible.

Installation

If you are new to homebridge, please first read the homebridge documentation. If you are running on a Raspberry, you will find a tutorial in the homebridge wiki.

Install homebridge:

sudo npm install -g homebridge

Install homebridge-miot:

sudo npm install -g homebridge-miot

Configuration

Add the miot platform in config.json in your home directory inside .homebridge.

Add your devices in the devices array.

Example configuration:

{
  "platforms": [
    {
      "platform": "miot",
      "micloud": {
        "username": "[email protected]",
        "password": "mySecretPassword",
        "country": "cn"
      },
      "devices": [
        {
          "name": "Xiaomi Smartmi Fan 3",
          "ip": "192.168.0.83",
          "token": "63d4d8fba83f94aa5ad8f96536c84c12",
          "pollingInterval": 10,
          "horizontalMoveControl": true,
          "buzzerControl": true,
          "ledControl": true,
          "modeControl": true,
          "offDelayControl": true,
          "ioniserControl": true,
          "horizontalAngleButtons": [
            5,
            60,
            100
          ],
          "actionButtons": [
            {
              "action": "fan:toggle",
              "name": "Toggle power action",
              "params": [
                123
              ]
            },
            {
              "action": "2.3",
              "name": "Toggle mode action"
            }
          ],
          "methodButtons": [
            {
              "method": "get_room_mapping",
              "name": "Get room mapping"
            }
          ],
          "propertyControl": [
            {
              "property": "fan:anion",
              "name": "Control anion"
            },
            {
              "property": "2.7",
              "value": 0,
              "name": "Set natural wind mode"
            },
            {
              "property": "custom-service:speed-level",
              "config": {
                "type": "fan"
              }
            }
          ],
          "propertyMonitor": [
            {
              "property": "battery:battery-level",
              "name": "Show bat level only when mode 1",
              "linkedProperty": "vacuum:mode",
              "linkedPropertyValue": 1
            },
            {
              "property": "vacuum:mode",
              "value": 2,
              "name": "Notify when mode 2 set"
            },
            {
              "property": "battery:battery-level",
              "value": 15,
              "valueOperator": "lessOrEqual",
              "name": "Low Battery"
            }
          ]
        }
      ]
    }
  ]
}

Token

For the plugin to work the device token is required. The plugin offers you two ways to retrieve the token for your devices:

  • You can use the plugin's settings in homebridge-config-ui-x (Homebridge Ui), where you will find a "Discover All Devices via MiCloud" button, which can automatically get the tokens for all your devices!
  • Another way it to use the command line tools, simply type miot cloud-devices -u <username> -p <password> in the command line to get the tokens for all your devices!

Other ways:

Configuration

Keep in mind that your device needs to support the feature which you enable, otherwise you will not see any effect.

Platform configuration fields

  • platform [required] Must always be "miot".
  • devices [required] A list of your devices.
  • micloud [optional] This is a global configuration object for the MiCloud connection. When specified, this credentials will be used when a device requires a MiCloud connection. Some older devices require a MiCloud connection in order to be controlled! Default: "" (not specified)
    • Can also be specified even when no devices require the MiCloud, in that case additional information for the devices will be retrieved.
    • An object should have the following properties:
      • username - [required] the MiCloud username
      • password - [required] the MiCloud password
      • country - [optional] the country where the servers are located for your devices. Default: "cn"
      • forceMiCloud - [optional] forces to use MiCloud even when the device supports local commands. Default: false
      • timeout - [optional] set a custom request timeout in milliseconds. Default: 5000

General device configuration fields

  • name [required] The name of the accessory.
  • ip [required] The ip address of your device.
  • token [required] The token of your device.
  • deviceId [optional] The deviceId is required for a MiCloud connection to identify the device. If not specified an attempt will be made to retrieve it from a local connection to the device Default: "" (not specified)
  • model [optional] The device model if known. Should only be specified when certain about the device model. If specified then the accessory will be created instantly without the need to first discover and identify the device. Default: "" (not specified)
  • micloud [optional] When specified overwrites the global setting for the device. Useful when you have devices on different servers or want to force certain devices to use MiCloud. Default: "" (not specified)
  • prefsDir [optional] The directory where the device info will be stored. Default: "~/.homebridge/.xiaomiMiot"
  • pollingInterval [optional] The device state polling interval in seconds. Default: 15
  • propertyChunkSize [optional] Size of a property chunk when syncing properties with the device. A lower value might reduce the load on the device. Range 1-14 Default: device class default, if not defined -> 14
  • deepDebugLog [optional] Enables additional more detailed debug log. Useful when trying to figure out issues with the plugin. Default: false
  • silentLog [optional] When enabled all log output will only appear in debug mode. Default: false
  • customAccessory [optional] Creates a custom empty accessory for the device which can be manually populated with services. Requires actionButtons, propertyControl or propertyMonitor to be set. Default: false
  • onlyMainService [optional] Only the main accessory service will be created without any additional services. Useful when wanting to have a clean layout. actionButtons, propertyControl or propertyMonitor can be used to manually add services. Default: false
  • buzzerControl [optional] Whether the buzzer service is enabled. This allows to turn on/off the device buzzer/alarm. Default: true
  • ledControl [optional] Whether the led service is enabled. This allows to turn on/off the device LED. Default: true
  • childLockControl [optional] Whether the child lock control service is enabled. This allows to turn on/off the device child lock. Default: true
  • modeControl [optional] Show mode switches which allow to change the device mode. Default: true
  • suppressAutoServiceCreation [optional] Suppress auto creation of some sensor services. Default: "" (not specified)
    • Set an array of service names which should be disabled
    • Available services: temperature, relativeHumidity, illumination
    • Only takes effect if a device supports the specified service and the service is NOT a main device service
  • actionButtons [optional] Show additional action switches if the device supports any. Default: false
    • Set to true or false to show/hide all actions available on the device
    • Set an array of action names or action ids to only show the desired actions
    • You can also set an array of objects as the value which enables advanced configuration. An object can have the following properties:
      • action - [required] the action name or action id
      • name - [optional] the name of the switch
      • params - [optional] parameters to be used for the action, not all actions support parameters
  • methodButtons [optional] Execute a raw miio method on the device. Can be useful for advanced robot cleaner configuration. Default: "" (not specified)
    • Creates statless switches which when pressed execute the method, the result of the method call is printed in the log
    • Set an array of method names to only show the desired method buttons
    • You can also set an array of objects as the value which enables advanced configuration. An object can have the following properties:
      • method - [required] the method name
      • name - [optional] the name of the switch
      • params - [optional] parameters to be used for the method call
  • propertyControl [optional] Allows to control any properties of your device. Default: "" (not specified)
    • Creates ui controls on your device based on the property type
    • Set an array of property names or property ids
    • You can also set an array of objects as the value which enables advanced configuration. An object can have the following properties:
      • property - [required] the property name or id
      • name - [optional] the name of the control
      • value - [optional] a fixed value which will be set to the property. When specified will create a stateless switch
      • linkedProperty - [optional] linked property used for status checking. Useful when control should only be possible when for example the device is on
      • linkedPropertyValue - [optional] the value of the linked property
      • config - [optional] a configuration object, for details see below
  • propertyMonitor [optional] Allows to monitor any properties of your device. Default: "" (not specified)
    • Creates a light sensor to display numeric values. String values are logged
    • Set an array of property names or property ids
    • You can also set an array of objects as the value which enables advanced configuration. An object can have the following properties:
      • property - [required] the property name or id
      • name - [optional] the name of the control
      • value - [optional] when a fixed value is specified instead of a light sensor a presence sensor will be created which triggers when the property has the specified value
      • valueOperator - [optional] defines the operator which should be used when comparing the value to the property value. Only takes effect when a value is set. Possible values equal, less, greater, lessOrEqual, greaterOrEqual, contains. Default: "equal"
      • linkedProperty - [optional] linked property used for status checking- Useful when monitor should only be possible when for example the device is on
      • linkedPropertyValue - [optional] the value of the linked property

Some device types also have some specific configuration fields. Please have a look at the device type page to check whether there are any available under the docs.

Property and Action names (or ids)

There are 4 ways to get the property an action names (or ids) used in actionButtons, propertyControl and propertyMonitor:

  • Use the Miot Spec Fetcher
  • Use the plugin's settings in homebridge-config-ui-x (Homebridge Ui), where you will find a "Fetch Device Metadata" button
  • Check the homebridge log. Available device property and action names will be printed there during initialization
  • You can also use the official miot spec in order to determine the names or ids Miot Spec - Released

Property control config

Some properties have a configuration which enables to change certain aspects of the resulting service.

Value range properties:
  • type - the type of the accessory which is created Default: "lightbulb"
    • lightbulb
    • fan

BLE and ZigBee devices

It is also possible to connect BLE and ZigBee devices to the plugin via a gateway or hub. To do that, first the device needs to be connected to the gateway or hub, afterwards you have to manually specify the token and ip of the gateway/hub, but the model and deviceId needs to be that of the BLE or ZigBee device. All the required information can be retrieved from the MiCloud either via the Ui or the CLI commands.

Example:

{
  "platforms": [
    {
      "platform": "miot",
      "devices": [
        {
          "name": "Zigbee Outlet",
          "ip": "<GATEWAY_IP>",
          "token": "<GATEWAY_TOKEN>",
          "model": "lumi.plug.mmeu01",
          "deviceId": "<OUTLET_DID>",
        }
      ]
    }
  ]
}

CLI

The plugin also offers a command line interface to control your devices directly from the command line.
Just type miot in the console to get a list of available options. Currently available are:

  • miot send -> Send a RAW command over your local network to the device
  • miot get-prop -> Get the specified property value from the device. Accepts property id in the format siid:piid
  • miot set-prop -> Set the value for the specified property. Accepts property id in the format siid:piid
  • miot action -> Execute an action on the device. Accepts action id in the format siid:aiid
  • miot test -> Test connection to a device
  • miot tokens -> Store and show tokens for specific devices
  • miot cloud -> Connect to the MiCloud, execute commands, list devices and get specific device info
  • miot fetch-metadata -> Fetch device metadata for the specified model

Examples:

miot send <IP> -t <TOKEN> get_properties '[{"siid":2,"piid":2}]'

miot send <IP> -t <TOKEN> set_properties '[{"siid":2,"piid":2,"value":1}]'

miot send <IP> -t <TOKEN> action '{"aiid":13,"in":[],"siid":10}'

miot cloud list-devices

miot cloud get-props '[{"siid":2,"piid":2,"did":"<DID>"}]'

miot cloud set-props '[{"siid":2,"piid":2,"value":1,"did":"<DID>"}]'

Troubleshooting

Debug

If you have any issues with the plugin or device services then you can run homebridge in debug mode, which will provide some additional information. This might be useful for debugging issues.

Homebridge debug mode:

homebridge -D

Deep debug log, add the following to your config.json:

"deepDebugLog": true

This will enable additional extra log which might be helpful to debug all kind of issues.

Connection test

You can test the connection to a device with the following cli command:

miot test <ip> -t <token>

If the connection test will succeed then your ip and token are correct!

Special thanks

HAP-NodeJS & homebridge - for making this possible.

homebridge-miot's People

Contributors

0x5e avatar 350d avatar achrovisual avatar ahelpingchip avatar blue2000hk avatar jaaasonsun avatar jivnov avatar johnhom1024 avatar liuliujie avatar mavoronin avatar merdok avatar mrking avatar pawelaugustyn avatar petroliubynskyi avatar rhusar avatar romacv avatar satrik avatar saurikcornel avatar seanzhang98 avatar sirinveen avatar skjall avatar thealpa avatar ufkel avatar willian-zhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homebridge-miot's Issues

Add support for Dreame D9 / dreame.vacuum.p2009

Hi,

any chance you could implement support for the Dreame D9 (dreame.vacuum.p2009) vacuum cleaner robot?
Current behavior on 0.9.2 is same as #24 - configured as fan switch, but switches off after 1-2 seconds. When the robot is actually running, the switch is on. There is also only one switch present in HomeKit.

Thanks! Filip

Device Request for: Mi Air Purifier 2H

Hi Merdok,

Sorry in advance, if I post this in the wrong section. Would it be possible to add support for Xiaomi Air Purifier 2H; zhimi.airpurifier.mc2 .

Please add support for zhimi.airpurifier.ma2

I would like to request a support for Xiaomi Air Purifier S2 aka zhimi.airpurifier.ma2.

Type info: miio:air-purifier, sensor, miio, air-purifier
Capabilities: miio:buzzer, miio:led-brightness, miio:switchable-led, pm2.5, relative-humidity, temperature, switchable-mode, mode, switchable-power, restorable-state, power, state

Please let me know what other information I could provide to integrate the device.
Thank you.

Support for Mi Smart Power Plug 2 (Wi-Fi and Bluetooth Gateway)

Can you add the full support for Mi Smart Power Plug 2 (Model: chuangmi.plug.212a01 ) ?
My plug works well but there are some minor issues:

a. On HomeBridge it says "Device not supported! Using a generic device with limited properties! Consider requesting device support!"
b. It appears on Apple Home as a "Switch" rather than an "Outlet", the product type needs to be corrected.

Device information:
Name(s) of the device: Mi Smart Power Plug 2 (Wi-Fi and Bluetooth Gateway)
Link: https://www.mi.com/buy/detail?product_id=12777
Model: chuangmi.plug.212a01

Thanks!
Charles

help to add smart plugs

First of all, a deep thank you for making this plugin. Great effort!

Could you please add support for smart plug device types? The model I am working with right now is Gosund Smart Plug (cuco.plug.cp1); this should be supported by the MIoT protocol as per link.

In fact, I have already tried to add this device to homebridge. The device discovery is fine. The state polling is fine as well. I tried to turn it on, however, that didn't work. Interestingly, I can turn it off though once being turned on manually.

Happy to provide any necessary info on my end. I'm relatively comfortable with programming (mostly python). New to homebridge though.

Your time is much appreciated. Cheers!

led & buzzer buttons

Po ostatniej aktualizacji nie mogę wyłączyć przycisków do ledów i buzzera w oczyszczaczu.

3626C651-9C62-41D8-A07C-6E674A6D7112

Possible to support Light Brightness and Color temperature?

Firstly, Thank you for making this homebridge plugin to let xiaomi product connect to Apple HomeKit

Is possible to add support for a light accessory, the model is leshi.light.wy0b01, I want to control the brightness and the color temperature.

Thank you very much.

Add support for Mi Smart Microwave Oven

Hello,

Would it be possible to add support for the Mi Smart Microwave Oven?

Model: chunmi.microwave.n20l01
SKU: MWBLXE1ACM
Link: https://www.mi.com/buy/detail?product_id=10330

When setup in the plugin, it seems to connect successfully and is seen as a switch, but there are no additional controls. Toggling the switch also does nothing, and it does not reflect the current state of the microwave.

I understand this isn't the usual type of device controlled by HomeKit, so I don't expect support for every feature, but being able to at least start or stop it would be nice.

If there is anything I can provide (logs, testing, etc.), I would be happy to help the best I can.

Issue with action button

If I add an action button I get this error:
ReferenceError: tmpActionName is not defined
at /usr/local/lib/node_modules/homebridge-miot/lib/base/BaseAccessory.js:287:82
at Array.filter ()
at RobotCleanerAccessory.prepareActionButtonServices (/usr/local/lib/node_modules/homebridge-miot/lib/base/BaseAccessory.js:287:38)
at RobotCleanerAccessory.setupAdditionalAccessoryServices (/usr/local/lib/node_modules/homebridge-miot/lib/modules/robotcleaner/RobotCleanerAccessory.js:57:34)
at new BaseAccessory (/usr/local/lib/node_modules/homebridge-miot/lib/base/BaseAccessory.js:49:12)
at new RobotCleanerAccessory (/usr/local/lib/node_modules/homebridge-miot/lib/modules/robotcleaner/RobotCleanerAccessory.js:9:5)
at Function.createAccessory (/usr/local/lib/node_modules/homebridge-miot/lib/AccessoryFactory.js:52:24)
at xiaomiMiotDevice.initAccessory (/usr/local/lib/node_modules/homebridge-miot/index.js:138:48)
at MiotController. (/usr/local/lib/node_modules/homebridge-miot/index.js:99:14)
at MiotController.emit (events.js:315:20)


Homebridge continuously restart.

My config is:
{
"devices": [
{
"name": "Britney",
"ip": "192.168.3.81",
"token": "3447675969616a485945674239794d6c",
"pollingInterval": 5,
"deepDebugLog": false,
"actionButtons": [
{
"action": "locate_robot",
"name": "Trova"
}
]
}
],
"platform": "miot"
}

Everything works fine without custom action button.

Device doesn't show up

I successfully added my Air Purifier 3C to the Plugin, bit it doesn't show up in my devices. It's not unassigned or something, it's just not there. I also can't find it in my home app. But according to the logs everything seems fine

image

My Device setup looks like this:

[
    {
        "name": "Xiaomi Air Purifier",
        "ip": "REDACTED",
        "token": "REDACTED",
        "pollingInterval": 5,
        "fanLevelControl": true,
        "modeControl": true
    }
]

Few questions

Hi, thanks for great work!

  1. Are you planning to implement Xiaomi 2H support? Is it possible?
  2. I think Air Purifers should automaticly switch themself to manual mode when you control them by intensity silder. When you’re in automode nothing is happening when you’re doing this.
  3. Do you think you can implement Idle state for Air purifiers? Like in this plugin https://github.com/rgavril/homebridge-xiaomi-air-purifier3#readme ?
  4. Do you think it is possible to make led/light accesorry to appear like this?

Jeszcze raz dzięki za super robotę!

Slider to adjust speed for Robot Cleaner

Hello. First, thank you very much for this wonderful plugin, it works perfectly with my Dream D9!

Do you think it would be possible to implement a slider instead of different switches, in order to control the Suction Mode? I know that another plugin https://github.com/homebridge-xiaomi-roborock-vacuum/homebridge-xiaomi-roborock-vacuum/blob/HEAD/models/speedmodes.js can do that. For example: OFF / 0-25% = Quiet / 25-50% = Normal / 50-75% = Strong / 75-100% = Turbo.

Obviously, it should be an option only, because people could prefer the switches.

EDIT: event better, is it possible to have steps in the slider?

zhimi.heater.zb1 config

i successfully install your plugin and configured a xiaomy heater, i can start & stop. But
i have a constant warning:
This plugin generated a warning from the characteristic 'Target Heater-Cooler State': characteristic value expected number and received undefined. See https://git.io/JtMGR for more info.

and when i start trhe heater via the plugin on applehome, i get this in the log
This plugin generated a warning from the characteristic 'Target Heater-Cooler State': characteristic value expected number and received undefined. See https://git.io/JtMGR for more info.

this my config file:
"model": "zhimi.heater.zb1",
"pollingInterval": 10,
"buzzerControl": false,
"ledControl": true,
"horizontalSwingControl": false,
"verticalSwingControl": false,
"naturalModeControl": true,
"sleepModeControl": false,
"horizontalMoveControl": false,
"verticalMoveControl": false,
"fanLevelControl": true,
"ioniserControl": false,
"shutdownTimer": false,
"heatLevelControl": true,
"screenControl": false,
"dryModeControl": false,
"autoModeControl": false,
"favoriteModeControl": false

Split Purifier from Air sensor in HK

HI, are there any possibility to expose the Purifier and the Air sensor as two different accessories and not grouped?
My request made because if I want to switch from Automatic to Manual mode without use the switch plugin, I can do trough the Purifier accessory but to do that I need to enter inside the tile group
21BD69CC-A234-4FF0-8626-98A9F306A46C
A5F5782C-2A2C-4007-A723-64E52BA922A7
91088830-DD64-4823-9D41-9D523C050F4B

LED Control

Hey!

I really like your plugin. Im using it with a Airpurifier 3c. Unfortunately the LED-Control isnt working. Is there a way to fi this?

Keep up the good work!

Fanspeed

With the new Update (0.7.1) the fanspeed control is broken. Or rather the value of the fanspeed. The max fanspeed value was 100% before the update. Now it is 2200%. So its pretty annoying to control via siri.

Screen

Hi! Thanks for your job, your plugin is the unique one that works with Air Purifier 3C
I’d like to disable the “Screen” brightness from HomeKit, my interest is just to have the Air Purifier without screen control
Do you know how can I remove from HomeKit?

Second question, any changes to let appear the temperature and humidity sensors?

This is my configuration:

"accessories": [],
"platforms": [
    {
        "platform": "miot",
        "devices": [
            {
                "name": "Purificatore",
                "ip": "192.168.178.xxx",
                "token": "adxxxxxxxxxxb",
                "deviceId": "3xxxxxxx",
                "model": "zhimi.airpurifier.mb4",
                "pollingInterval": 5,
                "buzzerControl": false,
                "childLockControl": false,
                "ledControl": false,
                "swingControl": false,
                "moveControl": false,
                "fanLevelControl": false,
                "ioniserControl": false,
                "dryControl": false,
                "modeControl": false,
                "lightModeControl": false,
                "motorControl": false,
                "pm25Breakpoints": [
                    5,
                    12,
                    35,
                    55
                ]
            }
        ]
    }
]

}

Air Purifier specific settings advice

Hi merdok, I used two MiAirPurifier2S which work well with miot. But the device info about temperature and humidity is not unreliable. Can you add a plug or other options to block this value?

Make air quality level configurable?

Hi. I know I'm a bit annoying but I've another question. Or better: This time a feature request.

In the AirPurifierAccessory.js is the following part

if (pm25Density <= 7) {
return Characteristic.AirQuality.EXCELLENT;
} else if (pm25Density > 7 && pm25Density <= 15) {
return Characteristic.AirQuality.GOOD;
} else if (pm25Density > 15 && pm25Density <= 30) {
return Characteristic.AirQuality.FAIR;
} else if (pm25Density > 30 && pm25Density <= 55) {
return Characteristic.AirQuality.INFERIOR;
} else if (pm25Density > 55) {
return Characteristic.AirQuality.POOR;
}

I understand these values are based on some research, but I'd love to configure this, so I could finetune my automations a bit more. Other plugins that don't work with my air purifier had a simple array for this, where one could simply add five values for this.

Would it be possible to add this to your plugin?

Humidifier 3c warning and Fan Speed in Homekit

I'm constantly getting "[5/26/2021, 9:05:45 PM] [homebridge-miot] This plugin generated a warning from the characteristic 'Rotation Speed': characteristic was supplied illegal value: number -254 exceeded minimum of 0. See https://git.io/JtMGR for more info."
I connected the Xiaomi humdifier 3c to homebridge-miot. In the HomeKit App the Fan Level isn't shown correctly. It always says the Speed is 0, but i can pull up the bar to set it to a level.
Start: IMG_4870
While I press: IMG_4871
After release: IMG_4872

Mi Air Purifier Pro H (new model) not recognized

First off, thanks for your hard work.

A small issue that I would like to point out: I have bought the Mi Air Purifier Pro H (zhimi.airpurifier.va1); unfortunately, the model I got was the Chinese one and I can't set it up in my local server (Greece/Germany). Either way, I would eventually want to integrate it with HomeKit.

The issue that I am having is that the plugin does not support this particular model. I can make the device work by manually setting the model to zhimi.airpurifier.vb2. Several feature do work (temp/air quality/humidity sensor data, device on/off, filet lifespan, native auto/manual mode switching, as well as the extra LED and mode switches), but it's impossible to control fan speed from HomeKit/Homebridge.

To be more specific, attempting to change the speed via HomeKit switches the purifier mode to manual ("favorite") and defaults to the last fan speed set via the Xiaomi Home app. Moreover, the fan speed displayed in HomeKit is always the last speed set in the Xiaomi Home app while using manual mode (i.e. switching to Level 1-2-3 fan speeds is not reflected in the HomeKit interface). One more bit of interest: the official app allows for setting of speed at ten percent increments (10%-20%-...-90%-100%), which the HomeKit/Homebridge interface assigns to 8%-15%-20%-25%-30%-35%-40%-45%-50%-62% speeds, respectively.

On a side note, with a working fan speed control, the actual Homebridge plugin would only need an extra sleep mode switch, as the air purifier service supports auto/manual mode switching by itself, so it would be nice to be able to enable and disable individual extra switches in config.json, plus it allow for a less cluttered interface. I could open a separate ticket for this if it helps your workflow, but this matter is dependent on the fan speed issue that I'm describing, so I defer to your judgement on this.

Do you think you could take a look into this? I can provide debug logs or any other details, if you need them.

Again, thanks for your hard work.

Get air quality level from air purifier?

Hi, I finally got this working (thanks for your help) and wanted to ask if it's possible to get the air quality level in HomeKit from the Air Purifier 3C? I'd love to set automations in HomeKit but right now I'm pretty limited without this information.

Add support for MI Air Conditioner Companion MCN

Hello,

Would it be possible to add support for the Mi Air Conditioner Companion MCN?

Model: lumi.acpartner.mcn02
SKU: KTBL03LM
Link: https://www.mi.com/buy/detail?product_id=9726

When setup in the plugin, it seems to connect successfully and is seen as a switch, but there are no additional controls.
I see that python-miio has his support, you can refer to python-miio#809.
If there is anything I can provide (logs, testing, etc.), I would be happy to help the best I can.

Device not supported!

Hi, thx for this plugin!

I got this error, but my fan is this one zhimi.heater.nb1 (Smartmi Smart Fan Heater )

What can I do here?
Thx!!!

image

[3/17/2021, 11:21:14 AM] [miot] Initializing devices [3/17/2021, 11:21:14 AM] [miot] [Smartmi Smart Fan Heater] Got device configuration, initializing device with name: Smartmi Smart Fan Heater [3/17/2021, 11:21:14 AM] [miot] [Smartmi Smart Fan Heater] Device model known: zhimi.heater.na1! Creating device! [3/17/2021, 11:21:14 AM] [miot] [Smartmi Smart Fan Heater] Initializing device properties [3/17/2021, 11:21:14 AM] [miot] [Smartmi Smart Fan Heater] Initializing device capabilities [3/17/2021, 11:21:14 AM] [miot] [Smartmi Smart Fan Heater] Device not supported! Using a generic device with limited properties! Consider requesting device support! [3/17/2021, 11:21:14 AM] [miot] [Smartmi Smart Fan Heater] Initializing accessory! [3/17/2021, 11:21:14 AM] [miot] [Smartmi Smart Fan Heater] Accessory successfully initialized!

Issue with JSON and MiCloud

I'm currently using this, for the lack of a better example. Can you help me format the micloud?

        {
            "platform": "miot",
            "devices": [
                {
                    "name": "Air Purifier",
                    "deviceId": "ID",
                    "ip": "ip",
                    "token": "token",
                    "fanLevelControl": true,
                    "modeControl": true,
                    "micloud": [
                        {
                            "username": "email",
                            "password": "pass",
                            "country": "de"
                        }
                    ]
                }
            ]
        }

Smartmi Air Purifier

Hello,

the Smartmi Air Purifier (zhimi.airpurifier.za1) is listed as a supported device, but I can't get it to work properly.
To determine its token, I reset the purifier's WiFi and read the token with miio discover.
Then I connected the purifier to my network via the Mi-Home app on my phone.
Then I installed homebridge-miio on my raspberry pi (which already had homebridge installed and working well with other devices ) and configured it accordingly. The configuration looks like this:

{
    "bridge": {
        "name": "homebridge 0322",
        }, "username": "xx:xx:xx:xx:xx",
        "port": xxxxx,
        }, "pin": "xxx-xx-xxx"
    },
    }, "platforms": [
        {
            }, "devices": [
                {
                    }, "name": "smartmi air purifier",
                    }, "ip": "192.168.10.62",
                    }, "token": "xxxxxxxxxxxxxxxxxxxxxxxx",
                    }, "model": "zhimi.airpurifier.za1",
                    }, "pollingInterval": 5,
                    "buzzerControl": true,
                    "childLockControl": true,
                    "ledControl": true,
                    "horizontalSwingControl": false,
                    "verticalSwingControl": false,
                    "horizontalMoveControl": false,
                    "verticalMoveControl": false,
                    "fanLevelControl": true,
                    "ioniserControl": false,
                    "shutdownTimer": false,
                    "heatLevelControl": false,
                    "screenControl": true,
                    "dryModeControl": true,
                    "modeControl": false,
                    "lightModeControl": false,
                    "lightShutdownTimer": false,
                    "motorControl": true,
                    "motorReverseControl": false,
                    "heaterControl": true
                }
            ],
            }, "platform": "miot"
        }
    ]
}

Is there anything wrong with the procedure or are there any settings I should change?
Thanks in advance

Fan model missing - Mi Smart Fan 1X

Hi will it be possible to add support for Fan Mi Smart Fan 1X (dmaker.fan.p5).
Currently its is not supported and the configuration is not saved.

Vacuum showing as a fan

Hi, I have both a vacuum and a fan by Xiaomi and they both show up as fans in HomeKit, which creates issues when controlling HomeKit with Siri.

Would it be possible to differentiate the devices, ie. make all vacuums show up only as smart plugs?

help to add support for xiaomi ceiling fans

Hi,

I have xiaomi ceiling fans and opple ceiling fans at home. I am wondering if you'd be able to add support to these two devices mainly below. Both devices are miot devices added to xiaomi home app. Currently there is no way to add them to homebridge. Please let me know if you need more info on the devices listed below or if you need me to extract data for them
opplefanlight

. Thanks

  1. yeelink.light.fancl1 (Yeelight Smart Ceiling Fan)
  2. opple.light.fanlight

p.s. I have also tried adding these with its tokens to miot plugin. But i cannot seem to get it to work. I can see the fan accessory in homebridge but it doesnt respond to powering on or off.

Stepped fan to use slider setting

Hi Merdok,

I created this issue before on the Mi fan plugin, which I currently use on the 1.3.1 version, but I would like to ask you to consider this again.

For fans with multiple steps, the are now toggles created for each fan speed. I think it would make more sense to use the old behaviour to have a slider that automatically adjusts to the closest value possible.
I understand that the current implementation is better from a technical standpoint but when using the Home app the old implementation just works way better. Could you add a toggle in the settings to use the slider behaviour?

Again, thank you for this excellent plugin!
Stijn

MiCloud 2h Air purifier

I’ve noticed that Air purifier 2h add my micloud account doesn’t have fan control at all :)
3042B11E-C0E2-4547-9FF7-D7A353F187B6
B4FFEF6F-626F-4B86-A9AD-F64D34ED13D9

Add support for dreame.vacuum.mc1808

Hey,

Could you please add support for this model? I can help with logs & tests. I've already tried to connect the vacuum via this plugin and it seems to connect fine just actions are not working.
After pressing turn on in Homekit it shows there that it's turned on but after 1-2 secs it becomes turned off again.

Get state of air quality / pm when Air purifier is inactive

Hi,
First thanks for the great plugin. Everything works fine, except of one thing.

I use the Air purifier 3C and want to define that it is off if quality is good and turns on in automatically mode when it is bad. The thing I noticed is that the plug-in does not get the changed air quality if the device is in off state. If I open the Mi home app it will get it and the automation runs. But without opening the the mi home app. I also have a 2H and use it with other plug-in and it gets the state of air quality without opening the app.

Is there a way to force to get the air quality state when device is inactive?

help to add dooya.curtain.m2

Hi marcin,

thanks again for the help in adding my devices to the plugin.

This is the data of the curtain

hoobs@hoobs:~ $ miio protocol call 192.168.100.81 get_properties '[{"did":"244127254","siid": 2,"piid":4}]'
INFO Attempting to call get_properties on 192.168.100.81

INFO Device found, making call

INFO Got result:
[
{
"did": "244127254",
"siid": 2,
"piid": 4,
"code": 0,
"value": 1
}
]

oobs@hoobs:~ $ miio protocol call 192.168.100.81 get_properties '[{"did":"244127254","siid": 1,"piid":1}]'
INFO Attempting to call get_properties on 192.168.100.81

INFO Device found, making call

INFO Got result:
[
{
"did": "244127254",
"siid": 1,
"piid": 1,
"code": -4004
}
]

hoobs@hoobs:~ $ miio protocol call 192.168.100.81 get_properties '[{"did":"244127254","siid": 2,"piid":8}]'
INFO Attempting to call get_properties on 192.168.100.81

INFO Device found, making call

INFO Got result:
[
{
"did": "244127254",
"siid": 2,
"piid": 8,
"code": 0,
"value": false
}
]

hoobs@hoobs:~ $ miio protocol call 192.168.100.81 get_properties '[{"did":"244127254","siid": 2,"piid":6}]'
INFO Attempting to call get_properties on 192.168.100.81

INFO Device found, making call

INFO Got result:
[
{
"did": "244127254",
"siid": 2,
"piid": 6,
"code": 0,
"value": 0
}
]

hoobs@hoobs:~ $ miio inspect 192.168.100.81
INFO Attempting to inspect 192.168.100.81

Device ID: 244127254
Model info: dooya.curtain.m2
Address: 192.168.100.81
Token: dc28025c65b38b95d5c0492a79fc86b9 via stored token
Support: At least generic

Type info: miio
Capabilities:

Firmware version: 2.1.3
Hardware version: esp8266
MCU firmware version: 0009

WiFi: merv_S1 (E0:63:DA:EA:A1:09) RSSI: -64
WiFi firmware version: 8903c22

Remote access (Mi Home App): Maybe

Open settings in browser cause high 100% cpu

I'm using homebridge from today so haven't got much info, but just installed this plugin and when i open it's settings popup it kills my chrome with high 100% cpu.
When i have time before it freezes out and close the settings popup it just immediately fix it so the cpu usege drops back to normal.

Can't see any error logs in devtools.

Versions:
macOS 11.3.1 (20E241) (Big Sur)
Chrome: 90.0.4430.85
Node.js: v14.16.0
Npm: v7.11.2
Homebridge: v1.3.4
homebridge-config-ui-x: v4.41.1
omebridge-miot: v0.7.4

update: just tried it in safari and there's no problem so something goes wrong with chrome

Smartmi Air Purifier TVOC

I use two Smartmi Air Purifier which work nice with miot. But the don't only have PM2.5, they also monitor TVOC (gas concentration). Is it possible to give this value to Homekit?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.