# Logitech Harmony to MQTT Camera

**URL:** <https://discourse.nodered.org/t/logitech-harmony-to-mqtt-camera/22799>\
**Category:** Share Your Projects\
**Created:** [8 March 2020 14:49 UTC](https://discourse.nodered.org/t/logitech-harmony-to-mqtt-camera/22799 "2020-03-08T14:49:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpxd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mpxd/32/2028_2.png) [@mpxd](https://discourse.nodered.org/u/mpxd)\
**Post date:** [8 March 2020 14:49 UTC](https://discourse.nodered.org/t/logitech-harmony-to-mqtt-camera/22799/1 "2020-03-08T14:49:05Z")

</div>

## Install Fakeroku on Node-RED

Open the Node-RED Menu in the top right corner and click on **Manage Palette**. There switch to the **Install** tab and search for `fakeroku` and install the [node-red-contrib-fakeroku](https://flows.nodered.org/node/node-red-contrib-fakeroku).

Now add a Fakeroku node to your flow and configure it as follows:

 ![Node-RED_Logitech_Harmony_02](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/2/126aa8ddbc9ea82e401bf3adf717c37a049594a6.png)

The IP address has to be set to the LAN IP of your Node-RED installation - in my case `192.168.2.111`, you can keep the default port and multicast IP and click the **+** icon to generate a UUID for your device.

Now switch to your Harmony smartphone app and search for new devices on your network. Fakeroku will show up as a **Roku 3**. Continue by adding an **Activity** and save your settings.

## Set up Node-RED to Update MQTT Topics

The Fakeroku virtual device will now give you access to the following buttons on your Harmony Remote:

 ![Node-RED_Logitech_Harmony_03](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/a/5afc95b1bb383f73b2c666a460ee1401955ef051.png)

For example **Button 1** will send the payload string **Rev** to Node-RED when you press it.

In the following I want to connect it to a Node-RED flow that allows me to cycle through the first 4 preset positions of my Pan&Tilt camera using the [INSTAR MQTT Service](https://discourse.nodered.org/t/mqtt-camera-for-node-red/20441) when this button is pressed.

Here is the complete list of actions that the complete flow will add:

1. `Rev` - Go to last **Preset Position**
2. `Play` - Start a `x` Second **Video Recording**
3. `Fwd` - Go to next **Preset Position**
4. `Home` - Deactivate the **Alarm**
5. `Up` - Move Camera **Up** by one Step
6. `Right` - Move Camera **Right** by one Step
7. `Down` - Move Camera **Down** by one Step
8. `Left` - Move Camera **Left** by one Step
9. `Select` - Stop Camera Movement
10. `Back` - Activate the **Alarm**
11. `Info` - Trigger enabled Alarm Actions

The flow needed for those actions looks like this and can be downloaded and imported to Node-RED from the JSON export pasted in below:

 ![Node-RED_Logitech_Harmony_04](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/3/c34025b6c14faf96adf4903c20715933ef3dddde.png)

### Node-RED Flow

```json
[{"id":"a7f685cf.720f58","type":"fakeroku-device","z":"1dfd915c.6102cf","confignode":"5699281e.1bbbc8","x":80,"y":180,"wires":[["f5aa6aa6.abeb78","3befcb89.667824","625b1ba9.24a254","62de79f2.f75328","1a8d0caa.b38743"]]},{"id":"f5aa6aa6.abeb78","type":"switch","z":"1dfd915c.6102cf","name":"PTZ","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Up","vt":"str"},{"t":"eq","v":"Down","vt":"str"},{"t":"eq","v":"Left","vt":"str"},{"t":"eq","v":"Right","vt":"str"},{"t":"eq","v":"Select","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":286,"y":332,"wires":[["709a2dd0.a05e24"],["2b4c510.d949db"],["c4363ae8.54ee58"],["edf366d8.120318"],["ce60b71c.910af8"]]},{"id":"686b53b1.dee5fc","type":"mqtt out","z":"1dfd915c.6102cf","name":"features/ptz/movestep","topic":"instar/local/features/ptz/movestep/raw","qos":"1","retain":"","broker":"fbc900bc.b83bb","x":627,"y":332,"wires":[]},{"id":"709a2dd0.a05e24","type":"change","z":"1dfd915c.6102cf","name":"up","rules":[{"t":"set","p":"payload","pt":"msg","to":"up","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":415,"y":252,"wires":[["686b53b1.dee5fc"]]},{"id":"2b4c510.d949db","type":"change","z":"1dfd915c.6102cf","name":"down","rules":[{"t":"set","p":"payload","pt":"msg","to":"down","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":415,"y":292,"wires":[["686b53b1.dee5fc"]]},{"id":"c4363ae8.54ee58","type":"change","z":"1dfd915c.6102cf","name":"left","rules":[{"t":"set","p":"payload","pt":"msg","to":"left","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":415,"y":332,"wires":[["686b53b1.dee5fc"]]},{"id":"edf366d8.120318","type":"change","z":"1dfd915c.6102cf","name":"right","rules":[{"t":"set","p":"payload","pt":"msg","to":"right","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":415,"y":372,"wires":[["686b53b1.dee5fc"]]},{"id":"edd8e86c.1a00e8","type":"inject","z":"1dfd915c.6102cf","name":"Activate","topic":"","payload":"","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":605,"y":231,"wires":[["48e05d12.6b8d84"]]},{"id":"48e05d12.6b8d84","type":"change","z":"1dfd915c.6102cf","name":"Initialize","rules":[{"t":"set","p":"counter","pt":"flow","to":"-1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":745,"y":231,"wires":[[]]},{"id":"ac59a9a4.a61318","type":"function","z":"1dfd915c.6102cf","name":"Counter","func":"var status = msg.payload;\n\nvar counter = flow.get(\"counter\") || 0;\n\nif (status == \"Fwd\")\n {\n \n if (counter < 3)\n {\n counter = counter + 1;\n flow.set(\"counter\",counter);\n return msg;\n }\n else\n {\n counter = 0;\n flow.set(\"counter\",counter);\n return msg;\n \n }\n }\n \nelse {\n \n if (counter > 0)\n {\n counter = counter - 1;\n flow.set(\"counter\",counter);\n return msg;\n }\n else\n {\n counter = 3;\n flow.set(\"counter\",counter);\n return msg;\n }\n}\n\n ","outputs":1,"noerr":0,"x":412,"y":182,"wires":[["e4ae5134.3976c"]]},{"id":"3befcb89.667824","type":"switch","z":"1dfd915c.6102cf","name":"FWD/REV","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Fwd","vt":"str"},{"t":"eq","v":"Rev","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":272,"y":180,"wires":[["ac59a9a4.a61318"],["ac59a9a4.a61318"]]},{"id":"7f883c84.232894","type":"mqtt out","z":"1dfd915c.6102cf","name":"features/ptz/preset","topic":"instar/local/features/ptz/preset/raw","qos":"1","retain":"","broker":"fbc900bc.b83bb","x":718,"y":182,"wires":[]},{"id":"e4ae5134.3976c","type":"function","z":"1dfd915c.6102cf","name":"Position","func":"msg.payload = flow.get(\"counter\") || 0;\n\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":182,"wires":[["7f883c84.232894"]]},{"id":"625b1ba9.24a254","type":"switch","z":"1dfd915c.6102cf","name":"Home/Back","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Home","vt":"str"},{"t":"eq","v":"Back","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":277,"y":478,"wires":[["c3149921.424398"],["ecee0588.bb37f8"]]},{"id":"c3149921.424398","type":"change","z":"1dfd915c.6102cf","name":"1","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":416,"y":460,"wires":[["d25c7f9e.b86d9","e28db00c.de5f7","32defe83.1910e2","5514217a.15a4","e5a74104.f5b2d"]]},{"id":"ecee0588.bb37f8","type":"change","z":"1dfd915c.6102cf","name":"0","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":416,"y":500,"wires":[["e5a74104.f5b2d","5514217a.15a4","32defe83.1910e2","e28db00c.de5f7","d25c7f9e.b86d9"]]},{"id":"e28db00c.de5f7","type":"mqtt out","z":"1dfd915c.6102cf","name":"alarm/area1/enable","topic":"instar/local/alarm/area1/enable/raw","qos":"","retain":"","broker":"fbc900bc.b83bb","x":632,"y":447,"wires":[]},{"id":"32defe83.1910e2","type":"mqtt out","z":"1dfd915c.6102cf","name":"alarm/area2/enable","topic":"instar/local/alarm/area2/enable/raw","qos":"","retain":"","broker":"fbc900bc.b83bb","x":632,"y":493,"wires":[]},{"id":"5514217a.15a4","type":"mqtt out","z":"1dfd915c.6102cf","name":"alarm/area3/enable","topic":"instar/local/alarm/area3/enable/raw","qos":"","retain":"","broker":"fbc900bc.b83bb","x":632,"y":539,"wires":[]},{"id":"e5a74104.f5b2d","type":"mqtt out","z":"1dfd915c.6102cf","name":"alarm/area4/enable","topic":"instar/local/alarm/area4/enable/raw","qos":"","retain":"","broker":"fbc900bc.b83bb","x":632,"y":585,"wires":[]},{"id":"d25c7f9e.b86d9","type":"mqtt out","z":"1dfd915c.6102cf","name":"features/ptz/preset","topic":"instar/local/features/ptz/preset/raw","qos":"1","retain":"","broker":"fbc900bc.b83bb","x":633,"y":400,"wires":[]},{"id":"62de79f2.f75328","type":"switch","z":"1dfd915c.6102cf","name":"Play","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Play","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":253,"y":644,"wires":[["bbdd25c2.7ca7e8","cc56f3e2.29cfb"]]},{"id":"782bc830.959dc8","type":"mqtt out","z":"1dfd915c.6102cf","name":"features/manualrec/start","topic":"instar/local/features/manualrec/start/raw","qos":"1","retain":"","broker":"fbc900bc.b83bb","x":612,"y":644,"wires":[]},{"id":"bbdd25c2.7ca7e8","type":"change","z":"1dfd915c.6102cf","name":"{\"val\":\"60\"}","rules":[{"t":"set","p":"payload","pt":"msg","to":"60","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":412,"y":644,"wires":[["782bc830.959dc8"]]},{"id":"cc56f3e2.29cfb","type":"delay","z":"1dfd915c.6102cf","name":"30s","pauseType":"delay","timeout":"30","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":248,"y":690,"wires":[["9a762fde.748ff"]]},{"id":"21d78cf6.3df984","type":"mqtt out","z":"1dfd915c.6102cf","name":"features/manualrec/stop","topic":"instar/local/features/manualrec/stop/raw","qos":"1","retain":"","broker":"fbc900bc.b83bb","x":612,"y":690,"wires":[]},{"id":"9a762fde.748ff","type":"change","z":"1dfd915c.6102cf","name":"{\"val\":\"off\"}","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":408,"y":690,"wires":[["21d78cf6.3df984"]]},{"id":"ce60b71c.910af8","type":"change","z":"1dfd915c.6102cf","name":"right","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":415,"y":411,"wires":[["686b53b1.dee5fc"]]},{"id":"1a8d0caa.b38743","type":"switch","z":"1dfd915c.6102cf","name":"Info","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Info","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":231,"y":764,"wires":[["d6fd272a.1b92f8"]]},{"id":"94d84f16.62437","type":"mqtt out","z":"1dfd915c.6102cf","name":"alarm/pushalarm","topic":"instar/local/alarm/pushalarm/raw","qos":"1","retain":"","broker":"fbc900bc.b83bb","x":627,"y":764,"wires":[]},{"id":"d6fd272a.1b92f8","type":"change","z":"1dfd915c.6102cf","name":"1","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":379,"y":764,"wires":[["94d84f16.62437"]]},{"id":"5699281e.1bbbc8","type":"fakeroku-config","z":"","ip":"192.168.2.111","multicast":"239.255.255.250","uuid":"68580784e7ec5daf8d50f26874628384","port":"8086"},{"id":"fbc900bc.b83bb","type":"mqtt-broker","z":"","name":"192.168.2.117 (PrivCert)","broker":"192.168.2.117","port":"8883","tls":"d525c1aa.03cac","clientid":"nodered","usetls":true,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"d525c1aa.03cac","type":"tls-config","z":"","name":"192.168.2.117 (PrivCert)","cert":"","key":"","ca":"","certname":"client.pem","keyname":"","caname":"","servername":"","verifyservercert":false}]

```

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [8 March 2020 15:07 UTC](https://discourse.nodered.org/t/logitech-harmony-to-mqtt-camera/22799/2 "2020-03-08T15:07:19Z")

</div>

Shouldn't you mention that one also needs to install the fakeroku node ?

---

<div class="post-metadata">

**Author:** ![mpxd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mpxd/32/2028_2.png) [@mpxd](https://discourse.nodered.org/u/mpxd)\
**Post date:** [8 March 2020 15:11 UTC](https://discourse.nodered.org/t/logitech-harmony-to-mqtt-camera/22799/3 "2020-03-08T15:11:02Z")

</div>

Oh absolutely right, it is the wrong link. I tried it with harmony-websocket before I used Fakeroku. I will change the link. Thank you!

You only need [node-red-contrib-fakeroku](https://flows.nodered.org/node/node-red-contrib-fakeroku)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 May 2020 14:49 UTC](https://discourse.nodered.org/t/logitech-harmony-to-mqtt-camera/22799/4 "2020-05-07T14:49:11Z")

</div>

This topic was automatically closed after 60 days. New replies are no longer allowed.
