lprhodes / homebridge-broadlink-rm

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

Broadlink's TC2 Wall Switch does not consistently toggle via Homebridge/Siri but the official eControl app works every time #168

Open ipaqmaster opened 6 years ago

ipaqmaster commented 6 years ago

Attempting to learn our TC2 Switch's ON/OFF Code via the official e-Control app for iOS returns a very long hex string for ON and OFF which is a great start however entering them into the config.json as ON and OFF for the wall switch almost always does nothing when invoked via the Home app on iOS.

HomeBridge believes it sent the ON code (to the correct IP and MAC of the Broadlink device in charge) however there is no change in the switch state.

Edit: Tried a TC2 closer to the BroadLink device and it works however not this one, even though it works instantly in the e-Control app. Closing this issue for now, may reopen if determined the issue isn't just local.

Edit2: Reopened with more info.

ipaqmaster commented 6 years ago

the Broadlink e-Control app is able to toggle the switch via WiFi or 4G without issue -- however using the learned codes for Homebridge(with the Broadlink-rm Plugin) Toggling devices on and off is inconsistent; not always toggling them on or off.

The Broadlink RM device itself flashes the orange 'WiFi' LED light in both cases.. and from the official app works every time via WiFi or 4G. But doing so from a Siri Request/Apple Home > Homebridge... the Broadlink RM's Orange LED still flashes.. however more often than not, nothing happens..

ipaqmaster commented 6 years ago

My Config in this case

{
"bridge": {
"name": "Homebridge",
"username": "98:BE:94:47:4C:BC",
"port": 51826,
"pin": "031-45-157"
},
"description": "Home",
"platforms": [{
"platform": "BroadlinkRM",
"name": "Broadlink RM",
"hideScanFrequencyButton": true,
"hideLearnButton": false,
"accessories": [{
"name": "Office LightSwitch",
"type": "switch",
"disableAutomaticOff": true,
"onDuration": 5,
"data": {
"on": "aa00d802e10a0a170a170a17170a0a170a170a170a17170a170a0a250a17170a170a0a170a17170a0b17170a0a170a170a17170a0a170a170a170a170a170a170a170a17170ae00a0a170a170a17170a0a170a170a170a17170a170a0a170a17170a170a0a170a17170a0a17170a0a170a170a17170a0a170a170a170a170a170a170a170a17170ae00a0a180a170a17170a0a170a170a170a17170a170a0a170a17170a170a0a170a17170a0a17170a0a170a170a17170a0a170a170a170a170a170a170a170a17170ae00a0a170a170a17170a0a170a170a170a17170a170a0a170a17170a170a0a170a17170a0a17170a0a170a170a17170a0a170a170a170a170a170a170a170a17170be00a0a170a170a17170a0a170a170a170a17170a170a0a170a17170a170a0a170a17170a0a17170a0a170a170a17170a0a170a170a170a170a170a170a170a17170ae00a0a170a170a17170a0a170a170a170a17170a170a0a170a17170a170a0a170a17170a0a17170a0a170a170a17170a0a170a170a170a170b170b170a180b17170ae00a0a170a170a17170b0a170a170a170a17170a170a0a170a17170a170a0a170a17170a0a17170a0a170a170a17170a0a170a170a170a170a170a170a170a17170ae00a0a170a170a17170a0a180a180a170a17170a170a0a170b18170a170a0a170a17170a0a17170a0a170a170a17170a0a170a170a170a170a170a170a170a17170ae10a0a170a170a17170a0a170a170a170a17170a170a0a170a17170a170a0a170a17170a0a17170a0a170a170a17170b0a170a170a170a170a170a170a170a17180ae00a0a170a170a17170a0a170a170a170a17170a170a0a170a17170a170a0a170a17170a0a17170a0a180a180a17170a0a170a170a170a170a170a170a170a17170ae00a0a170a170a171a0a0a170a170a170a17170a170a0a170a17170a170a0a170a17170a0a17170a0a170a170a17170a0a170a170a170a170a170a170a170a17170005dc",
"off": "aa00d802e10a0a17170a170a170a170a0a17170a0a180a180c170a170a170a170a17170a0a170a170a170a170a170a170a170a170a170a17170a170a170a170a0a170a17170ae00a0b17170a170a170a170a0a17170a0a170a170a170b170a170a170a17170a0a170a170a170a170a170a170a170a170a170a17170b170a170a170a0a170a17170ae00a0a17170a170a170a170a0a17170a0a170a170a170a170a170a170a17170a0a170a170a170a170a170a170a170a180a180a17170a170a170a170a0a170a18170ae00a0a17170a180a180a170a0a17170a0a170a170a170a170b170a170a17170a0a170a170a170a170a170a170a170a170a170a17170a170a170a170a0a170a17170ae00a0a17170a170a170a170a0a17170a0a170a170a170a170a170a170a17170a0a170a170a170a170a170a170a170a170a170a17170a170a170a170a0a170a17170ae00a0a17170a170a170a170a0a17170a0a170a170a170a170a170a170a17170a0a170a170a170a170a170a170a170a170a170a17170a170a170a170a0a170a17170ae00a0a17170a170a170a170a0a17170a0a170a170a170a170a170a170a17170a0a170a170a170a170a170a170a170a170a170a17170a170a170a1f0b0a170a17170ae00a0a18170a170a170a170a0a17170a0a170a170a170a170a170a170a17170a0a170a170a170a170a170a170a170a170a170a17170a170a170a170a0a170a17170ae00a0a17170a170a170a170a0a17170a0a170a170a170a170a170a170a17170a0a170a170a170a170a170a170a170a170a170a17170a170a170a170a0a170a17170be00a0a17170a170a170a170a0a17170a0a170a170a170a170a170a170a17170a0a170a170a170a170a1714170a170a170a170a17170a170a170a170a0a170a17170ae00a0a17170a170a170a170a0a17170a0a170a170a170a170a170a170a17170a0a170a170a170a170a170a170a170a170a170a17170b170b170a170a0a170a17170005dc"
}
}]
}]
}
ipaqmaster commented 6 years ago

