Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lprhodes/homebridge-broadlink-rm
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.1.1
Choose a base ref
...
head repository: lprhodes/homebridge-broadlink-rm
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Apr 28, 2017

  1. Copy the full SHA
    69753ca View commit details
  2. Copy the full SHA
    99f41c7 View commit details
  3. Copy the full SHA
    f0f90cc View commit details
  4. Version bump

    lprhodes committed Apr 28, 2017
    Copy the full SHA
    1cb1720 View commit details
  5. Copy the full SHA
    c92e4a3 View commit details

Commits on Apr 29, 2017

  1. Copy the full SHA
    ae6eaad View commit details
  2. Version updated to 2.3.0

    lprhodes committed Apr 29, 2017
    Copy the full SHA
    cbc368e View commit details
  3. Fixed issue with current temperature becoming less/more than the mini…

    …mum or maximum temperature
    lprhodes committed Apr 29, 2017
    Copy the full SHA
    e2932d1 View commit details
  4. Copy the full SHA
    1d2b1f7 View commit details
  5. Copy the full SHA
    dff1449 View commit details

Commits on May 1, 2017

  1. Copy the full SHA
    b0c40bb View commit details
  2. Merge pull request #74 from AlayshChen/master

    Fix for accessory state switch error
    lprhodes authored May 1, 2017
    Copy the full SHA
    a718788 View commit details
  3. Fix #75 README issue

    lprhodes committed May 1, 2017
    Copy the full SHA
    8f633b2 View commit details
  4. Version bump

    lprhodes committed May 1, 2017
    Copy the full SHA
    5c45e65 View commit details

Commits on May 2, 2017

  1. Copy the full SHA
    9754560 View commit details

Commits on May 4, 2017

  1. Copy the full SHA
    e5075a6 View commit details
  2. Copy the full SHA
    99f7b54 View commit details
  3. Copy the full SHA
    16d1f6a View commit details

Commits on May 5, 2017

  1. Copy the full SHA
    dcaf8a0 View commit details
  2. Support for using a separate switch to enable/disable use of autoHeat…

    …Temperature/autoCoolTemperature for the air-conditioner accessory.
    lprhodes committed May 5, 2017
    Copy the full SHA
    95dcff8 View commit details
  3. Fixes for autoSwitch

    lprhodes committed May 5, 2017
    Copy the full SHA
    441555d View commit details
  4. Temp debugging

    lprhodes committed May 5, 2017
    Copy the full SHA
    224a87d View commit details
  5. Copy the full SHA
    9c8b839 View commit details
  6. Merge branch 'master' of https://github.com/lprhodes/homebridge-broad…

    …link-rm
    
    # Conflicts:
    #	accessories/aircon.js
    lprhodes committed May 5, 2017
    Copy the full SHA
    644f77f View commit details
  7. Further debug logs

    lprhodes committed May 5, 2017
    Copy the full SHA
    5664568 View commit details
  8. Logs

    lprhodes committed May 5, 2017
    Copy the full SHA
    d36c6d8 View commit details
  9. Copy the full SHA
    591bec1 View commit details
  10. Copy the full SHA
    9d4f7a3 View commit details
  11. Copy the full SHA
    55f414a View commit details
  12. Copy the full SHA
    6c29823 View commit details
  13. Copy the full SHA
    8452caf View commit details
  14. Added docs, version bump

    lprhodes committed May 5, 2017
    Copy the full SHA
    4d70c7f View commit details

Commits on May 6, 2017

  1. Copy the full SHA
    e202bf4 View commit details

Commits on May 7, 2017

  1. Fix for switch-repeat

    lprhodes committed May 7, 2017
    Copy the full SHA
    986f6ea View commit details
  2. Copy the full SHA
    ba3fc78 View commit details
  3. Copy the full SHA
    98a62cb View commit details
  4. Copy the full SHA
    162463b View commit details
  5. Version bump

    lprhodes committed May 7, 2017
    Copy the full SHA
    1743aec View commit details
  6. Copy the full SHA
    b9004e2 View commit details
  7. Version bump

    lprhodes committed May 7, 2017
    Copy the full SHA
    367504a View commit details
  8. Removed unused packages

    lprhodes committed May 7, 2017
    Copy the full SHA
    e81883c View commit details

Commits on May 10, 2017

  1. Fixed #91

    lprhodes committed May 10, 2017
    Copy the full SHA
    28df607 View commit details
  2. Fixed #92

    lprhodes committed May 10, 2017
    Copy the full SHA
    a0f628d View commit details

