RM3's also - but this time with more geek.

, posted: 16-Jul-2017 20:16

Steve just blogged about the great little RM3 device - https://www.geekzone.co.nz/sbiddle/8949 - a small IR capable device with a number of IR transmitters in it.  Capable of controling heatpumps, tvs and stereos.

But using their app, does allow the little device on the internet, as as Steve alluded to, it's not pretty and uses their cloud when you're out an about.  While simple to use, that's not geeky enough for me, and I'm already using the OpenHAB app, why would I want to use another one for one device?  You're right, I wouldn't.

OpenHAB has concept on bindings and services.  These are addons for controlling various aspects or other systems.  Now the RM3 addon can't be written, because there's an element of revers engineering the protocol and including decryption.  So people looked for another method.

If you've read my other Home automation posts, you'd see I'm a big fan on MQTT - Mosquitto.  It's a great little transport system for sending and receiving small messages for receiving status messages (from devices), or sending commands.

Well some bright spark, made a RM3 <-> MQTT bridge, that means that any home automation software and interact with it.  I took this code and forked it to add some more remotes, and are in the process of adding support for multiple RM3 devices.  As, as soon as I had one working, I had to get another one.

Here's the link to github: https://github.com/eschava/broadlink-mqtt - or to follow my version: https://github.com/psyciknz/broadlink-mqtt

Follow the instructions to get it installed, this will mean you've got a script that you can run that will talk to your RM3.  There are some commands (specifically support for some Samsung TVs and a Yahama Amplifier) as part of the package, but you can record any new codes you need.  It's unfortunate the code sequences differ from lirc...but thems the brakes.

So what I'll actually be writing about is getting the MQTT bit going, specifically for OpenHAB, but it should be transportable across any system that has interaction with MQTT.

So if you haven't already got one, you'll need a mosquitto server.  There's servers for linux and windows.  The windows one works, but I prefer to run them on linux.  So I have one machine set up and a mosquitto server.  This will receive and send and mqtt messages.

 

The process is, that a command is sent from OpenHab to a special topic starting with broadlink.  The rest of the topic, relates to the command to send.

Eg:

broadlink/tv/samsung/volumedown replay

This is telling the broadlink-mqtt script to send, or replay, the command from tv/samsung/volumedown to the attached RM3 device.

So how do I get OpenHAB to send it's command to the right place.

I use a rollershutter OpenHAB item.  In either OpenHAB 1 or 2.  An Items file is a list of items that can be interacted with.

Rollershutter rm3_lounge_samsung_volume "Volume" (rm3) { mqtt=">[mqttbroker:broadlink/tv/samsung/volumeup:command:UP:replay],>[mqttbroker:broadlink/tv/samsung/volumedown:command:DOWN:replay]"}

 I'll break this up into it's bits.

Rollershutter is the item type.   - It presents an up and down arrow, and as a device sends and UP and DOWN command to the item.

rm3_lounge_samsung_volume is the item name - which is called from a sitemap - the sitemap is what decides what to items to display.

"Volume" is the icon name - there's a bunch of these as presets.

(rm3) is it's group.  Can be used for controlling multiple items as a whole, or for grouping display items.

The MQTT bit is what communicates with MQTT.  This also has a number of parts.

OpenHab has a number of MQTT brokers - which are configured in the settings.  I have an broker called mqttbroker, which exists on a linux machine - lets call it fred.

In the MQTT command > denotes that it is a command being sent.  As opposed to < which is a status being received into OpenHAB.  So in this case we are sending one of two states.  One for when the roller shutter item Up arrow is pressed, and another for when down is pressed.

So for the UP state, we are sending the replay mqtt message to broadlink/tv/samsung/volumeup, which as we know from before the broadlink-mqtt script will see this command, and replay, the volumeup command to the connected RM3 and therefore change the volume up by one increment.  For the DOWN state, a replay to broadlink/tv/samsung/volumedown will be sent.

This configuration can be repeated for each command for each device.  All that differs is the mqtt command that is being sent out, and how it is attached to the various OpenHAB item types.

Hope that helps someone.  I wrote this after trying to explain to Steve how MQTT worked, so figured I'd better write it down.  If need be, I can add other OpenHAB items types for explanation.  And how you can send a different command to a device that has distinct on and off ir commands.  Or switching between multiple sources.

 

 

 

More information

Other related posts:
Wemos D1 Mini Door Contact (plus temperature)
Controlling a 12v fan from a raspberry Pi.
OpenHAB and Bluetooth beacons for temperature (Blue Maestro Tempo Disc)




comments powered by Disqus

davidcole's profile

davidcole Cole
Lower Hutt
New Zealand


Been thinking it would be nice to have a blog but not sure if I have enough to say.

I'm an I.T worker from Wellington New Zealand.

I like my toys so this will probably have posts about my dealings with those.

My Cellphone is an iPhone 5s

I run a NextPVR based PVR at home to replace my video recorder, DVD player and to host all my music. I'm also really big on Plex, for centralising all my music, videos and I've written a plugin or two for it for accessing live TV and for storing recordings with metadata.





TVNZ Ondemand App behind Unblo...
(27-Feb-2013 19:39, 11613 views)
Controlling a 12v fan from a r...
(17-Jan-2017 07:49, 9422 views)
eReceipts - Why don't we have ...
(12-Jan-2012 10:01, 8975 views)
OpenHAB and Bluetooth beacons ...
(19-Dec-2016 21:39, 8858 views)
PDF Forms - why you no boxes?...
(26-Jun-2012 09:04, 8111 views)
Free $80 - come and get ur mon...
(20-Sep-2011 13:11, 7759 views)
Contactless Payments - part 2...
(21-Sep-2011 15:12, 5408 views)
Little Boys and their Sewing M...
(27-Dec-2009 11:09, 5351 views)
RM3's also - but this time wit...
(16-Jul-2017 20:16, 5205 views)
TVNZ Ondemand App behind Unblo...
(1-Mar-2013 07:14, 4558 views)