Trying to control dmaker.fan.1c with OpenHab

I recently bought a “smart standing fan 1C” from Xiaomi and paired it with the App. Now I am trying to get it to work with OpenHab. I had the miio binding installed already for my roborock vacuum.

In the paperUI the thing was autodetected as miio:generic:IDIDIDID with the model ID dmaker.fan.1c^. I tried to use items like

Switch  power            "Power"            (G_fan)     {channel="miio:basic:IDIDIDID:power"}

but while the thing is online none of the items are picking up state changes and I can not power the fan up or down via Openhab. Does anyone know how to control this fan?

1 Like

Same issue here, but I would assume that the fan is just so new, that it is not supported, yet. And I think the “Power” command from the generic-device is not the right on.

Some first Informations here:

Data from the Miio-Binding:
image

Screenshot of the device in the Xiaomi Home app to see the available functions there:

And just as a site note: Even the german Xiaomi server did currently not support that device. I wasn’t able to get it up and running with the Xiaomi Home app with region setting “Germany”, but with “China mainland” I get it instantly running.

@marcel_verpaalen, if you like you can tell how I can support you to integrate that device.

Regards,
Andreas

Please take a look at this topic and try out which commands are accepted

The first thing it to figure out if your devices address miio or miot. Depending which sort of finance are accepted we’ll know and than can create the right dB file

Suggest to reply on this topic to avoid the confusion on the models.

Maybe I doing something wrong but I always get an “user ack timeout”. Here is what I do/get:

ia Karaf I send:

openhab> smarthome:send XiaomiSmartFan1C_ExecuteCommand "get_prop[{\"did\":\"power\"},{\"siid\": 2},{\"piid\":1}]"

In the log I see

2020-08-13 12:09:59.550 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":616,"method":"get_prop","params":[{"did":"power"},{"siid":2},{"piid":1}]} -> 192.168.X.X (Device: 0E463FDD token: <TOKEN> Queue: 1)
2020-08-13 12:10:03.686 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for 0E463FDD type: GET_PROPERTY, result: {}, fullresponse: {"id":616,"error":{"code":-9999,"message":"user ack timeout"}}
2020-08-13 12:10:06.740 [DEBUG] [ernal.handler.MiIoUnsupportedHandler] - Periodic update for 'miio:generic:0E463FDD' (miio:unsupported)
2020-08-13 12:10:06.741 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":617,"method":"miIO.info","params":[]} -> 192.168.X.X (Device: 0E463FDD token: TOKEN Queue: 1)
2020-08-13 12:10:07.026 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for 0E463FDD type: MIIO_INFO, result: {"life":32210,"uid":6271696519,"model":"dmaker.fan.p8","token":"TOKEN","fw_ver":"2.0.4","mcu_fw_ver":"0003","miio_ver":"0.0.6","hw_ver":"esp8266","mmfree":25740,"mac":"MAC","wifi_fw_ver":"2709610","ap":{"ssid":"SSID","bssid":"BSSID","rssi":-56,"primary":11},"netif":{"localIp":"192.168.X.X","mask":"255.255.255.0","gw":"192.168.X.X"}}, fullresponse: {"id":617,"result":{"life":32210,"uid":6271696519,"model":"dmaker.fan.p8","token":"TOKEN","fw_ver":"2.0.4","mcu_fw_ver":"0003","miio_ver":"0.0.6","hw_ver":"esp8266","mmfree":25740,"mac":"MAC","wifi_fw_ver":"2709610","ap":{"ssid":"SSID","bssid":"BSSID","rssi":-56,"primary":11},"netif":{"localIp":"192.168.X.X","mask":"255.255.255.0","gw":"192.168.X.X"}}}}}

Btw.: with “get_prop[{“did”:“power”,“siid”: 2,“piid”:1}]” I get an com.google.gson.stream.MalformedJsonException: Unterminated array

Maybe the solution is to use single quote around the whole one like this 'get_prop[{"did":"power","siid": 2,"piid":1}]' . What can also be extreemly tricky is that sometimes the double quotes are magically replaced while copy pasting to opening & closing quotes. hard to see, but definately will give errors like this.

