kiwi-cam / homebridge-broadlink-rm

[This fork supports TV accessories] Broadlink RM Mini and Pro plugin for homebridge: https://github.com/nfarina/homebridge
Apache License 2.0
304 stars 95 forks source link

HomeKit Automation - timed automation not turning on device #670

Open vancurad opened 11 months ago

vancurad commented 11 months ago

Describe the bug

Hi, to share some positive feedback, let me preface this first with: "I love this plugin!". My dumb pre-2010-or-so AC (Fujitsu ASU12RQ) that was forced on me by my apartment building is now alive and well in HomeKit through a connected Broadlink RM4 Pro (set up as heater/cooler) - no more picking up remote, walking to the AC, pointing, clicking, putting back the remote.

Now to the part I noticed not working as expected: I've set up my AC to start early morning and warm up my apartment. However I suspect the "turnOnWhenOff" logic isn't working correctly if run through an automation only.

Config

{
    "bridge": {
        "name": "Homebridge 70AE",
        "username": "<USER NAME>",
        "port": 51089,
        "pin": "<PIN>",
        "advertiser": "avahi"
    },
    "platforms": [
        {
            "platform": "BroadlinkRM",
            "name": "Broadlink RM",
            "hideWelcomeMessage": true,
            "accessories": [
                {
                    "name": "Air Conditioner",
                    "type": "heater-cooler",
                    "heatingThresholdTemperature": 20,
                    "data": {
                        "fanSpeed1": "<HEX>",
                        "heat": {
                            "on": "<HEX>",
                            "off": "<HEX>",
                            "temperatureCodes": {
                                "18": {
                                    "swingOff": "<HEX>"
                                },
                                "19": {
                                    "swingOff": "<HEX>"
                                },
                                "20": {
                                    "swingOff": "<HEX>"
                                },
                                "21": {
                                    "swingOff": "<HEX>"
                                },
                                "22": {
                                    "swingOff": "<HEX>"
                                },
                                "23": {
                                    "swingOff": "<HEX>"
                                },
                                "24": {
                                    "swingOff": "<HEX>"
                                },
                                "25": {
                                    "swingOff": "<HEX>"
                                },
                                "26": {
                                    "swingOff": "<HEX>"
                                },
                                "27": {
                                    "swingOff": "<HEX>"
                                },
                                "28": {
                                    "swingOff": "<HEX>"
                                },
                                "29": {
                                    "swingOff": "<HEX>"
                                },
                                "30": {
                                    "swingOff": "<HEX>"
                                }
                            }
                        },
                        "cool": {
                            "on": "<HEX>",
                            "off": "<HEX>",
                            "temperatureCodes": {
                                "18": {
                                    "swingOff": "<HEX>"
                                },
                                "19": {
                                    "swingOff": "<HEX>"
                                },
                                "20": {
                                    "swingOff": "<HEX>"
                                },
                                "21": {
                                    "swingOff": "<HEX>"
                                },
                                "22": {
                                    "swingOff": "<HEX>"
                                },
                                "23": {
                                    "swingOff": "<HEX>"
                                },
                                "24": {
                                    "swingOff": "<HEX>"
                                },
                                "25": {
                                    "swingOff": "<HEX>"
                                },
                                "26": {
                                    "swingOff": "<HEX>"
                                },
                                "27": {
                                    "swingOff": "<HEX>"
                                },
                                "28": {
                                    "swingOff": "<HEX>"
                                },
                                "29": {
                                    "swingOff": "<HEX>"
                                },
                                "30": {
                                    "swingOff": "<HEX>"
                                }
                            }
                        }
                    },
                    "autoHeatTemperature": 20,
                    "autoCoolTemperature": 28,
                    "defaultHeatTemperature": 30,
                    "defaultCoolTemperature": 20,
                    "tempStepSize": 1,
                    "temperatureDisplayUnits": "F",
                    "minTemperature": 18,
                    "maxTemperature": 30,
                    "hideLearnButton": true,
                    "hideScanFrequencyButton": true,
                    "turnOnWhenOff": true
                }
            ],
            "_bridge": {
                "username": "<USER NAME>",
                "port": 58217
            }
        },
        {
            "name": "Config",
            "port": 8581,
            "platform": "config"
        }
    ],
    "accessories": []
}

Logs at time when automation was supposed to turn on AC

