merdok / homebridge-miot

Homebridge plugin for devices supporting the Xiaomi miot protocol
MIT License
383 stars 62 forks source link

Add support for Xiaomi Heater #405

Closed mtbhomer closed 1 year ago

mtbhomer commented 1 year ago

Hello, is it possible to add support for Xiaomi Heater (leshow-bs1)? When I add it in the config the following messages are generated in the log:

[12/10/2022, 8:16:58 PM] [miot] [Heater] Initializing device actions [12/10/2022, 8:16:58 PM] [miot] [Heater] Successfully created a Heater device! It is a Unknown heater device. [12/10/2022, 8:16:58 PM] [miot] [Heater] Initializing accessory! [12/10/2022, 8:16:58 PM] [miot] [Heater] Accessory successfully initialized! [12/10/2022, 8:16:58 PM] [miot] [Heater] Registering 1 accessories! [12/10/2022, 8:16:58 PM] [miot] [Heater] Everything looks good! Initiating property polling! [12/10/2022, 8:16:58 PM] [miot] [Heater] Device found! Setting up miot device from local connection! [12/10/2022, 8:16:58 PM] [miot] [Heater] Connected to device: leshow.heater.bs1 [12/10/2022, 8:16:58 PM] [miot] [Heater] Doing initial property fetch. [12/10/2022, 8:16:58 PM] [miot] [Heater] Starting property polling. [12/10/2022, 8:17:38 PM] [miot] [Heater] Poll failed 4 times in a row! Stopping polling and trying to reconnect! Reason: Error: Invalid json.

I tried adding the heater as model leshow-bs1s (which is already available) which generates the following messages:

[12/10/2022, 8:14:34 PM] [miot] [Heater] Initializing device actions [12/10/2022, 8:14:34 PM] [miot] [Heater] Successfully created a Heater device! It is a Mi Smart Baseboard Heater 1S. [12/10/2022, 8:14:34 PM] [miot] [Heater] Initializing accessory! [12/10/2022, 8:14:34 PM] [miot] [Heater] Accessory successfully initialized! [12/10/2022, 8:14:34 PM] [miot] [Heater] Registering 1 accessories! [12/10/2022, 8:14:34 PM] [miot] [Heater] Everything looks good! Initiating property polling! [12/10/2022, 8:14:34 PM] [miot] [Heater] Device found! Setting up miot device from local connection! [12/10/2022, 8:14:34 PM] [miot] [Heater] Connected to device: leshow.heater.bs1 [12/10/2022, 8:14:34 PM] [miot] [Heater] Doing initial property fetch. [12/10/2022, 8:14:35 PM] [miot] [Heater] Starting property polling. [12/10/2022, 8:15:15 PM] [miot] [Heater] Poll failed 4 times in a row! Stopping polling and trying to reconnect! Reason: Error: Invalid json.

I found the spec here

Any chance to support the device in the next update? Thanks a lot!

merdok commented 1 year ago

Sure, will add support in the next update, but i am not quite saure from where the error comes. Can you additional post some homebridge debug log?

mtbhomer commented 1 year ago

Thanks @merdok! Here is the full log:

[37m[12/10/2022, 7:45:26 PM] [miot] [Heater] Model unknown! Starting device discovery! [12/10/2022, 7:45:27 PM] [miot] [Heater] Device found! Setting up miot device from local connection! [12/10/2022, 7:45:27 PM] [miot] [Heater] Did not specified. Got did: 274545712 from device! [12/10/2022, 7:45:27 PM] [miot] [Heater] Connected to device: leshow.heater.bs1 [12/10/2022, 7:45:27 PM] [miot] [Heater] Device identified! Model: leshow.heater.bs1 [12/10/2022, 7:45:27 PM] [miot] [Heater] Initializing device! [12/10/2022, 7:45:27 PM] [miot] [Heater] Fetching device miot spec by model: leshow.heater.bs1 [12/10/2022, 7:45:30 PM] [miot] [Heater] Successfully got device miot spec! [12/10/2022, 7:45:30 PM] [miot] [Heater] Spec device type: heater description: Heater [12/10/2022, 7:45:30 PM] [miot] [Heater] Using module class for device type Heater, indentified by miot spec! Not all features might work! [12/10/2022, 7:45:30 PM] [miot] [Heater] Initializing device services [12/10/2022, 7:45:30 PM] [miot] [Heater] Device services: [ "heater", "countdown", "environment", "physical-controls-locked", "alarm" ] [12/10/2022, 7:45:30 PM] [miot] [Heater] Initializing device properties [12/10/2022, 7:45:30 PM] [miot] [Heater] Device properties: [ "heater:on", "heater:mode", "heater:target-temperature", "heater:temperature", "countdown:countdown-time", "environment:temperature", "physical-controls-locked:physical-controls-locked", "alarm:alarm" ] [12/10/2022, 7:45:30 PM] [miot] [Heater] Initializing device actions [12/10/2022, 7:45:30 PM] [miot] [Heater] Successfully created a Heater device! It is a Unknown heater device. [12/10/2022, 7:45:30 PM] [miot] [Heater] Initializing accessory! [12/10/2022, 7:45:30 PM] [miot] [Heater] Accessory successfully initialized! [12/10/2022, 7:45:30 PM] [miot] [Heater] Registering 1 accessories! [12/10/2022, 7:45:30 PM] [miot] [Heater] Everything looks good! Initiating property polling! [12/10/2022, 7:45:30 PM] [miot] [Heater] Doing initial property fetch. [12/10/2022, 7:45:30 PM] [miot] [Heater] Starting property polling. [12/10/2022, 7:46:10 PM] [miot] [Heater] Poll failed 4 times in a row! Stopping polling and trying to reconnect! Reason: Error: Invalid json.

merdok commented 1 year ago

@mtbhomer thanks, can you also please enable the deepDebugLog and try again?

mtbhomer commented 1 year ago

@mtbhomer thanks, can you also please enable the deepDebugLog and try again?

@merdok deepDebugLog was already enabled in the log message above. I'm using the following config:

    {
        "micloud": {
            "username": "x",
            "password": "x",
            "country": "cn"
        },
        "devices": [
            {
                "name": "Heater",
                "ip": "x",
                "token": "x",
                "deepDebugLog": true
            }
        ],
        "platform": "miot"
    }

I also found it strange there's no other debug message in the log about what's going wrong exactly. Thanks!

merdok commented 1 year ago

Well that is strange, i would recommend then that you wait for the next update...

mtbhomer commented 1 year ago

Well that is strange, i would recommend then that you wait for the next update...

Sure, will test again after the update, thanks for you efforts!

merdok commented 1 year ago

Should now be available in 1.5.0