so to try if it is a miio device execute these:
get_prop["power", "mode", "speed", "roll_enable", "roll_angle", 'time_off", "light", 'beep_sound", "child_lock"]

please also try get_prop["all"] or individual one e.g. get_prop["power"]

To test if it is a miot device use this one (NOTE The difference in get_prop & get properties!!, your example had the wrong combi)
'get_properties[{"did": "power", "siid": 2, "piid": 1} ]'

Alternatively to test if it is a miot device copy the p9 file, copy it to the local folders as described and change the model in the thing config to p9

I already build a json for the p8 based on the data from http://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:fan:0000A005:dmaker-p8:1 and tested it successfully:

dmaker.fan.p8-miot.json (4.9 KB)

For me this is working as it should. I just copied it as discripted to the created folder “miio” in /misc and restarted the MIIO-Binding via karaf.

1 Like

@LastSamurai your dmaker.fan.1c device is a miot as well.
You can take the 2 example miot json files to get started. Look at http://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:fan:0000A005:dmaker-1c:1 for any other properties if the example files have missing / not wroking items.

@LastSamurai I compared the both definition files for dmaker.fan.p8 and dmaker.fan.c1 from miot-specs.org and with exception of the name they are identical. So I changed the “id” and saved it as dmaker.fan.c1-miot.json and here you are:

dmaker.fan.c1-miot.json (4.9 KB)

And here my Items-File if you like to reuse it:

Group               XiaomiSmartFan1C                        "Venti (Xiaomi SmartFan 1C)"                (All)
String              XiaomiSmartFan1C_SSID                   "Venti SSID [%s]"                           (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:network#ssid"}
String              XiaomiSmartFan1C_BSSID                  "Venti BSSID [%s]"                          (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:network#bssid"}
Number              XiaomiSmartFan1C_RSSI                   "Venti RSSI [%d]"                           (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:network#rssi"}
Number              XiaomiSmartFan1C_Live                   "Venti Live [%d]"                           (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:network#life"}
String              XiaomiSmartFan1C_ExecuteCommand         "Venti ExecuteCommand"                      (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:actions#commands"}
String              XiaomiSmartFan1C_Manufacturer           "Venti Manufacturer [%s]"                   (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:Manufacturer"}
String              XiaomiSmartFan1C_Model                  "Venti Model [%s]"                          (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:Model"}
String              XiaomiSmartFan1C_SerialNumber           "Venti SerialNumber [%s]"                   (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:SerialNumber"}
String              XiaomiSmartFan1C_FirmwareRevision       "Venti FirmwareRevision [%s]"               (XiaomiSmartFan1C)     {channel="miio:basic:a2f47d8e:FirmwareRevision"}
Switch              XiaomiSmartFan1C_Status                 "Venti Status"                              (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:On"}
Number              XiaomiSmartFan1C_Level                  "Venti Level [%d]"                          (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:FanLevel"}
Switch              XiaomiSmartFan1C_HorizontalSwing        "Venti Horizontal Swing"                    (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:HorizontalSwing"}
Number              XiaomiSmartFan1C_Mode                   "Venti Mode [%d]"                           (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:Mode"}
Number              XiaomiSmartFan1C_OffDelayTime           "Venti Power Off Delay Time [%d]"           (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:OffDelayTime"}
Switch              XiaomiSmartFan1C_Alarm                  "Venti Alarm"                               (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:Alarm"}
Switch              XiaomiSmartFan1C_Brightness             "Venti Brightness"                          (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:Brightness"}
Switch              XiaomiSmartFan1C_PhysicalControlsLocked "Venti Physical Control Locked"             (XiaomiSmartFan1C)     {channel="miio:basic:THINGID:PhysicalControlsLocked"}

And the part of my sitemap related to the fan (in with german labels - feel free to change):

Group                       item=XiaomiSmartFan1C                           label="Ventilator"
{
    Frame                                                                   label="Betrieb"
    {
        Switch          item=XiaomiSmartFan1C_Status                        label="Power"
        Switch          item=XiaomiSmartFan1C_Level                         label="Stufe []"                    mappings=[1="LOW", 2="MID", 3="HIGH"]
        Switch          item=XiaomiSmartFan1C_HorizontalSwing               label="Schwingen"
        Switch          item=XiaomiSmartFan1C_Mode                          label="Modus []"                    mappings=[0="Normal", 1="Natural"]
        Slider          item=XiaomiSmartFan1C_OffDelayTime                  label="Timer (min) [%d min]"        minValue=0      maxValue=480
    }
    Frame                                                                   label="Sonstiges"
    {
        Switch          item=XiaomiSmartFan1C_Alarm                         label="Bestätigungstöne"
        Switch          item=XiaomiSmartFan1C_Brightness                    label="Status LEDs"
        Switch          item=XiaomiSmartFan1C_PhysicalControlsLocked        label="Bediensperre"
        Group           item=XiaomiSmartFan1C                               label="weitere Daten"
        {
            Text        item=XiaomiSmartFan1C_Manufacturer                  label="Hersteller [%s]"
            Text        item=XiaomiSmartFan1C_Model                         label="Modell [%s]"
            Text        item=XiaomiSmartFan1C_SerialNumber                  label="Seriennummer [%s]"
            Text        item=XiaomiSmartFan1C_FirmwareRevision              label="Firmware Version [%s]"
            Text        item=XiaomiSmartFan1C_SSID                          label="SSID [%s]"
            Text        item=XiaomiSmartFan1C_BSSID                         label="BSSID [%s]"
            Text        item=XiaomiSmartFan1C_RSSI                          label="RSSI [%d]"
            Text        item=XiaomiSmartFan1C_Live                          label="Live [%d]"
        }
    }
}
3 Likes

Wow thank you (and @marcel_verpaalen) very much! This worked perfectly. I only had to restart OpenHab once to pick up the json file properly.
Is there any documentation out there on this process so I could figure this out on my own next time?

Well, there is the readme that tries to describe the process.
https://www.openhab.org/addons/bindings/miio/#advanced-unsupported-devices
https://www.openhab.org/addons/bindings/miio/#advanced-adding-local-database-files-to-support-new-devices

If you think that is not clear, or can be better… I happily accept your contribution in improving the documentation :muscle:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.