lprhodes / homebridge-broadlink-rm

Broadlink RM Mini and Pro plugin for homebridge: https://github.com/nfarina/homebridge
Apache License 2.0
575 stars 283 forks source link

Homebridge getting slow. #370

Open luvmex opened 6 years ago

luvmex commented 6 years ago

I got and wired problem.

The version 3.5.5 in Hombridge will connect very slowly in Home app with Broadlink Pro Plugin, the accessorize status is "Updating" and for a while will transfer to "not responded". It has to be refresh again and again.

And I'm trying to restart the Homebridge with Pi, in this moment the Home app works well, and after 1 mins or reopen Home app again then all the accessorize status will be "Updating" to connect very slow, something and get "no responded" again still I have to reopen the Home App and reflash to let it works.

Every time when I open the Home app it will happened again...

And I watch the log for few minutes the device will no longer reachable and then suddenly re-discovered itself in repeatedly.

Broadlink RM device at 10.0.1.2 (xxx) is no longer reachable. Broadlink RM device at 10.0.1.2 (xxx) has been re-discovered.

It's quite annoying when I just want to open the Blind or AirPurifier and I launch the Home app I have to wait for the loop with the "updating", Refresh and Reopen then connect to work. this loop waste for 2 or 5 mins.

When I remove the BroadlinkRM from config.js that the other accessorize connect very well. I have no idea whats going wrong, is that anyone faces the same problem?

Thanks.

cubilon commented 6 years ago

seems like something wrong with your network and/or with the Broadlink device. sure is everything ok?

luvmex commented 6 years ago

My network base on AppleExtreme(1F, speed 198 down & 102 up) and cable extend with AppleExpress(2F, speed 92down & 76up).

All the device setup for: 1F - 3 devices connect 2.4Ghz wifi include Broadlink RM & 1 device for 5Ghz 2F - 5 devices connect through Bluetooth, 1 device with 2.4Ghz wifi and 5 devices for 5Ghz

I have used those devices for few months. I'm not sure which will affect the BroadlinkRM, it just happened in this coming days.

Just testing the BroadlinkRM connection. In the "Home app" will still connect for few munites but when I use the "e-Control app" it can control immediately. So I have no idea what is the problem between the Raspberry and RM pro or other situations.

Thank you~

cubilon commented 6 years ago

strange behaviour. now idea right now; in the meantime, did you already tried removing cachedAccessory file on homebridge installation directory?

luvmex commented 6 years ago

I remove the cachedAccesorry but doesn't work so I reinstall all the plugin include homebridge, and now get more wired ...