To be somewhat clearer

  1. The official e-Control iOS app works. Always. Maybe 1 in 50 times it may take a few seconds to turn on which is fine.

  2. Homebridge's attempts say "Office sendHex (10.0.0.188; xx:xx:xx:xx:xx:xx)" however nothing happens..

  3. Regardless of which option I use, Official or Homebridge via Siri; the BroadLinkRM itself always flashes the Orange LED (the commands are getting there but are not being executed?)

jat80 commented 6 years ago

Hey have you got the latest firmware on the broadlink device? There was a release on the 27/07/2017 which is v20029 which says it's solved infrared code timeout problems.

ipaqmaster commented 6 years ago

HI jat80, Unfortunately yes, we've updated it to the latest version and Homebridge still cannot turn the light switch on.

The Broadlink still flashes it's orange light as if it's receiving.

jat80 commented 6 years ago

here are some things I did to fix mine when I had similar issues.

1) Make sure all devices are assigned an internal static IP address on your router. Eg. What ever your homebridge server is installed on, the RM Mini3, Wall switch and your homekit hub (apple tv4 or iPad).

2) Make sure the RM Mini3 has it's own usb power supply not on a shared usb powered hub.

3) Your homebridge server computer should be "always on"

4) Put your host ip address in your config. Yes I know it auto detects the RM mini but I put it in there to make sure.

5) make sure everything is up to date (homebridge, nodejs, raspberry pi etc)

imperialjoy commented 6 years ago

It sounds like the codes you have are not the same as what the e-control app is sending. Instead of using 'learn and scan' I installed e-control on a cheap android tablet, restored the broad link cloud backup, and installed an app called 'rm tasker lite'. Enable the http bridge in that app and navigate in a browser to the link it gives you. It will show you all the RF and IR codes the e-control app is using. Those codes are only 140 characters, so double them up and you'll be golden.

Now if only I could get homekit to send an off command to a switch that it thinks is off, or an on command to a switch it thinks is already on! I'll open my own gripe/issue for that though. Good luck :)

jat80 commented 6 years ago