Commits on May 21, 2017

  1. Fix for #101

    lprhodes committed May 21, 2017
    Copy the full SHA
    9d0a940 View commit details
  2. Fix #93

    lprhodes committed May 21, 2017
    Copy the full SHA
    3b60443 View commit details
  3. Version bump

    lprhodes committed May 21, 2017
    Copy the full SHA
    6b03da0 View commit details
  4. Potential fan v1 fan speed

    lprhodes committed May 21, 2017
    Copy the full SHA
    0ee2ba7 View commit details
  5. Device re-discovery

    lprhodes committed May 21, 2017
    Copy the full SHA
    f847905 View commit details
  6. Missing fan speeds error

    lprhodes committed May 21, 2017
    Copy the full SHA
    7ea58c3 View commit details

Commits on Jun 19, 2017

  1. Prevent garage-door-opener from being closed automatically if autoClo…

    …seDelay doesn’t exist
    lprhodes committed Jun 19, 2017
    Copy the full SHA
    2ed4755 View commit details
Showing with 10,644 additions and 1,547 deletions.
  1. +13 −0 .release-it.json
  2. +12 −227 README.md
  3. +51 −156 accessories/accessory.js
  4. +142 −0 accessories/air-purifier.js
  5. +541 −266 accessories/aircon.js
  6. +0 −25 accessories/channel.js
  7. +103 −51 accessories/fan.js
  8. +138 −62 accessories/garageDoorOpener.js
  9. +176 −0 accessories/humidifier-dehumidifier.js
  10. +10 −4 accessories/index.js
  11. +23 −19 accessories/learnCode.js
  12. +178 −109 accessories/light.js
  13. +123 −0 accessories/lock.js
  14. +62 −0 accessories/outlet.js
  15. +141 −31 accessories/switch.js
  16. +60 −35 accessories/switchMulti.js
  17. +78 −41 accessories/switchMultiRepeat.js
  18. +61 −32 accessories/switchRepeat.js
  19. +0 −36 accessories/upDown.js
  20. +6 −0 accessories/window.js
  21. +169 −161 accessories/windowCovering.js
  22. +40 −0 config-multiple-rm-devices-sample.json
  23. +181 −28 config-sample.json
  24. +3 −0 helpers/broadlink.js
  25. +16 −0 helpers/catchDelayCancelError.js
  26. +20 −0 helpers/checkForUpdates.js
  27. +77 −0 helpers/convertProntoCode.js
  28. +30 −6 helpers/delayForDuration.js
  29. +5 −0 helpers/errors.js
  30. +88 −22 helpers/getDevice.js
  31. +18 −14 helpers/learnData.js
  32. +39 −37 helpers/learnRFData.js
  33. +0 −31 helpers/persistentState.js
  34. +19 −0 helpers/ping.js
  35. +25 −9 helpers/sendData.js
  36. +3 −75 index.js
  37. +16 −4 package.json
  38. +141 −0 platform.js
  39. +0 −33 services/TVChannels.js
  40. +0 −33 services/UpDown.js
  41. 0 test/accessoryTypes.test.js
  42. +554 −0 test/airConditioner.test.js
  43. +458 −0 test/fan.test.js
  44. +468 −0 test/garageDoorOpener.test.js
  45. +55 −0 test/generalAccessories.test.js
  46. +63 −0 test/helpers/fakeDevice.js
  47. +17 −0 test/helpers/fakePing.js
  48. +94 −0 test/helpers/fakeServiceManager.js
  49. +17 −0 test/helpers/hexCheck.js
  50. +37 −0 test/helpers/setup.js
  51. +31 −0 test/learnAccessories.test.js
  52. +668 −0 test/light.test.js
  53. +432 −0 test/lock.test.js
  54. +357 −0 test/outlet.test.js
  55. +366 −0 test/switch.test.js
  56. +452 −0 test/switchMulti.test.js
  57. +501 −0 test/switchRepeat.test.js
  58. +377 −0 test/windowCovering.test.js
  59. +2,889 −0 yarn.lock
13 changes: 13 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"verbose": false,
"src": {
"tagName": "%s",
"tagAnnotation": "v%s"
},
"github": {
"release": true,
"releaseName": "v%s"
},
"changelogCommand": "echo \"### Features\n\n\n### Bug Fixes\"; git log --pretty=format:\"- %s (%h)\" [REV_RANGE]",
"non-interactive": true
}
239 changes: 12 additions & 227 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,241 +1,26 @@
# Homebridge Broadlink RM

