Add control for a custom remote on OpenHab


I actually reverse enginereed my tv remote for my haier TV :
Basically, you send post and get command to switch channel and everything.

Now, I don’t understand how to add all this API to my openhab installation? do I need to develop a custom Bindings for my case?

Thank for your help

You may want to take a look at the HTTP binding. ( From what I saw on GitHub, it looks like you are just using HTTP. I don’t have any experience using the binding or with Haier TVs though.


1 Like

There are many ways you can achieve this and their is now wrong way only working or not.

This is one way I achived sending requsts to a device.It uses Json not XML so would need some changes but not many.

The crux of it is sending data using curl.

curl@@-sSH@@"Accept: */*"@@-H@@"Content-Type: text/plain"@@-X@@POST@@-d@@' + CommandData + '@@' + CommandURL

You do this by Exec Action

You may need to create a map file to handle body data to make it easier to follow.

So you could do custom binding or just use a rule to send the data using curl

Thank for the response :
I did this :

 rule "Télévision item_television_power"
     Item item_television_power received update
    logWarn("television", "item_television_power");

    sendHttpPostRequest("", "", "<remote><key code=1012/></remote>");

rule "Télévision item_television_channel"
    Item item_television_channel received command

    logInfo("item_television_channel", "item_television_channel");

    logInfo("item_television_channel", item_television_channel.state.toString);

    if (item_television_channel.state.toString.length < 2) {

        sendHttpPostRequest("", "", "<remote><key code=100"+ item_television_channel.state.toString +"/></remote>");

    } else {

        var number = item_television_channel.state.toString.split('');

        for (var i = 0; i < number.length; i++) {

            logInfo("item_television_channel", number.get(i));

             sendHttpPostRequest("", "", "<remote><key code=100"+ number.get(i) +"/></remote>");






and in item

Group   Television              "Télévision"                            {alexa="Endpoint.TV"}

    Switch  item_television_power   "Alim"              (Television)        {alexa="PowerController.powerState"}

    String  item_television_channel "Chaine"            (Television)        {alexa="" [TF1=1, M6=6, ARTE=7, C8=8, W9=9, TMC=10, NRJ12=12, FR4=14,  GULLI=18]}