IR Eachen Blaster Sending IR commands via MQTT

  • Platform information:
    • Hardware: _Pi3
    • openHAB version:2.5
  • Issue of the topic: Hi there, I’m stuck, been trying to determine how to send IR commands via MQTT to a EACHEN IR HUB which I’ve flashed with Tasmota.
    I’m sure this is very simple but can’t see any documentation about the actual configuration and syntax through paper UI to send a command.
    I can see the Stat info on the Tasmota console of my Aircon unit I’m trying to turn on etc as follows:

08:59:26 MQT: tele/tasmota_8347F2/RESULT = {“IrReceived”:{“Protocol”:“COOLIX”,“Bits”:24,“Data”:“0xB29F6C”,“DataLSB”:“0x4DF936”,“Repeat”:0,“IRHVAC”:{“Vendor”:“COOLIX”,“Model”:-1,“Power”:“On”,“Mode”:“Heat”,“Celsius”:“On”,“Temp”:21,“FanSpeed”:“Min”,“SwingV”:“Off”,“SwingH”:“Off”,“Quiet”:“Off”,“Turbo”:“Off”,“Econo”:“Off”,“Light”:“Off”,“Filter”:“Off”,“Clean”:“Off”,“Beep”:“Off”,“Sleep”:-1}}}

I have a Thing setup in paper UI pointing to the IP of the EACHEN HUB showing online

I just can’t determine what I need to do - ie do I add channel to Thing with string or some other item linked to a new channel? Basically questio is how do I send a command from HABPanel to the EACHEN HUB to send to Aircon unit, and what elements are needed to config, any examples someone can point me to?.

Cheers

Paul

Hvac aircons are different to just sending ir code on off. You need to send all settings each time you change something.

Can you list all of the options you have on your remote. Eg some aircons have fan speed. Low med high. Some have strong quite eco aswell. Then I can help more.

Edit:

Here is an example. This is only for outgoing ir commands so using remote will not update openHAB.

Items For Google home intergration.

Group               Airconditioner             "Aircon"                                            {ga="Thermostat" [modes="off=OFF, heat=HEAT,cool=COOL,on=ON,heatcool=auto"]}
String              AirconditionerMode         "mode"                            (Airconditioner)  {ga="thermostatMode"}
Number:Temperature  AirconditionerTemperature  "Current Ambient [%.1f °C]"       (Airconditioner)  {ga="thermostatTemperatureAmbient"}
Number:Temperature  AirconditionerSetTemp      "Setpoint temperature [%.1f °C]"  (Airconditioner)  {ga="thermostatTemperatureSetpoint"}

Switch              AirconditionerPower
String              AirconditionerSetMode


Part of Sitemap

      Text label="Aircon" icon="heating"{

        Switch item=AirconditionerPower label="AC Power" mappings=[ON="On", OFF="Off"]
        Setpoint item=AirconditionerTemperature label="AC Temp" minValue=17 maxValue=30 step=1
        Switch item=AirconditionerSetMode label="AC Mode" mappings=[cool="COOL", dry="DRY", fan="FAN", heat="HEAT"]
      }

RULES

rule "Send Command to Aircon through IRBLASTER"
when

    Item AirconditionerPower received command or
    Item AirconditionerSetTemp received command or
    Item AirconditionerSetMode received command
then
        val mqttActions = getActions("mqtt","mqtt:broker:myMQTTBroker")
        var int setTemp = (AirconditionerSetTemp.state as Number).intValue
        var jsonString = '{"Vendor":"GREE","Model":1,' + 
                         '"Power":"'+ AirconditionerPower.state.toString +'",' +
                         '"Mode":"'+ AirconditionerSetMode.state.toString +'",' +
                         '"Celsius":"On",' +
                         '"Temp":'+ setTemp +',' +
                         '"FanSpeed":"Auto",' +
                         '"SwingV":"Auto",' +
                         '"SwingH":"Off",' +
                         '"Quiet":"Off",' +
                         '"Turbo":"Off",' +
                         '"Econo":"Off",' +
                         '"Light":"On",' +
                         '"Clean":"Off",' +
                         '"Filter":"Off",' +
                         '"Beep":"Off",' +
                         '"Sleep":-1}'
        logInfo("IRhvac", " Aircon To " + jsonString )    
        mqttActions.publishMQTT("irBlaster2/cmnd/IRhvac",  jsonString )         
        
end

rule "If google control tuning aircon on/off"
when
   Item AirconditionerMode received command