[01/12/2023, 05:00:00] [Broadlink RM] Air Conditioner setSwingMode: 0
[01/12/2023, 05:00:00] [Broadlink RM] Air Conditioner setSwingMode: Changing swing from 0 to 1
[01/12/2023, 05:00:00] [Broadlink RM] Looking up temperature hex codes for 27
[01/12/2023, 05:00:00] [Broadlink RM] Hex codes not found for rotationSpeed
[01/12/2023, 05:00:00] [Broadlink RM]   Sending hex codes for temperature 27
[01/12/2023, 05:00:00] [Broadlink RM] Air Conditioner setTargetHeaterCoolerState: 1
[01/12/2023, 05:00:00] [Broadlink RM] Changing target state from 1 to 1
[01/12/2023, 05:00:00] [Broadlink RM] Looking up temperature hex codes for 27
[01/12/2023, 05:00:00] [Broadlink RM] Hex codes not found for rotationSpeed
[01/12/2023, 05:00:00] [Broadlink RM]   Sending hex codes for temperature 27
[01/12/2023, 05:00:00] [Broadlink RM] Air Conditioner setHeatingThresholdTemperature: 27
[01/12/2023, 05:00:00] [Broadlink RM] Air Conditioner setTemperature: Changing temperature from 27 to 27
[01/12/2023, 05:00:00] [Broadlink RM] Looking up temperature hex codes for 27
[01/12/2023, 05:00:00] [Broadlink RM] Hex codes not found for rotationSpeed
[01/12/2023, 05:00:00] [Broadlink RM]   Sending hex codes for temperature 27
[01/12/2023, 05:00:00] [Broadlink RM] Air Conditioner setActive: 1
[01/12/2023, 05:00:00] [Broadlink RM] Looking up temperature hex codes for 27
[01/12/2023, 05:00:00] [Broadlink RM] Hex codes not found for rotationSpeed
[01/12/2023, 05:00:00] [Broadlink RM]   Sending hex codes for temperature 27
[01/12/2023, 05:00:00] [Broadlink RM]   Adding ON code first
[01/12/2023, 05:00:00] [Broadlink RM] Air Conditioner setCoolingThresholdTemperature: 30
[01/12/2023, 05:00:00] [Broadlink RM] Air Conditioner setTemperature: Changing temperature from 30 to 27
[01/12/2023, 05:00:00] [Broadlink RM] Looking up temperature hex codes for 27
[01/12/2023, 05:00:00] [Broadlink RM] Hex codes not found for rotationSpeed
[01/12/2023, 05:00:00] [Broadlink RM]   Sending hex codes for temperature 27
[01/12/2023, 05:00:00] [Broadlink RM] Updated currentHeaterCoolerState to 2
[01/12/2023, 05:00:00] [Broadlink RM] Air Conditioner sendHex (<IP/MAC>) <HEX: 27 swing off>
[01/12/2023, 05:00:00] [Broadlink RM] Air Conditioner sendHex (<IP/MAC>) <HEX: 27 swing off>
[01/12/2023, 05:00:00] [Broadlink RM] Air Conditioner sendHex (<IP/MAC>) <HEX: 27 swing off>
[01/12/2023, 05:00:00] [Broadlink RM] Air Conditioner sendHex (<IP/MAC>) <HEX: on>
[01/12/2023, 05:00:00] [Broadlink RM] Air Conditioner sendHex (<IP/MAC>) <HEX: 27 swing off>
[01/12/2023, 05:00:00] [Broadlink RM] Air Conditioner setCurrentHeaterCoolerState: 2
[01/12/2023, 05:00:01] [Broadlink RM] Updated currentHeaterCoolerState to 2
[01/12/2023, 05:00:01] [Broadlink RM] Air Conditioner sendHex (<IP/MAC>) <HEX: 27 swing off>
[01/12/2023, 05:00:01] [Broadlink RM] Air Conditioner setCurrentHeaterCoolerState: 2

Logs at time when run manually

[01/12/2023, 07:32:36] [Broadlink RM] Air Conditioner setActive: 1
[01/12/2023, 07:32:36] [Broadlink RM] Looking up temperature hex codes for 24
[01/12/2023, 07:32:36] [Broadlink RM] Hex codes not found for rotationSpeed
[01/12/2023, 07:32:36] [Broadlink RM]   Sending hex codes for temperature 24
[01/12/2023, 07:32:36] [Broadlink RM]   Adding ON code first
[01/12/2023, 07:32:36] [Broadlink RM] Air Conditioner sendHex (<IP/MAC>) <HEX: on>
[01/12/2023, 07:32:37] [Broadlink RM] Air Conditioner setHeatingThresholdTemperature: 24
[01/12/2023, 07:32:37] [Broadlink RM] Air Conditioner setTemperature: Changing temperature from 24 to 24
[01/12/2023, 07:32:37] [Broadlink RM] Looking up temperature hex codes for 24
[01/12/2023, 07:32:37] [Broadlink RM] Hex codes not found for rotationSpeed
[01/12/2023, 07:32:37] [Broadlink RM]   Sending hex codes for temperature 24
[01/12/2023, 07:32:37] [Broadlink RM] Air Conditioner sendHex (<IP/MAC>) <HEX: 24 swing off>
[01/12/2023, 07:32:37] [Broadlink RM] Updated currentHeaterCoolerState to 2
[01/12/2023, 07:32:37] [Broadlink RM] Air Conditioner sendHex (<IP/MAC>) <HEX: 24 swing off>
[01/12/2023, 07:32:38] [Broadlink RM] Air Conditioner setCurrentHeaterCoolerState: 2

To Reproduce Steps to reproduce the behavior:

  1. Setup as described above.
  2. Setup timed automation (set temperature to x at time y)
  3. Turn off AC unit
  4. Wait for automation to play
  5. Notice: The AC unit isn't turned on, the temperature is sent according to logs though

Expected behavior

The behavior should be the same as when manually controlling the AC unit: When the automation time window is reached, turn on the unit (given turnOnWhenOff is true), then send the temperature.

Desktop (please complete the following information):

Smartphone (please complete the following information):