A BroadLink Mark II plugin to try out.
The code can be found on GitHub here:
https://github.com/a-lurker
You can install the plugin from the ‘Alternate App Store’, which works together with the ‘ALTUI’ plugin:
https://community.getvera.com/t/altui-alternate-app-store/192721
Note that ‘ALTUI’ is highly recommended to all users, together with openLuup.
Caveats:
Only tested on the RM3 Pro 2 device. While other devices may be discovered, they might not work. This plugin is based on information from here:
The reverse engineering is ongoing. Consequently it may not be possible to have all functionality operational until that process is complete.
If the LED on your device flashes when you transmit a code, the plugin is working. It’s a different matter whether you have the correct code or not. Many learnt codes have excessive replication and some codes are not replicated enough. ie some TVs, etc require a code to be sent two or three time, in close succession, for them to work. I propose not to engage in discussions on why your codes work or not. See this link instead:
Logging can be enabled by setting the DebugEnabled flag to ‘1’. You can use AltUI plugin to look at the log file:
See Misc–>Os Command–> Tail Logs Tab Note: you can change the 50 to say 500 to see more log info.
In openLuup use the console logs:
http://<openLuup_ip_address>:3480/console?page=log
Or use the infoviewer plugin. Please provide a log file with any bug reports, otherwise the report may not be responded to.
What the plugin will do:
-
BroadLink and ProntoCodes can be used.
-
The one instance of the plugin can (in theory) handle multiple BroadLink physical devices. The plugin will produce child devices as necessary, based on the capabilities of each BroadLink device discovered. eg a Broadlink Rm Pro will have a temperature and IR child device associated with it.
-
BroadLink WiFi operated switches such as the SP1 & SP2 & SC1 should work but the MP1 may need work - I haven’t been able to test this.
What the plugin will not do:
- Wall switches operated locally will provide on/off status but the update period in the UI will be long (minutes) ie not instant status
- The plugin does not interact with the “e-Control” phone app in any way. However e-control codes can be converted for use with the plugin - refer to:
http://forum.micasaverde.com/index.php/topic,53871.msg380629.html#msg380629 - The plugin doesn’t store IR or RF codes - codes need to be applied to the IR child.
Potential problems:
-
RF codes may or may not work. Haven’t tried it.
-
Getting codes: As I understand it you can download codes held by the “e-Control” app ie: in the file eControl-data.zip I haven’t tried this. Presumably the “e-Control” app needs to be running on the phone and you get the codes by entering in your browser this link - note: insert the phone’s ip address:
http://<PHONE_ip_address>:48815"
If some one can post the file proffered, that would be good, as I would like to review its contents - especially any file containing codes for 315 MHz, as well as 433 MHz, as I haven’t be able to check RF code functionality.
-
Your router blocks UDP broadcast traffic - that will cause problems - read your router manual!
-
The BroadLink devices are identified by their MAC addresses. If you change the IP address of a BroadLink device for any reason, you need to restart the Luup engine. The new ip address will be discovered and used.
-
After a Vera Luup engine restart, there is 85 second delay before the plugin starts polling, then it polls at minimum of every five minutes. So temperatures, etc are updated at this rate.
-
Some BroadLink devices can control remote devices on 315 MHz, as well as 433 MHz. Some just allow 433 MHz (country based). The box the unit is delivered in, says what it contains. I’m unsure how this can be detected programmatically.
Usage:
Sending a ProntoCode:
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendProntoCode’, {ProntoCode = ‘your code here’}, DeviceID)
Sending a BroadLink IR or RF code:
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘SendCode’, {Code = ‘your code here’}, DeviceID)
Using AltUI; codes can be cut & pasted into the actions for easy testing.
This post provides an understanding how the IR devices should be used (using a GC100 device):
http://forum.micasaverde.com/index.php/topic,29685.msg234078.html#msg234078
Ver 0.51
Initial release.
This plugin has been tested using the AltUI plugin and the Vera UI7 interface with Firefox 57.0.2. It works with openLuup and on a Vera 3. UI5 may work.
Ver 0.52
The plugin can now learn codes. It works pretty well for IR codes but is a bit suspect when learning RF codes. To start the learning process issue these commands to the appropriate child device (not the parent):
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘LearnIRCode’, {}, DeviceID)
luup.call_action(‘urn:a-lurker-com:serviceId:IrTransmitter1’, ‘LearnRFCode’, {}, DeviceID)
The LED will light up on the BroadLink device and you have about 30 seconds to learn the code. For IR codes just tap the remote button. For RF codes it’s more complicated. Once learning starts hold the remote button down for about four seconds (this gets the frequency). Wait a second and then tap the remote button (this gets the code). This sequence is not easy to do and codes may not be learnt or may be incorrect.
The parent device (not the child device) reports the learnt codes in “LearntIRCode” and “LearntRFCode” as seen under the variables tab. If a code is not learnt then the variable reports “No IR code was learnt” ditto for RF codes.
Ver 0.53
General bug fixes and support for BroadLink WiFi switches. If your switch doesn’t work then provide logs. The MP1 four switch may need more work - provide logs.
Note RF code learning is a work in progress and may not function as desired.
Ver 0.54
Note: a JSON module is now required to be available to the plugin. This will mostly effect UI5 users as UI7 has one already available. If one is not found, you will be notified in the UI top banner at Luup engine start up. Refer to this post for a suitable module:
http://forum.micasaverde.com/index.php?topic=29989.0
Fixes a bug whereby if a device was offline and a Luup Engine restart occurred and subsequently the device went on line and another Luup Engine restart occurred; then the device’s children would be deleted then recreated with new device IDs.
Measured temperatures can now have an offset applied. It’s a crude approach to correction but may help those interested. In general expecting sub one degree Centigrade accuracy (or even two degree) from the BroadLink Pro(s) is probably overly optimistic.
Also misc general bug fixes.
Existing users just need to upload the “L_BroadLink_Mk2_1.lua”.
Ver 0.56
Improved RF learning. More recent devices recognised and catered for.