Actually @ipaqmaster and @imperialjoy i'm having the same issue now.

If the codes that are learnt via the "learn and scan" don't work properly is that a fault with the software @lprhodes? Why would the codes from within the e-control app be any different from the using the "learn and scan" built into the plugin?

jat80 commented 6 years ago

@imperialjoy have you actually gotten this working flawlessly? As in it will trigger every time? I've tried different versions of IR codes by learning using the inbuilt learn function with the actually physical remote pointed at the RM Mini or using the ones in the broadlink app online database which both work fine (when using the broadlink app) every time - but when using the home app with this plugin sometimes it will not trigger one of the codes (e.g. TV doesn't turn on but the AV Receiver does).

I'm stumped. @lprhodes

imperialjoy commented 6 years ago

Yes I have it working very reliably controlling 2 Mitsubishi heat pumps using IR and various tc2 wall switches via RF. I used tasker as I mentioned to extract the actual codes from the Broadlink app. The only issue I have is when sun shines on one heat pump and IR becomes useless. Same problem using the remote control though.

jat80 commented 6 years ago

@imperialjoy thanks for the quick reply - i've extracted the codes the way you mentioned using rm tasker and the codes are exactly the same as that used when using this homebridge plugin to learn them?? I'm not sure where you are getting the figure for the length of characters but this would be different depending on the IR code and device being controlled i'm assuming. I have ones that are 152 characters in length and others that are 440 characters in length. Why did you double them up?

imperialjoy commented 6 years ago

I had to double them up for them to work. My TC2 codes were 140 characters in the broad link database, but did NOT work. On the HomeAssistant forums (treasure trove) people mentioned doubling the codes to get it to work. I doubled the code to 280 and it started magically working. I suppose its like sending the code twice, which is how some IR remotes work, they just keep sending the same code for a while.

jat80 commented 6 years ago

@imperialjoy did you use switch multi or just have one code that was 280 instead of 140?

Basically what I'm wondering is how your config is set in homebridge. Thanks.

imperialjoy commented 6 years ago

I use 'switch'. I just copied the string and pasted again at the end to double the length.

jat80 commented 6 years ago

@imperialjoy doubling up the codes didn't work at all (doesn't even register as correct hex codes)

imperialjoy commented 6 years ago

@jat80 Is this for a RF based TC2 switch? 280 definitely is valid in homebridge unless you mistyped. I'm not sure what you mean by didn't register?

jat80 commented 6 years ago

@imperialjoy no not RF based.

Doubling up my codes would exceed 280 characters for the each IR code.

When trying to turn on the TV for example with the code being doubled up it registers as "on" in the home app but the led light on the RM Mini3 doesn't blink. No errors in the config so it seems the codes are invalid when doubling them up.

For eg. if My code is "1234" i've put it in the config as "12341234"

imperialjoy commented 6 years ago

@jat80 you confused me. This thread is about TC2 switches. I never doubled my IR codes. I think you should open your own thread about your issue, this is OT.

lprhodes commented 6 years ago

There's nothing that comes to mind as a fix for this sorry, I'd need a TC2 to help try and debug the issue. Happy to have one sent out to me in Australia if you want me to work on it.

lprhodes commented 6 years ago

I'll be re-checking the commands that the app sends to the Broadlink within the next few weeks. Without an RF device to learn it's pretty hard though.

ipaqmaster commented 6 years ago

Thanks for the followup, unfortunately I didn't have the time to figure it out, Everything appeared to be configured correctly which was quite frustrating for us. It's likely something under the hood however the official app for the Broadlink RM PRO2 worked fine and instantly every time which was strange when the code we captured for homebridge wouldn't do the same.

refaelsommer commented 6 years ago

Guys maybe your problem is having more than one RM Pro or an RM Pro and a Bean, I have one RM Pro and 3 Beans at my home and I had to add to each accessory a "host" value with the Mac address of the Rm Pro or the beans that are in charge of that accessory, for example:

See that the host value is different, the host Mac address is in the eControl app in devices Also If you have only one device it is better you add the host value to the accessory, it may help fix your problem

