Install Fakeroku on Home Assistant
I want install an emulated Roku device in Home Assistant that will allow us to set up an interface with the Logitech Harmony Hub. I want to be able to control my INSTAR camera through it’s MQTT interface.
Open the Integration tab inside the Configuration menu and set up the EmulatedRoku extension.
Then switch to your Harmony Smartphone app and search for new devices on your network - the virtual Roku device will show up as Roku 3. Save it and add an Activity for it.
Set up Home Assistant to Update MQTT Topics
The Fakeroku virtual device will now give you access to the following buttons on your Harmony Remote:
For example Button 1 will send the payload string Rev to Home Assistant when you press it.
-
Rev
- Unused -
Play
- Start ax
Second Video Recording -
Fwd
- Unused -
Home
- Deactivate the Alarm -
Up
- Move Camera Up by one Step -
Right
- Move Camera Right by one Step -
Down
- Move Camera Down by one Step -
Left
- Move Camera Left by one Step -
Select
- Stop Camera Movement -
Back
- Activate the Alarm -
Info
- Trigger enabled Alarm Actions
We now need to add automations that allows us to update MQTT topics on our INSTAR MQTT camera when we receive a message from our Harmony Remote. To do this open the configuration menu and add a new automation.
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.
platform: event
event_type: roku_command
event_data:
source_name: Home Assistant
type: keypress
key: Up
service: script.send_mqtt_command
data:
message: '{"val":"up"}'
target: instar/local/features/ptz/movestep
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:
Triggers
event_data:
key: Back
source_name: Home Assistant
type: keypress
event_type: roku_command
platform: event
Actions
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
And vice-versa {"val":"0"}
to deactivate everything.
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:
Triggers
event_data:
key: Play
source_name: Home Assistant
type: keypress
event_type: roku_command
platform: event
Actions
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
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.:
Triggers
event_data:
key: Info
source_name: Home Assistant
type: keypress
event_type: roku_command
platform: event
Actions
data:
message: '{"val":"1"}'
target: instar/local/alarm/pushalarm
service: script.send_mqtt_command