INSTAR Deutschland GmbHINSTAR Deutschland GmbH

Logitech Harmony in Home Assistant via INSTAR MQTT



Install EmulatedRoku on Home Assistant

We will now install an emulated Roku device in Home Assistant that will allow us to set up an interface with the Logitech Harmony Hub. Open the Integration tab inside the Configuration menu and set up the EmulatedRoku extension.

Logitech Harmony MQTT Control with Home Assistant

You can now switch back to the general tutorial to add the virtual device to your Logitech Harmony Hub.

INSTAR MQTT Setup

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

Logitech Harmony MQTT Control with Home Assistant

For example Button 1 will send the payload string Rev to Home Assistant when you press it.

  1. Rev - Unused
  2. Play - Start a x Second Video Recording
  3. Fwd - Unused
  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

We now need to add automations that allows us to update MQTT topics on our camera when we receive a message from our Harmony Remote. To do this open the configuration menu and add a new automation:

Logitech Harmony MQTT Control with Home Assistant

platform: event
event_type: roku_command
event_data:
  source_name: Home Assistant
  type: keypress
  key: Up

Logitech Harmony MQTT Control with Home Assistant

service: script.send_mqtt_command
data:
  message: '{"val":"up"}'
  target: instar/local/features/ptz/movestep

Pan & Tilt your Camera

This automation listens to the Up, Right, Down and Left button and updates the according "One-Step" MQTT Topics on your camera just like in the example shown above.

Arm your Alarm before your leave your Home

This automation defines an armed and disarmed state for your camera. When armed your camera will keep an eye on your living room. When disarmed your camera will turn away and deactivates all motion detection areas. Note that if you are using the camera's internal PIR motion sensor in combination with those detection areas, you will have to deactivate the sensor as well for this to work:

Logitech Harmony MQTT Control with Node-RED

Logitech Harmony MQTT Control with Node-RED

Start a Manual Video Recording

This automation enables you to start a manual video recording when pressing the Play button on your remote. Note that the delay is currently set to 30s - you can adjust the length of your according by changing this value:

Logitech Harmony MQTT Control with Node-RED

Logitech Harmony MQTT Control with Node-RED

Trigger an Alarm

And now to the simplest automation Pressing the Info button will trigger an alarm on your camera. This event will trigger all active alarm actions on your camera - like vide recordings, email notifications, FTP uploads, etc.:

Logitech Harmony MQTT Control with Node-RED

Logitech Harmony MQTT Control with Node-RED

Conclusion

This is just a small overview over all the available MQTT Topics on your camera. All of them can be send and combined with a press of a button on your Logitech Harmony Remote. More information for using the INSTAR MQTT interface with Home Assistant can be found in our full tutorial.

automations.yaml export

- id: '1583746741522'
  alias: Harmony PT Up
  description: 'Tilt camera up when Up is pressed on my Harmony remote '
  trigger:
  - event_data:
      key: Up
      source_name: Home Assistant
      type: keypress
    event_type: roku_command
    platform: event
  condition: []
  action:
  - data:
      message: '{"val":"up"}'
      target: instar/local/features/ptz/movestep
    service: script.send_mqtt_command
- id: '1583747187870'
  alias: Harmony PT Down
  description: ' '
  trigger:
  - event_data:
      key: Down
      source_name: Home Assistant
      type: keypress
    event_type: roku_command
    platform: event
  condition: []
  action:
  - data:
      data:
        message: '{"val":"down"}'
        target: instar/local/features/ptz/movestep
    service: script.send_mqtt_command
- id: '1583747246045'
  alias: Harmony PT Left
  description: ''
  trigger:
  - event_data:
      key: Left
      source_name: Home Assistant
      type: keypress
    event_type: roku_command
    platform: event
  condition: []
  action:
  - data:
      message: '{"val":"left"}'
      target: instar/local/features/ptz/movestep
    service: script.send_mqtt_command
- id: '1583747337674'
  alias: Harmony PT Right
  description: ''
  trigger:
  - event_data:
      key: Right
      source_name: Home Assistant
      type: keypress
    event_type: roku_command
    platform: event
  condition: []
  action:
  - data:
      message: '{"val":"right"}'
      target: instar/local/features/ptz/movestep
    service: script.send_mqtt_command
- id: '1583748047823'
  alias: Harmony I am Home
  description: Deactivate alarm areas and turn around
  trigger:
  - event_data:
      key: Home
      source_name: Home Assistant
      type: keypress
    event_type: roku_command
    platform: event
  condition: []
  action:
  - data:
      message: '{"val":"0"}'
      target: instar/local/alarm/area1/enable
    service: script.send_mqtt_command
  - data:
      message: '{"val":"0"}'
      target: instar/local/alarm/area2/enable
    service: script.send_mqtt_command
  - data:
      message: '{"val":"0"}'
      target: instar/local/alarm/area3/enable
    service: script.send_mqtt_command
  - data:
      message: '{"val":"0"}'
      target: instar/local/alarm/area4/enable
    service: script.send_mqtt_command
  - data:
      message: '{"val":"0"}'
      target: instar/local/features/ptz/preset
    service: script.send_mqtt_command
- id: '1583748225541'
  alias: Harmony I am Leaving
  description: Activate all alarm areas and keep an eye on my living room
  trigger:
  - event_data:
      key: Back
      source_name: Home Assistant
      type: keypress
    event_type: roku_command
    platform: event
  condition: []
  action:
  - data:
      message: '{"val":"1"}'
      target: instar/local/features/ptz/preset
    service: script.send_mqtt_command
  - data:
      message: '{"val":"1"}'
      target: instar/local/alarm/area1/enable
    service: script.send_mqtt_command
  - data:
      message: '{"val":"1"}'
      target: instar/local/alarm/area2/enable
    service: script.send_mqtt_command
  - data:
      message: '{"val":"1"}'
      target: instar/local/alarm/area3/enable
    service: script.send_mqtt_command
  - data:
      message: '{"val":"1"}'
      target: instar/local/alarm/area4/enable
    service: script.send_mqtt_command
- id: '1583748469538'
  alias: Harmony trigger an alarm
  description: ''
  trigger:
  - event_data:
      key: Info
      source_name: Home Assistant
      type: keypress
    event_type: roku_command
    platform: event
  condition: []
  action:
  - data:
      message: '{"val":"1"}'
      target: instar/local/alarm/pushalarm
    service: script.send_mqtt_command
- id: '1583749140147'
  alias: Harmony record a video
  description: ''
  trigger:
  - event_data:
      key: Play
      source_name: Home Assistant
      type: keypress
    event_type: roku_command
    platform: event
  condition: []
  action:
  - data:
      message: '{"val":"60"}'
      target: instar/local/features/manualrec/start
    service: script.send_mqtt_command
  - delay: 00:00:30
  - data:
      message: '{"val":"off"}'
      target: instar/local/features/manualrec/stop
    service: script.send_mqtt_command