then

          if (receivedCommand != OFF){ 
            AirconditionerPower.sendCommand(ON)
            AirconditionerSetMode.sendCommand(receivedCommand)
            
            } else {
                      AirconditionerPower.sendCommand(OFF)
                   }

end

You will need to change the broker name myMQTTBroker to the same as yours and irBlaster2/cmnd/IRhvac to yours cmnd/tasmota_8347F2/IRhvac

You will also need to change Vendor and other stuff to make it match yours.

{“Vendor”:“COOLIX”,“Model”:-1,“Power”:“On”,“Mode”:“Heat”,“Celsius”:“On”,“Temp”:21,“FanSpeed”:“Min”,“SwingV”:“Off”,“SwingH”:“Off”,“Quiet”:“Off”,“Turbo”:“Off”,“Econo”:“Off”,“Light”:“Off”,“Filter”:“Off”,“Clean”:“Off”,“Beep”:“Off”,“Sleep”:-1}}

If you want to setup all the other functions you can edit to suit. I use VSCode with openhab extention which helps heaps for little mistakes I make.

If you want to make it so the remote will change your aircon and update openhab let me know. My remotes are for emergency’s only its all automated or voice controlled now.

1 Like

Thanks for this info, this example clarifies the approach and what I need to do perfectly (I was on the wrong track :slight_smile: ) - much appreciated.
I will play with this and report back with all Aircon options. I would be keen to keep the thread going and look to add the update openhab functionality you mention once I get this first bit operational so others can benefit.
Thanks again!

Ok ok ok you are never on the wrong track we can do things more than one way and it will work. It either works or its not yet working.

So we can setup a incoming message from tasmota. For this you will have to use your thing and have the stateTopic = tele/tasmota_8347F2/RESULT

Then create an ITEM liked to the above channel and we shall name it something unique like IR_Recieved

Now test it by using your remote and seeing if it comes up in the openhab logs.

Great Now that you can see the json string in openHAB we can move on to the next step of creating something to handle that message and make it update the other items.

Now looking at your json string we can and thinking into the future (other remotes) we want check that it is a Aircon Command

In the power section of JSON string it has the state “On” so we need to handle that also.

In Paper ui install transformations

  • JSONpath Transformation
  • MAP Transformation

Create a MAP file in your transform folder. Mine looks like

onoff.MAP

ON=ON
1=ON
On=ON
on=ON
OFF=OFF
0=OFF
Off=OFF
off=OFF
=Error

Rule to update the item as we don’t need to command the Aircon as the remote is doing just that.

rule "IR Recived message"
when
    Item IR_Recieved changed
then
    
    val protocal = transform("JSONPATH", "$.IrReceived.Protocol", IR_Recieved.state.toString)
    
	if (protocal == "COOLIX") {
		var Power  = transform("JSONPATH", "$.IrReceived.IRHVAC.Power", IR_Recieved.state.toString)
		var Mode   = transform("JSONPATH", "$.IrReceived.IRHVAC.Mode", IR_Recieved.state.toString)
		var Temp   = transform("JSONPATH", "$.IrReceived.IRHVAC.Temp", IR_Recieved.state.toString)

		Power      = transform("MAP", "onoff.map", Power)

		AirconditionerPower.postUpdate(Power)
		AirconditionerSetMode.postUpdate(Mode)
        AirconditionerMode.postUpdate(Mode)
		AirconditionerSetTemp.postUpdate(Temp)
    }
end

So when the string is changed check to make sure it is Protocal COOLIX if so then get all the data out of the string and put them in variables. Make sure Power is the correct format. Update all the Items to the correct state.

Thanks James,

I’m not quite up to the fancy bits yet, getting close to getting the IR send commands, just looks to be some difference in the correct formatting to take the Temp and FanSpeed variables when I use COOLIX Vendor etc, code is:

image

Logs show remote sends “Temp”:21 but my code sends “Temp”:0.0 etc as below:

Any ideas welcome :slight_smile:

I should add when I use Vendor GREE model 1 I looks sensible in the log but see unknown protocol message as below:

Thanks

Paul

I am unsure of the exact json string you need to do each command. Dose your aircon require On to turn on when you are sending it ON .

Can you post in text some valid json strings that work to do the function that you want to do.

Don’t panic I’ve figured it out, the values for temperature 0.0 and fan speed “UNKNOWN” just show in the logs when the Aircon is OFF, soon as I toggle to ON or switch the HEAT/COLD modes which also turns on AIRCON the correct temperature and fan speed are displayed. All working nicely thanks!
Will progress to the other more advanced bits you mention in a week or two once I sort out another more pressing project - next stage of building a whee house to put all this wiz-bang automation in :slight_smile: