Skip to content
Harmony websocket plugin for homebridge
Branch: master
Clone or download
nicoduj Merge pull request #129 from nicoduj/greenkeeper/prettier-1.17.0
Update prettier to the latest version 🚀
Latest commit bbac6b6 Apr 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Update issue templates Mar 11, 2019
.gitignore fix turnOffActivity not activated when switching off last activity Dec 22, 2018
.travis.yml
CHANGELOG.md Update CHANGELOG.md Mar 27, 2019
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Mar 11, 2019
LICENSE Create LICENSE Feb 23, 2019
README.md
harmonyAsSwitches.js 0.7.0 Mar 27, 2019
harmonyAsTVKeysTools.js 0.5.2 Mar 16, 2019
harmonyAsTVPlatform.js 0.7.0 Mar 27, 2019
harmonyBase.js 0.7.0 Mar 27, 2019
harmonyConst.js WIP #67 Mar 22, 2019
harmonyTools.js minor fixes and refact Mar 23, 2019
index.js
package.json Merge branch 'master' into greenkeeper/prettier-1.17.0 Apr 24, 2019

README.md

homebridge-harmony

npm npm npm

Build Status code style: prettier CodeFactor Known Vulnerabilities Greenkeeper badge

Support via PayPal

Logitech Harmony plugin for HomeBridge using WebSockets.


TV MODE

This mode focus on harmony hub activities : each activity of the hub is mapped to an input. A main activity is linked to the on/off switch of the accessory. Buttons on the remote app and volume controls will be binded to the one defined in the activity (if so). VOLUME IS BIND TO PHYSICAL BUTTONS WHEN REMOTE FROM CONTROL CENTER IS SHOWN . There is an option to override default mappings.


Work In Progress For Dynamic Plugin Mode

  • This plugin is not a dynamic platform : hub configured MUST be available at homebridge startup, however it will crash homebridge start process. Work in Progress on this, but be warned and thus think of having a separate homebridge instance for it

If you want to try Dynamic Platform mode I have published a beta version. It should not be visible in homebridge-config-ui-x update pannel, so you have to install it through terminal if you want :

npm install -g homebridge-harmony@beta

Also refer to README in the corresponfing branch for more information

Feel free to report bugs there, or on Slack in #homebridge-harmony channel


Installation

  1. Install Homebridge using: npm install -g homebridge
  2. Install this plugin using: npm install -g homebridge-harmony
  3. Update your Homebridge config.json using the sample below.

Configuration

For Switch Mode :

"platforms": [
  {
    "platform": "HarmonyHubWebSocket",
    "name": "HubName",
    "hubIP": "192.168.1.XX",
    "showTurnOffActivity" : true,
    "skipedIfSameStateActivities" : ["PowerOff","La musique"],
    "publishActivitiesAsIndividualAccessories" : false
  }
]

For TV platform mode with ios 12.2 and homebridge 0.0.46 :

"platforms": [
  {
    "platform": "HarmonyHubWebSocket",
    "name": "HubName",
    "hubIP": "192.168.1.XX",
    "TVPlatformMode" : true,
    "mainActivity" : "LA TV"
  }
]

Fields:

  • platform must be "HarmonyHubWebSocket" (required).
  • name is the name of the published accessory (required).
    • Use a different name for each entry if you have multiple hubs.
  • hubIP is the static IP address of the hub (required). A static IP address is required.
  • activitiesToPublishAsAccessoriesSwitch array of Activities you want to expose as switches (all by default)
  • showTurnOffActivity configures whether to publish a "switch" accessory to turn off every activity (defaults to false).
    • if you set to true, The "switch" will be "on" if and only if there is no current activity, and toggling it while "on" does nothing.
    • if you set to "inverted", The "switch" will be "off" if and only if there is no current activity, and toggling it while "off" does nothing.
    • if you set to "stateless", it will always be off, but can be triggered to switch off current activity.
  • skipedIfSameStateActivities array of Activities name to trigger only if their state is different from the action sent. Can be usefull if your devices in the activity have the same on / off command and you want to automate them outside off the home app . For TV mode, and PowerOff feature, you can add "PowerOff" to this list if you want.
  • addAllActivitiesToSkipedIfSameStateActivitiesList option to add all activities automatically to skipedIfSameStateActivities behavior. (defaults : false)
  • publishActivitiesAsIndividualAccessories option to publish activities as individual accessories. Defaults to true.
  • devicesToPublishAsAccessoriesSwitch array of Devices to exposes with on/off function or custom functions
  • publishDevicesAsIndividualAccessories option to publish devices as individual accessories. Defaults to true.
  • sequencesToPublishAsAccessoriesSwitch array of Sequences to exposes through a switch.
  • publishSequencesAsIndividualAccessories option to publish sequences as individual accessories. Defaults to true.
  • homeControlsToPublishAsAccessoriesSwitch array of home controls you want to publish as switches
  • publishHomeControlsAsIndividualAccessories option to publish home controls as individual accessories. Defaults to true.
  • TVPlatformMode option to try TV mode . STILL WORK IN PROGRESS - NEEDS IOS 12.2 / HOMEBRIDGE 0.0.46
  • mainActivity set the mainactivity of the TV mode
  • playPauseBehavior play/pause behavior in TV mode : if set to true, will send pause if played was set and vice-verca. Be aware that both commands must be available, and that it might be out of sync in case of external events (defaults : false - always send play command)
  • remoteOverrideCommandsList option to ovverride default commands mapping in TV Platform Mode. See below for format.
  • activitiesToPublishAsInputForTVMode array of Activities you want to expose as inputs (all by default)
  • numberOfCommandsSentForVolumeControl option to set the nnumber of commands to send for each volum (up or down) press. Defaults to 1

All devices / Activites names are the one configured in harmony configuration, even if you rename them in home app.

Option devicesToPublishAsAccessoriesSwitch is an array that behaves this way :

  • You should put the name of the device as it is named in harmony app,
  • You can add a specific command or multiple ones JUST AFTER A ";" or a series of ";" if you want a switch to be added for this specific command or serie of commands (a default delay of 350ms will be added between each command if no sepecif delay is specified),
  • If you do not specify any specific command, the plugin will add either powerToggle if found in Power command group, or PowerOn and/or PowerOff if there is no powerToggle feature,

As a sample :

  "devicesToPublishAsAccessoriesSwitch" : ["Apple TV Gen 4;Play","Apple TV Gen 4;DirectionDown","Caisson","Sony PS4","MyDevice;Up|Up|2500;Down"]

will add

  • a switch for "Apple TV Gen 4" "Play" command,
  • a switch for "Apple TV Gen 4" "DirectionDown" command,
  • a powerToggle switch for the device named "Caisson",
  • a powerOff switch only for PS4 (since there is no powerToggle nor powerOn command for it)
  • a switch that will send Up , then Up, then wait 2.5S, then send Down to MyDevice

All commands available are displayed at startup

Option sequencesToPublishAsAccessoriesSwitch is an array that behaves this way :

  • You should put the name of the sequence as it is named in harmony app,

As a sample :

   "sequencesToPublishAsAccessoriesSwitch" : ["Test"]

will expose the sequence Test as a button.

See Logitech Harmony Sequence Configuration for sequences configuration.

Please note that the sequence can only be triggered if its activity is in use. (Sequences are linked to an activity by design in harmony app).

Option remoteOverrideCommandsList is an array that behaves this way :

  • You should put the name of the activity as it is named in harmony app,
  • Then you should put the name of the command you want to ovverride
  • Then you should put the name of the targeted device
  • And finnaly the name of the command
  • A '|' between each override for an activity, a ';' for spliting info of ovverride sequence

As a sample :

    "remoteOverrideCommandsList": {
        "La TV": {
            "REWIND": "Ampli;Number0",
            "BACK": "TV;Back"
        },
        "Un Film": {
            "ARROW_LEFT": "TV;PreviousChannel"
        }
    }

will bahaves this way :

  • for "La TV" activity :
    • override REWIND button in the remote with Number0 command for Ampli device
    • override BACK button in the remote with Back Command of TV device
  • for "Un Film" activity :
    • override ARROW_LEFT in the remote with PreviousChannel of TV device

Button List is :

  • REWIND
  • FAST_FORWARD
  • NEXT_TRACK
  • PREVIOUS_TRACK
  • ARROW_UP
  • ARROW_DOWN
  • ARROW_LEFT
  • ARROW_RIGHT
  • SELECT
  • BACK
  • EXIT
  • INFORMATION
  • PLAY
  • PAUSE
  • VOLUME_UP
  • VOLUME_DOWN
  • MUTE
  • MENU

Commands of your device is shown in the log at startup in lines like : 'INFO - Command : COMMAND_NAME discovered for device : DEVICENAME'

Changelog

See CHANGELOG.

Inspiration

Thanks to

  • iandday for the Harmoney WebSocket protocol implementation and understanding of it.
  • lopelex for his clean plugin.
  • every tester / contributor that test, and give feedback in any way , and especially gitgayhub for Home controls in 0.6.0

Donating

Support this project and others by nicoduj via PayPal.

Support via PayPal

License

As of Dec 01 2018, Nicolas Dujardin has released this repository and its contents to the public domain.

It has been released under the UNLICENSE.

You can’t perform that action at this time.