I got the log as below [2018-5-4 22:01:44] Loaded plugin: homebridge-broadlink-rm [2018-5-4 22:01:44] Registering platform 'homebridge-broadlink-rm.BroadlinkRM' [2018-5-4 22:01:44] --- [2018-5-4 22:01:44] Loaded plugin: homebridge-mi-airpurifier [2018-5-4 22:01:44] Registering platform 'homebridge-mi-airpurifier.MiAirPurifierPlatform' [2018-5-4 22:01:44] --- [2018-5-4 22:01:44] Loaded plugin: homebridge-raspberrypi-temperature [2018-5-4 22:01:44] Registering accessory 'homebridge-raspberrypi-temperature.RaspberryPiTemperature' [2018-5-4 22:01:44] --- [2018-5-4 22:01:44] Loaded config.json with 1 accessories and 2 platforms. [2018-5-4 22:01:44] --- [2018-5-4 22:01:44] Loading 2 platforms... [2018-5-4 22:01:44] [MiAirPurifierPlatform] Initializing MiAirPurifierPlatform platform... [2018-5-4 22:01:44] [MiAirPurifierPlatform] [MiAirPurifierPlatform][INFO] [2018-5-4 22:01:44] [MiAirPurifierPlatform] [MiAirPurifierPlatform][INFO] MiAirPurifierPlatform v0.1.2 By YinHang [2018-5-4 22:01:44] [MiAirPurifierPlatform] [MiAirPurifierPlatform][INFO] GitHub: https://github.com/YinHangCode/homebridge-mi-airpurifier [2018-5-4 22:01:44] [MiAirPurifierPlatform] [MiAirPurifierPlatform][INFO] QQ Group: 107927710
[2018-5-4 22:01:44] [MiAirPurifierPlatform] [MiAirPurifierPlatform][INFO]
[2018-5-4 22:01:44] [MiAirPurifierPlatform] [MiAirPurifierPlatform][INFO]start success... [2018-5-4 22:01:44] [MiAirPurifierPlatform] [MiAirPurifierPlatform][DEBUG]Initializing MiAirPurifier2S device: 10.0.1.3, accessories size: 4 [2018-5-4 22:01:44] [MiAirPurifierPlatform] [MiAirPurifierPlatform][INFO]device size: 1, accessories size: 4 [2018-5-4 22:01:44] [MiAirPurifierPlatform] Initializing platform accessory 'MiAirPurifier2S'... [2018-5-4 22:01:44] [MiAirPurifierPlatform] Initializing platform accessory 'MiAirPurifier2S Temperature'... [2018-5-4 22:01:44] [MiAirPurifierPlatform] Initializing platform accessory 'MiAirPurifier2S Humidity'... [2018-5-4 22:01:44] [MiAirPurifierPlatform] Initializing platform accessory 'MiAirPurifier2S AirQuality'... [2018-5-4 22:01:44] [Broadlink RM] Initializing BroadlinkRM platform... [2018-5-4 22:01:44] [Broadlink RM] [INFO] Automatically discovering Broadlink RM devices. [2018-5-4 22:01:44] [Broadlink RM] [INFO] Running Homebridge Broadlink RM Plugin version 3.5.5 [2018-5-4 22:01:44] [Broadlink RM] Blink Accessory Ready [2018-5-4 22:01:44] [Broadlink RM] Air Conditioner Accessory Ready [2018-5-4 22:01:44] [Broadlink RM] Initializing platform accessory 'Blink'... [2018-5-4 22:01:44] [Broadlink RM] Initializing platform accessory 'Air Conditioner'... [2018-5-4 22:01:44] Loading 1 accessories... [2018-5-4 22:01:44] [ResPi Temp] Initializing RaspberryPiTemperature accessory... [2018-5-4 22:01:44] [ResPi Temp] update currentTemperatureCharacteristic value: 58.533 Load homebridge-mi-airpurifier.MiAirPurifierPlatform [2018-5-4 22:01:44] Homebridge is running on port 52531. [2018-5-4 22:01:44] [Broadlink RM] Blink getCurrentPosition: 31 [2018-5-4 22:01:44] [Broadlink RM] Blink getPositionState: 2 [2018-5-4 22:01:44] [Broadlink RM] Blink getTargetPosition: 31 [2018-5-4 22:01:44] [Broadlink RM] Air Conditioner getCurrentHeatingCoolingState: 2 [2018-5-4 22:01:44] [Broadlink RM] Air Conditioner getTargetTemperature: 26 [2018-5-4 22:01:44] [Broadlink RM] Air Conditioner getTargetHeatingCoolingState: 2 [2018-5-4 22:01:48] [Broadlink RM] Blink setTargetPosition: 0 [2018-5-4 22:01:48] [Broadlink RM] Blink getCurrentPosition: 31 [2018-5-4 22:01:48] [Broadlink RM] Blink getTargetPosition: 0 [2018-5-4 22:01:48] [Broadlink RM] Blink setTargetPosition: (currentPosition: 31) [2018-5-4 22:01:48] [Broadlink RM] Blink setPositionState: 0 [2018-5-4 22:01:48] [Broadlink RM] Blink setTargetPosition: currently 31%, moving to 0% [2018-5-4 22:01:48] [Broadlink RM] [ERROR] Blink sendData (no device found) [2018-5-4 22:01:48] [Broadlink RM] Blink setTargetPosition: 3.1s (10 / 100 * 31) until auto-stop [2018-5-4 22:01:48] [Broadlink RM] Blink setCurrentPosition: 30 [2018-5-4 22:01:48] [Broadlink RM] Blink setCurrentPosition: 29 [2018-5-4 22:01:48] [Broadlink RM] Blink setCurrentPosition: 28 2018-5-4 22:05:52] [Broadlink RM] Blink setCurrentPosition: 0 [2018-5-4 22:07:20] [Broadlink RM] Air Conditioner setTargetTemperature: 22 [2018-5-4 22:07:20] [Broadlink RM] Air Conditioner Potential sendTemperature (22) [2018-5-4 22:07:20] [Broadlink RM] Air Conditioner sendTemperature (22 [2018-5-4 22:07:20] [Broadlink RM] [ERROR] Air Conditioner sendData (no device found) [2018-5-4 22:07:20] [Broadlink RM] Air Conditioner sendTemperature (set mode to cool [2018-5-4 22:07:20] [Broadlink RM] Air Conditioner getCurrentHeatingCoolingState: 0 [2018-5-4 22:07:20] [Broadlink RM] Air Conditioner getTargetHeatingCoolingState: 2 [2018-5-4 22:07:21] [Broadlink RM] Air Conditioner setCurrentHeatingCoolingState: 2

The Home App was worked but didn't trigger the Broadlink RM the send the hex code to AC or Blink.. But the Xiaomi Air purifier just work fine for with homebridge.

Thanks.

cubilon commented 6 years ago

can u show us your config json?

luvmex commented 6 years ago

{ "bridge": { "name": "RaspBridge", "username": "B9:37:E5:A5:41:A4", "port": 55535, "pin": "111-10-111" }, "accessories": [

    {
        "accessory": "RaspberryPiTemperature",
        "name": "ResPi Temp",
        "updateIntercal": 30000
    },

], "platforms": [ { "platform": "MiAirPurifierPlatform", "deviceCfgs": [ { "type": "MiAirPurifier2S", "ip": "10.0.1.15", "token": "...", "airPurifierDisable": false, "airPurifierName": "MiAirPurifier2S", "silentModeSwitchDisable": false, "silentModeSwitchName": "MiAirPurifier2S Silent Mode Switch", "temperatureDisable": false, "temperatureName": "MiAirPurifier2S Temperature", "humidityDisable": false, "humidityName": "MiAirPurifier2S Humidity", "buzzerSwitchDisable": false, "buzzerSwitchName": "MiAirPurifier2S Buzzer Switch", "ledBulbDisable": false, "ledBulbName": "MiAirPurifier2S LED Switch", "airQualityDisable": false, "airQualityName": "MiAirPurifier2S AirQuality" }] },

    {
        "platform": "BroadlinkRM",
        "name": "Broadlink RM",
        "hideScanFrequencyButton": false,
        "hideLearnButton": false,
        "homebridgeDirectory": "/var/homebridge/",
        "accessories": [
        {
            "name": "RM Pro Learn",
            "type": "learn-code",
            "host": "10.0.1.13",
            "disableAutomaticOff": false,
            "scanFrequency": false
        },
        {
            "name":"Blink",
            "type":"window-covering",
            "totalDurationOpen": 45,
            "totalDurationClose": 40,
            "data":{
                "open": "...",
                "close": "...",
                "stop": "...",
            }
        },

        {
            "name": "Air Conditioner Advanced",
            "type": "air-conditioner",
            "defaultCoolTemperature": 23,
            "defaultHeatTemperature": 27,
            "data":
            {
                "off": "...",
                "temperature27":
                {
                    "pseudo-mode": "heat",
                    "data": ""
                },
                "temperature23":
                {
                    "pseudo-mode": "cool",
                    "data": "..."
                },
                "temperature22":
                {
                    "pseudo-mode": "cool",
                    "data": "..."
                },
                "temperature21":
                {
                    "pseudo-mode": "cool",
                    "data": "..."
                },
                "temperature20":
                {
                    "pseudo-mode": "cool",
                    "data": "..."

                },
                "temperature19":
                {
                    "pseudo-mode": "cool",
                    "data": "..."
                },
                "temperature18":
                {
                    "pseudo-mode": "cool",
                    "data": "..."
                }
            }
        }]
    }
]

}

Here is my config.json, and I set another homebridge same as an original folder in " /var/homebridge ". both include same accessories same persist and same config.js setting, And this folder is set for Broadlink RM Pro in systemctl to auto restart the raspberry.

cubilon commented 6 years ago

where is declared 10.0.1.2?

luvmex commented 6 years ago

Did you mean the "learn-code" address?

After that post here, I just update to 10.0.1.2, but still has the problem.

cubilon commented 6 years ago

becouse you got only onle Broadlink, try removing the - "host": "10.0.1.13" - entry (btw I don't understand why you had 10.0.1.13 and not 10.0.2.2, it's a little bit confusing to me).

luvmex commented 6 years ago

I revise this below and run for few days but the situation still happen.

{ "platform": "BroadlinkRM", "name": "Broadlink RM", "hideScanFrequencyButton": false, "hideLearnButton": false, "homebridgeDirectory": "/var/homebridge/", "accessories": [ { "name":"Blink", "type":"window-covering", "totalDurationOpen": 45, "totalDurationClose": 40, "data":{ "open": "...", "close": "...", "stop": "...", } },

    {
        "name": "Air Conditioner Advanced",
        "type": "air-conditioner",
        "defaultCoolTemperature": 23,
        "defaultHeatTemperature": 27,
        "data":
        {
            "off": "...",
            "temperature27":
            {
                "pseudo-mode": "heat",
                "data": ""
            },
            "temperature23":
            {
                "pseudo-mode": "cool",
                "data": "..."
            },
            "temperature22":
            {
                "pseudo-mode": "cool",
                "data": "..."
            },
            "temperature21":
            {
                "pseudo-mode": "cool",
                "data": "..."
            },
            "temperature20":
            {
                "pseudo-mode": "cool",
                "data": "..."

            },
            "temperature19":
            {
                "pseudo-mode": "cool",
                "data": "..."
            },
            "temperature18":
            {
                "pseudo-mode": "cool",
                "data": "..."
            }
        }
    }]
}

]

And I think maybe is the wifi frequency conflict so I test and change to best channel for 2.4Ghz. In the change moment, it's very smoothly for launch "Home app" for the first time, and if I reopen "Home App" again that will become the same situation...

Still updating still timeout, still connect for a long time.

cubilon commented 6 years ago

try this way:

{
    "platform": "BroadlinkRM",
    "name": "Broadlink RM",
    "hideScanFrequencyButton": false,
    "hideLearnButton": false,
    "accessories": [{
            "accessory": "Broadlink RM Learner",
            "name": "Learn IR",
            "type": "switch",
            "host": "10.0.2.2"
        },
        {
            "name": "Blink",
            "type": "window-covering",
            "totalDurationOpen": 45,
            "totalDurationClose": 40,
            "host": "10.0.2.2",
            "data": {
                "open": "...",
                "close": "...",
                "stop": "..."
            }
        },

        {
            "name": "Air Conditioner Advanced",
            "type": "air-conditioner",
            "defaultCoolTemperature": 23,
            "defaultHeatTemperature": 27,
            "host": "10.0.2.2",
            "data": {
                "off": "...",
                "temperature27": {
                    "pseudo-mode": "heat",
                    "data": ""
                },
                "temperature23": {
                    "pseudo-mode": "cool",
                    "data": "..."
                },
                "temperature22": {
                    "pseudo-mode": "cool",
                    "data": "..."
                },
                "temperature21": {
                    "pseudo-mode": "cool",
                    "data": "..."
                },
                "temperature20": {
                    "pseudo-mode": "cool",
                    "data": "..."

                },
                "temperature19": {
                    "pseudo-mode": "cool",
                    "data": "..."
                },
                "temperature18": {
                    "pseudo-mode": "cool",
                    "data": "..."
                }
            }
        }
    ]
}
luvmex commented 6 years ago

I have tried to add the host address for each accessory but... still goes intermittently.

Does that happen cause I update my OS to 11.3.1 for both TV & iPhone?

cubilon commented 6 years ago

I don't think so!

luvmex commented 6 years ago

pi@raspberrypi:~ $ sudo systemctl status homebridge ● homebridge.service - Node.js HomeKit Server Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2018-05-09 22:03:53 CST; 14s ago Main PID: 14661 (homebridge) CGroup: /system.slice/homebridge.service ├─14661 homebridge └─14760 /bin/ping -n -w 2 -c 1 10.0.1.2

pi@raspberrypi:~ $ sudo systemctl status homebridge ● homebridge.service - Node.js HomeKit Server Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2018-05-09 22:03:53 CST; 1min 0s ago Main PID: 14661 (homebridge) CGroup: /system.slice/homebridge.service └─14661 homebridge ///////////////

What is the "14760 /bin/ping -n -w 2 -c 1 10.0.1.2" mean? Sometime will not have this status log.. and this moment the problem shows up.

If I got this status log things will be normal.

cubilon commented 6 years ago

it means that the service uses ping command with this parameters:

-n Numeric output only. No attempt will be made to lookup symbolic names for host addresses. -w 2 deadline Specify a timeout, in seconds, before ping exits regardless of how many packets have been sent or received. In this case ping does not stop after count packet are sent, it waits either for deadline expire or until count probes are answered or for some error notification from network. -c 1 count Stop after sending count ECHO_REQUEST packets. With deadline option, ping waits for count ECHO_REPLY packets, until the timeout expires.

luvmex commented 6 years ago

Seems I got the problem

[2018-5-9 22:50:22] [Broadlink RM] Air Conditioner addTemperatureCallbackToQueue (requested temperature from device, waiting) [2018-5-9 22:50:22] [Broadlink RM] Air Conditioner getCurrentHeatingCoolingState: 0 [2018-5-9 22:50:22] [Broadlink RM] Air Conditioner getTargetTemperature: undefined [2018-5-9 22:50:22] [Broadlink RM] Air Conditioner getTargetHeatingCoolingState: 0

Always, I reopen the Home app will get this log and get timeout so the accessories become "No Respond". when I remove the "Air Conditioner Advance" from config.js then everything is smooth!

cubilon commented 6 years ago

try removing:

"defaultCoolTemperature": 23, "defaultHeatTemperature": 27,

luvmex commented 6 years ago

I have tried to move this two-line and also make the Air Condition as simple as possible. Then I modify AC part as below:

        {
        "name": "Air Conditioner",
        "type": "air-conditioner",
        "data": {
            "off": "...",
            "temperature27": {
                "pseudo-mode": "heat",
                "data": ""
            },
            "temperature23": {
                "pseudo-mode": "cool",
                "data": "..."
            }
        }
    }

And till now for 8 hours, It works fine and Home app is very quick to update and no "No Respond" anymore. Maybe there is something wrong to let the RM device disconnect itself and made timeout?

Finally, It's normal now, but I will still be tracking this wired situation.

cubilon commented 6 years ago

This is a case con @lprhodes. we must wait for his comeback.

luvmex commented 6 years ago

I try this code " temperatureUpdateFrequency " when setting over 60(1min) then the device will get lost too.

By the way, there is some other issue that I using the "Air Condition", It couldn't be close in the Home app automatic scenario.

Situation 1, I set automation at 4:00 am to close AC. When times up it will send the "Close Hex", but immediately also send the other "temp23 Hex" to open it, the AC doesn't really close it just reopen again.

Situation 2, I had tried to install the "Homebridge-Occupancy-Delay" and want to set the timing after 3 hours to close AC but the same problem as situation 1, It just reopen again.

Thanks for @cubilon your help, hope those clue could help creator get some idea or declare the issue.

cubilon commented 6 years ago

Sit1, even if you set "preventResendHex" as true? Sit2, "Homebridge-Occupancy-Delay" is new to me, need to understand how it works :) u welcome!

luvmex commented 6 years ago

Sit1, It works!! Thanks! Sit2, "Homebridge-Occupancy-Delay" if set delay 5 sec it's worked, but I when set 14400( 4 hours ). That will make device timeout. In the Home app I can manipulate the accessories and the RM Plugin still running the code, but the log will show "No Device Found".

[Broadlink RM] [ERROR] Blink sendData (no device found) [Broadlink RM] Blink setTargetPosition: 2s (10 / 100 * 20) until auto-stop [Broadlink RM] Blink setCurrentPosition: 19 [Broadlink RM] Blink setCurrentPosition: 18 [Broadlink RM] Blink setCurrentPosition: 17