openHAB zmote binding

restapi
remotecontrol
httpbinding
Tags: #<Tag:0x00007f18253603c8> #<Tag:0x00007f1825360288> #<Tag:0x00007f1825360120>

(Urmil Parikh) #1

Hi, I’m one of the developers of zmote (pronounced zee-mote), which is a Wi-Fi to/from IR device with cloud connectivity.

I’m planning to create openHAB zmote binding and as suggested by openHAB contributing page, I’m writing to this forum.

zmote supports sending IR commands over TCP, HTTP and MQTT protocols, so it should be pretty simple to write one from scratch or modify an existing binding that uses (preferably) HTTP.

It will be good to get some guidance from experts in this group to get started, or for a co-development, if someone is interested.

HTTP APIs can be found here: https://hackaday.io/project/7858-zmote/log/27078-rest-control-over-zmote
More information at http://www.zmote.io

Thank you!
Urmil Parikh


Zmote - wifi universal IR remote
Infrared remote control
(Rich Koshak) #2

This looks like it should be a pretty simple binding to write and it does address an undeserved area (IR control).

Absolutely stick with the HTTP API for communication from the binding. Those who want to can use the MQTT binding to talk to it without need for a separate zmote binding. Plus you don’t want to have to depend upon there being a broker installed.

I’d write this as an openHAB 2 binding rather than an openHAB 1.x binding. OH 2 is nearing its first full release and when that happens it will become the official openHAB and openHAB 1.x will be essentially end-of-life (though I’m certain there will be a large population of users who can’t or won’t upgrade).

The API looks simple enough that one could integrate it without a binding at all, instead just using the HTTP binding or MQTT binding. You might start with that to work out the use cases (i.e. what is the appropriate openHAB Item type to represent each of the controls zmote supports, e.g. represent Volume as a Dimmer, channel as a Setpoint, On/Off as a Switch, etc.).

I’ve not coded a binding yet so can’t help with that part. Hopefully someone will chime in.


(Urmil Parikh) #3

That’s a great idea!
If I stick to HTTP, I don’t need a dedicated binding. I can use the default HTTP binding.

Uh, oh. The HTTP binding documentation says it is currently not possible to send a message body, so I’ll have to execute curl command (which I don’t prefer) or I’ll need to tweak zmote APIs.

A noob question: Can I store my base URL in a variable / constant and use it in HTTP binding? That way I can separate zmote’s IP part of url from IR command part. I feel it is not a good idea to replicate IP in every command.


(Rich Koshak) #4

In Rules the answer is yes. Just define a global val String baseURL = "http://...". This will work with sendHttp* actions.

NOTE: The sendHttpPut and sendHttpPost actions do allow you to send a message body.

You can also create a String Item and populate it with the base URL using a System started rule and then reference the state of that Item in your Rules.

But you cannot do any of this inside the Items file with the HTTP binding.

This is another good argument for why this would make a good new Binding in the long run.


(Urmil Parikh) #5

Thank you, @rlkoshak! That helps a lot :+1:

Using sendHttpPost in rules will get me started with openHAB, even without a dedicated binding.

I’m not so used to with Java, so I’m trying to avoid creating a binding :wink: .


(Stein Tore) #6

does the zmote require an internet connection during use? or is it only during set up?


(Urmil Parikh) #7

It is a Wi-Fi to IR gateway, so it needs Wi-Fi to be connected in order to receive commands.

It can work within local network / intranet.


( ) #8

Hey @urmilparikh, this looks pretty good. I would consider buying one of these, especially if there was a binding specific to it. From the documentation I know that there is a database and you are dealing with a lot of data (ir codes etc). Do you already have an idea on how to best make these available in comfortable ways inside openHAB?

I would also recommend to work on a openHAB2 binding.


(Stein Tore) #9

I’m also considering to buying one/two of these if there’s a binding available.


(Urmil Parikh) #10

Hi @ThomDietrich, @stein_tore_tosse, I have got it working to some extent (sending individual IR commands) and I’m able to control POWER and MUTE functions of my TV using HTTP binding as of now, and it is really simple.

For supporting macros (multiple IR commands with delays in between), like switching cable box to a 3-digit channel, I need support for including body text in HTTP POST, which is not currently supported. But, it may come very soon (see the github link below).

Now, if you guys still think a dedicated binding is required, I’ll need a little help in getting started and I think it shouldn’t take much coding.


(Urmil Parikh) #11

Hi @ThomDietrich, I forgot to say earlier that I have lirc DB converted in to JSON format.

If someone can guide me how it can be made available in openHAB, I’d be glad to do so. I’m really noob at openHAB, but I can script out conversion from JSON to any other suitable format.


(Kai Kreuzer) #12

Hi @urmilparikh,

Please have a look at http://docs.openhab.org/developers/development/bindings.html - this should hopefully help you to get started with binding development!

Best regards,
Kai


(Urmil Parikh) #13

Hi @Kai,

Thank you for that link.

As the page suggests, I’d prefer to create bindings directly for Eclipse SmartHome project, since it will make it available for multiple similar projects.

I want to confirm two things:

  1. Will the binding for Eclipse SmartHome directly work with openHAB2 or will it need any changes?
  2. IDE setup instructions here says: Expand the “SmartHome” entry, double click “Runtime and Designer” and select “Next”, whereas on OH2 doc here says: Expand the “Github.com/openHAB” entry, double click “openHAB Development”. Does it matter which one I select? Are they same?

Thanks!


(Kai Kreuzer) #14
  1. Yes, it will be included in openHAB2 just as any other binding. See e.g. Philips hue, Sonos, LIFX and others, which are also hosted at Eclipse.
  2. I’d recommend the openHAB IDE setup as this is easier. The ESH setup only required if you want to work on core ESH code, which isn’t necessary when implementing a binding. Just make sure that you also select “openHAB Development” and “Eclipse SmartHome Extensions” to make sure that the IDE also clones the ESH repo (in which you will then create the binding skeleton).

Regards,
Kai


(Urmil Parikh) #15

How about this?

If any experienced developer offers to create a binding for zmote, he/she gets a couple of zmotes free of cost and gets credited on our website.

Anyone?

I’m sure that will get us a better quality binding. :slight_smile:


(Ari Hagman) #16

Hello, just ordered one, but of course working binding would be great too. But lack of time (and skills) not able contribute…

So informing that one customer waiting for the binding :slight_smile:


(Urmil Parikh) #17

Thank you, @Ari_Hagman.


(Christian Wonschina) #18

I also ordered two, so keep on coding :wink:


(Urmil Parikh) #19

Great!


(Mike Dilger) #20

I have also ordered 2 units and am eagerly waiting to test your binding.