{
        "name": "Kids Aircon",
        "host":"xx:43:xx:dc:xx:a8",
        "type":"air-conditioner",
        "data":{
            "off":"hex",
            "temperature0":{
              "pseudo-mode":"heat",
              "data":"hex"
            },
            "temperature26":{
              "pseudo-mode":"heat",
              "data":"hex"
            },
            "temperature27":{
              "pseudo-mode":"heat",
              "data":"hex"
            },
            "temperature28":{
              "pseudo-mode":"heat",
              "data":"hex"
            },
            "temperature29":{
              "pseudo-mode":"heat",
              "data":"hex"
            },
            "temperature22":{
              "pseudo-mode":"cool",
              "data":"hex"
            },
            "temperature23":{
              "pseudo-mode":"cool",
              "data":"hex"
            },
            "temperature24":{
              "pseudo-mode":"cool",
              "data":"hex"
            },
            "temperature25":{ 
                "pseudo-mode":"cool",     
                "data":"hex"
            },
            "temperature16":{
                "pseudo-mode":"cool",
                "data":"hex"
            }
          }
},
{
        "name": "Kitchen Light",
        "type": "switch",
        "host":"xx:xx:b4:ca:xx:24",
        "data":{
            "on":"hex",
            "off":"hex"
                }
}
lprhodes commented 6 years ago

Unsure if it'll help here but just in case; there's a new method of adding devices manually to your config in case auto-discovery isn't working for whatever reason.

Check out the docs on it.

lprhodes commented 6 years ago

Hands up if you're still having this issue.

ipaqmaster commented 6 years ago

Unfortunately yes however had stopped looking into it a few months back. It felt the homebridge instance was seemingly doing everything right/the same codes as the native app, yet yielding inconsistent results. Gave up on it for the time being.

eolthecrow commented 6 years ago

Guys, i am sorry to ask on this thread, but rm pro will work with tc2 switches over wifi network? Really can't find this answer, just trying to set some switches in all my house and i got big walls. Really appreciate your help

lprhodes commented 6 years ago

The TC2’s can be controlled over wifi but I don’t believe that has anything to do with the RM Pro

Sent with GitHawk

eolthecrow commented 6 years ago

From what i've read the TC2 will not work w.o RMPro and i am still not sure if over WIFI will work in all my house

imperialjoy commented 6 years ago

Tc2 switches are not wifi capable. They work over RF from a rm pro.

lprhodes commented 6 years ago

Yeah you’re right sorry

Sent with GitHawk

eolthecrow commented 6 years ago

@imperialjoy: so basically will not work w/o line of sight to RMPro...😞

imperialjoy commented 6 years ago

@eolthecrow: Its RF, not IR! Range is better than wifi, its 433mhz RF, goes through walls like they are tissue paper. One RM pro does the whole house, I have TC2's everywhere!

eolthecrow commented 6 years ago

This is the answer that I was looking for, thank you a lot

raven5x5 commented 6 years ago

Same problem here. When I tap the button in the HomeKit nothing happens. No orange LED light. But when I tap the Scan Rf freq. button orange led flashes. Any thoughts on that?

rapsody2000 commented 5 years ago

I opened a new issues dealing with the same problem... TV switch not working. Codes were learnt by homebridge as well as air conditioner ones. Air-conditioner works perfectly, the correct devices are recognized by host address. PingIPaddress works: homebridge knows wether TV is on or off but DOES NOT send any code for on/off, RMP Pro light does not flash. Very frustrating...

Referor commented 5 years ago

Another way, but you still need 2 devices and RM Pro plus (this way work for TC2) for me:

  1. First IOS device(to control e-control app). In your e-control application you need to have already educated TC2 remote / TC1 remote.
  2. Second IOS device with homekit and homebridge with scan_frequency function (to control your homebridge) / Mac (OS Mojave beta have home kit application) Algorithm: 1) You need to start "Scan_frequency" in your homebridge with second device 2) You need to push the preferred button at your first device several times And you can add buttons step-by-step to your homebridge. I think we can use this algorithm because RM Pro can scan frequency and send frequency in same time. We start scanning process and then we send some RF frequency in this one RM Pro plus device