Broadlink RM Mini and Pro plugin for [Homebridge](https://github.com/nfarina/homebridge)
## Introduction
Welcome to the Broadlink RM Mini and Broadlink RM Pro plugin for [Homebridge](https://github.com/nfarina/homebridge).

This allows you to control your RM Mini and Pro with HomeKit and Siri.
This plugin allows you to control your RM Mini and RM Pro with HomeKit using the Home app and Siri.

## IMPORTANT

- Requires Node.js >= 7.6.0
- If you're seeing something like "ERROR LOADING PLUGIN"..."async setCharacteristicValue (props, value, callback) {" then please check your node version before creating a new issue: `node -v`.
## Like this plugin?

## Installation
If you like this plugin and want to show your support then please star the Github repo, or better yet; buy me a drink using [Paypal](https://paypal.me/lprhodes) or [crypto currency](https://goo.gl/bEn1RW).

1. Install homebridge using: `sudo npm install -g homebridge`
2. Install this plugin using: `npm install -g homebridge-broadlink-rm`
3. Update your configuration file. (See config-sample.json)
Working on open source projects like this is full-time for me so every bit helps.

## Broadlink RM Device Discovery
Thank you, sincerely!

As of version 1.0.0 your Broadlink RM Device is automatically discovered so you no longer need to specify a "host" value.
## Newsletter

## Learning Hex IR and RF codes
You can keep informed about HomeKit, homebridge and homebridge plugins by subscribing to my [Works with](http://workswith.io) newsletter.

A "Learn Code" accessory will automatically be added to the Home app and is dedicated to learning IR codes. Simply toggle the switch on, perform the IR command in front of your Broadlink RM device and copy the HEX output from the homebridge console log to wherever you want the code in the config.

The switch will toggle off automatically once the IR code has been received or 10 seconds has passed.

You can optionally stop attempting to learn a code by toggling the switch off yourself.

More details [below](#accessory-types)

## Common Accessory Configuration Keys

The following configuration keys are common between each accessory:

key | description | example | default
--- | ----------- | ------- | -------
name (required) | A descriptor for the accessory that will show in HomeKit apps. | "TV" | -
type (required) | The type of accessory. | "switch" | -
persistState (optional) | Determines whether the state of accessory persists after homebridge has been restarted. | false | true
resendHexAfterReload (optional) | When persistState is true (it is by default) this will resend the hex code for the last known state if homebridge is restarted. | true | false
disableLogs (optional) | Disables the log output for this accessory. | true | false

## Accessory Types

- [learn-code](#learn-code)
- [switch](#switch)
- [switch-multi](#switch-multi)
- [switch-repeat](#switch-repeat)
- [switch-multi](#fan)
- [light](#light)
- [garage-door-opener](#garage-door-opener)
- [window-covering](#window-covering)
- [air-conditioner](#air-conditioner)

### learn-code

You shouldn't need to add this accessory type yourself as we add one automatically however if you have multiple Broadlink RM devices then it may be useful to specify multiple devices with the "learn-code" type along with a host so that you can learn from each of them.

key | description | example | default
--- | ----------- | ------- | -------
disableAutomaticOff (optional) | Prevent the learn-code accessory from turning off automatically after a given amount of time or when a hex code has been received. | false | true

### switch

Turn the switch on and the "on" hex code is sent, turn it off and the "off" hex code is sent.

key | description | example | default
--- | ----------- | ------- | -------
disableAutomaticOff (optional) | Prevent the window-covering from turning off automatically after a given amount of time. | false | true
onDuration (optional) | The amount of time before the switch automatically turns itself off (used in conjunction with disableAutomaticOff). | 5 | 2

#### "data" key-value object
key | description
--- | -----------
on | A hex code string to be sent when the switch is changed to the on position.
off | A hex code string to be sent when the switch is changed to the off position.


### switch-multi

Turn the switch on and the switch will send each hex code in the provided array until. It then turns itself off automatically. You can also set the interval between each send.

key | description | example | default
--- | ----------- | ------- | -------
data (required) | Hex data stored as an array of strings. | [ "26005800000..." ] | -
interval (optional) | The amount of time between each send of a hex code in seconds. | 0.3 | 1
disableAutomaticOff (optional) | Prevent the switch from turning off automatically when complete. | true | false


### switch-repeat

Turn the switch on and the switch will repeatedly send the hex code until it reaches the defined send count. It then turns itself off automatically. You can also set the interval between each send.

key | description | example | default
--- | ----------- | ------- | -------
data (required) | Hex data stored as string. | 26005800000... | -
sendCount (optional) | The number of times the hex code should be sent. | 5 | 1
interval (optional) | The amount of time between each send of a hex code in seconds. | 0.3 | 1
disableAutomaticOff (optional) | Prevent the switch from turning off automatically when complete. | true | false


### fan

Turn the fan on and the "on" hex code is sent, turn it off and the "off" hex code is sent.

Additionally, Siri supports the toggling of the swing mode and setting of the fan speed as a %.

If you don't specify every fan speed then the accessory will choose the hex code of the fan speed closest to the one requested. e.g. If you only specify fan speeds of 10%, 50% and 100% then ask "Set Fan to 40%" then the hex code for 50% will be used.

key | description | example | default
--- | ----------- | ------- | -------
data (required) | Hex data stored as a key-value JSON object. | See below. | -

#### "data" key-value object

key | description
--- | -----------
on | A hex code string to be sent when the switch is changed to the on position.
off | A hex code string to be sent when the switch is changed to the off position.
swingToggle | A hex code string used to toggle the swing mode on/off.
fanSpeedX | A hex code string where X is any fan speed you wish to support e.g. "fanSpeed100".


### light

Turn the light on and the "defaultBrightness" is set unless "useLastKnownBrightness" is set to true in which case the last brightness that was set will be used.
Turn the light off and the "off" hex code is sent.

If you don't specify every brightness then the accessory will choose the hex code of the brightness closest to the one requested. e.g. If you only specify brightness values of 10%, 50% and 100% then ask "Set light to 40%" then the hex code for 50% will be used.

key | description | example | default
--- | ----------- | ------- | -------
data (required) | Hex data stored as a key-value JSON object. | See below. | -
defaultBrightness (optional) | The default brightness to be set when you turn the light on. | 70 | 100
useLastKnownBrightness (optional) | The last known brightness will be used instead of the defaultBrightness when turning a light back on. | false | true
disableAutomaticOff (optional) | Prevent the light from turning off automatically after a given amount of time. | false | true
onDuration (optional) | The amount of time before the switch automatically turns itself off (used in conjunction with disableAutomaticOff). | 5 | 2
onDelay (optional) | The time in seconds between when the (optional) on code and the requested brightness code are sent. (default: 0.1s)

#### "data" key-value object

key | description
--- | -----------
off | A hex code string to be sent when the switch is changed to the off position.
brightnessX | A hex code string where X is any brightness you wish to support e.g. "brightness100".
on (optional) | You only need t add this if you need to send an "on" code before the "brightnessX" code is sent



### garage-door-opener

Set the switch to open and the "open" hex code is sent, set it to close and the "close" hex code is sent.

key | description | example | default
--- | ----------- | ------- | -------
data (required) | Hex data stored as a key-value JSON object. | See below. | -
openCloseDuration (optional) | The amount of time in seconds that the accessory will show as "Opening" or "Closing" | 10 | 8
host (optional) | The IP or MAC address of the Broadlink RM device. | 192.168.1.32 | (auto-discovered)

#### "data" key-value object
key | description
--- | -----------
open | A hex code string to be sent when the switch is changed to the open position.
close | A hex code string to be sent when the switch is changed to the close position.


### window-covering

The window-covering accessory designed to be used by IR/RF controlled blinds/shades/shutters.

The accessory will calculate how many times the open and close hex code needs to be sent based on the existing % and requested %. In order to do this a "percentageChangePerSend" needs to be set. e.g. If it takes 10 sends of the code to open the covering then the value of "percentageChangePerSend" should be 10. If it takes 20 then it should be 5.

If you simply want to open or close the blinds with a single hex code then you could set "percentageChangePerSend" to 100 which will just sent the command once.

key | description | example | default
--- | ----------- | ------- | -------
data (required) | Hex data stored as a key-value JSON object. | See below. | -
totalDurationOpen (required) | The amount of time in seconds it takes to open the window-covering completely. | 45 | -
totalDurationClose (required) | The amount of time in seconds it takes to close the window-covering completely. It will work these values out based on the total. | 45 | -

#### "data" key-value object

key | description
--- | -----------
open | A hex code string to be sent when the window-covering is requested to open.
close | A hex code string to be sent when the window-covering is requested to close.
stop | A hex code string to be sent when the window-covering is stopped automatically.


### air-conditioner

This allows you to send a hex code for any temperature that you've defined a hex code for. If you simply want to heat up or cool down a room (and not learn every single temperature code) you can just set hex codes for the lowest and highest temperatures and those will be used whatever temperature you request.

key | description | example | default
--- | ----------- | ------- | -------
data (required) | Hex data stored as a key-value JSON object. | See below. | -
minTemperature (optional) | The number of times the hex code should be sent. | 14 | 0
maxTemperature (optional) | The amount of time between each send of a hex code in seconds. | 28 | 30
temperatureDisplayUnits (optional) | Specify celsius or fahrenheit. | F | C
defaultCoolTemperature (optional) | The temperature that will be requested when no hex code exists for the specified temperature. | 14 | 16
defaultHeatTemperature (optional) | The temperature that will be requested when no hex code exists for the specified temperature. | 28 | 30
heatTemperature (optional) | The temperature at which we change the UI to show that we're heating. Also used to determine whether "defaultCoolTemperature" or "defaultHeatTemperature" is used. | 20 | 22
replaceAutoMode (optional) | When we turn on the thermostat with Siri it sets the mode as "auto" which isn't supported at this time so we set the mode to "cool" or "heat" instead depending on the value of this key. | "heat" | "cool"
pseudoDeviceTemperature (optional) | Some RM devices don't have a built in thermometer, when set this prevents the device thermometer from being accessed and shows the provided value instead. | 0 | 0
autoHeatTemperature (optional) | When the temperature is below this value, the heat mode will be enabled. | 18 | -
autoCoolTemperature (optional) | When the temperature is above this value, the cool mode will enabled. | 27 | -
autoMinimumDuration (optional) | The minimum amount of time in seconds that an auto mode should be turned on (or after being automatically turned off) for to prevent it from turning on/off too frequently. | 300 | 120

#### "data" key-value object

key | description
--- | -----------
off | A hex code string to be sent when the air conditioner is asked to be turned off.
temperatureX | A hex code string where X is any temperature you wish to support e.g. "temperature30".

#### "temperatureX" key-value object

key | description
--- | -----------
data | Hex data stored as string.
pseudo-mode | The mode we set when this hex is sent. i.e. "heat" or "cool". For graphical purposes only (hence use of the term "pseudo").


## Air Conditioner Notes

There looks to be a glitch in the Apple Home app in that nothing happens when setting the mode to Off when you've turned the thermostat on by setting a specific temperature. Siri and other HomeKit apps don't have the same glitch. As a work-around you can just select a different mode and then press Off. This only happens the first time after launching homebridge.

Adding "autoHeatTemperature" and "autoCoolTemperature" can help automatically maintain a temperature. When the temperature falls below and hits above the "autoHeatTemperature" and "autoCoolTemperature" temperatures the accessory will automatically set the temperature to whatever the "defaultHeatTemperature" and "defaultCoolTemperature" is. The accessory will then keep checking (every "autoMinimumDuration" seconds) and if the temperature changes to be between the "autoHeatTemperature" and "autoCoolTemperature" temperatures then it will turn itself off. Something to note however is that if you decide to set a new temperature when the accessory has automatically turned itself on then it will still attempt to turn itself back off. To stop this automatic turn-off you can turn off the accessory manually and then turn it back on manually. Bare in mind that while the Home app may say 22C, the temperature may actually be 22.4C and if the Home app says 23C then it may actually be 22.5C.


## Multiple Broadlink RM Devices

If you have multiple devices (e.g. one in the bedroom, one in the lounge) then you can additionally specify a `"host"` value with the Broadlink RM's IP or MAC address.

If you wish to have multiple Learn Code accessories (e.g. for each device) then you can add accessories with a type of `"learn-code"` and then specify the `"host"` and `"name"` values.
## Documentation

Full documentation can be found [here](https://lprhodes.github.io/slate/).

## Thanks

Thanks to @tattn (https://github.com/tattn/homebridge-rm-mini3), @PJCzx (https://github.com/PJCzx/homebridge-thermostat) @momodalo (https://github.com/momodalo/broadlinkjs) whose time and effort got me started.
Thanks to @tattn (https://github.com/tattn/homebridge-rm-mini3), @PJCzx (https://github.com/PJCzx/homebridge-thermostat) @momodalo (https://github.com/momodalo/broadlinkjs) whose time and effort got me started.
Loading