rmcontrol
rmcontrol copied to clipboard
Issue linking with Homebridge
@ericmagnuson - thanks for sharing your RM controller plugin! I'm very excited to use this instead of the alternate Android+VM solution.
I am running into some issues linking the RM control with Homebridge. I'm able to get the commands through: even though I'm defining the http_method as POST in the homebridge config file, they are showing up as "GET" on the RM controller. See below:
Homebridge config file:
"accessory": "HttpMulti",
"name": "Projector Screen",
"deviceType": "switch",
"on_url": "http://127.0.0.1:5000/commands/Screen%20Up",
"off_url": "http://127.0.0.1:5000/commands/Screen%20Down",
"http_method": "POST"
Homebridge status info when toggling the switch from HomeKit:
[12/20/2016, 11:26:36 PM] [Projector Screen] Set CurrentState: 1
[12/20/2016, 11:26:36 PM] [Projector Screen] Turning On
[12/20/2016, 11:26:36 PM] [Projector Screen] on=http://127.0.0.1:5000/commands/Screen%20Up off=http://127.0.0.1:5000/commands/Screen%20Down method=undefined
[12/20/2016, 11:26:36 PM] [Projector Screen] Error getting state (status code undefined): null
[12/20/2016, 11:26:36 PM] [Projector Screen] Success turning on
Rmcontrol status info for this command:
127.0.0.1 - - [20/Dec/2016 23:26:36] "GET /commands/Screen%20Up HTTP/1.1" 405 -
Which does not appear to do anything with the Broadlink device.
For comparison, a successful command from the webpage interface with the rmcontroller gives:
127.0.0.1 - - [20/Dec/2016 23:28:04] "POST /commands/Screen%20Up HTTP/1.1" 500 -
Which does successfully send a command through the Broadlink device.
Impressive work so far! I'm looking forward to getting the last couple of issues worked out!
@flyingartichoke Had the same problem
I solved it by installing homebridge-http (https://github.com/rudders/homebridge-http):
sudo npm install -g homebridge-http
Don't forget to change the accessory in the config file to "Http"
Here's my config file:
{
"bridge": {
"name": "RM Control",
"username": "CC:22:3D:E3:CE:31",
"port": "51826",
"pin": "123-45-678"
},
"description": "This is an example configuration file for using Homebridge with RM Control",
"accessories": [
{
"accessory": "Http",
"name": "TV",
"on_url": "http://10.0.0.17:5000/commands/1",
"off_url": "http://10.0.0.17:5000/commands/2",
"deviceType": "switch",
"http_method": "POST"
}
],
"platforms": []
}
Hi guys, sorry for the slow delay — out of town for the holidays.
First off @flyingartichoke, I should ask, were you able to add/learn your own commands? I realized I didn't really write good instructions for the web interface. Once you learn a command, you will have to update the endpoint in your homebridge config (e.g. http://127.0.0.1:5000/commands/Screen%20Up
fires a command named "Screen Up").
When you launch the web interface, you should see "New command name". Fill out the name of your command, and click the plus button. When you click the plus button, your RM should start listening for a remote command (it will listen for 5 seconds). Fire your command from your remote, and if the command is learned (with no errors), it will appear in the command list.
I'll hopefully add some explanatory text to the web interface soon as it is admittedly pretty spartan.
Re-reading your comment, it seems you were able to learn commands. I haven't been able to test Homebridge integration very much as my Home app is still locked up, but if regular homebridge-http
works as @NightRang3r suggested, it should get the job done. I was using that before, but when I needed a "blinds" type accessory for a projector screen I have, I had to use homebridge-httpmulti
.
@ericmagnuson @flyingartichoke I actually had problem learning codes
I noticed that device = broadlink.rm2()
in line 84 in rmcontrol/rmcontrol/init.py is not reliable I wasn't able to get rm pro to learning mode even directly from idle when using the broadlink python library.
I had to change the code (I am not a programmer so the code is probably bad, but working) and now its very reliable and I am able to get rm into learning mode:
def get_device():
device = broadlink.discover(timeout=5)
for i in range(0, len(device)):
test = str(device[i])
if "broadlink.rm" in test:
rm = i
device = device[rm]
device.auth()
return device
@NightRang3r Thanks for working on that function. I, personally, haven't had a problem getting my RM2 into learning mode, but it could be different for others. Feel free to submit a pull request. Otherwise, I will play around with it and integrate it once I'm back from vacation.
@flyingartichoke Did you ever get it working?
I haven't had a chance to try it out yet -- hopefully I'll get to that this weekend. I'll let you know!
On Thu, Dec 29, 2016 at 2:52 PM Eric Magnuson [email protected] wrote:
@flyingartichoke https://github.com/flyingartichoke Did you ever get it working?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ericmagnuson/rmcontrol/issues/1#issuecomment-269706120, or mute the thread https://github.com/notifications/unsubscribe-auth/AXYclWR03TC7rSDahIqkYz1fllKd0Bzoks5rNDmPgaJpZM4LSp5m .
Well it took a while, but I finally had a chance to try out the Broadlink to HomeKit integration using the Http plugin instead of the Httpmulti. That solved the issue with GET vs. POST commands, and I'm able to get commands to go through with HomeKit which is great!
I do have one improvement suggestion: since the Broadlink buttons are stateless, it'd be awesome to have this integration also set up a button which resets after pressing. I'm doing this now with an extra "dummy" switch and a bunch of automations, but something cleaner like a stateless switch would be awesome! homebridge-http-simple-switch would work, but unfortunately it only seems to be configured to expect a response when sending a url command.