Ok there are two key properties here to get smartir working over MQTT (with tasmota)
- device_code
- controller_data
device_code
I thought that just looking for codes in the github repo here and then setting the value for my device will make it work, but it didn't.
You will need first to upload the [code].json file to your home assistant installation at config/custom_components/smartir/codes/climate
for air conditioner or config/custom_components/smartir/codes/media_player
for tv.
That's sounds easy but the most complicated part is that major .json files available on the git repo are for broadlink hardware and don't work for tasmotized devices that communicates through MQTT so you have two options.
- Google a lot to try to find someone sharing .json file for the same device as yours.
- Get codes yourself using the original remote control.
To get codes yourself you need to access to your tasmotized device through it web interface and go to "Console". Then get your remote control and pointing to your IR device push a button.
You will see on console information regarding this button you pressed.
This information you will use to construct your own .json file like this (Samsung TV)
//SAMSUNG TV
{
"manufacturer": "Samsung",
"supportedModels": [
"UE55F8000",
"UExxF8000"
],
"supportedController": "MQTT",
"commandsEncoding": "Raw",
"commands": {
"off": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E019E6\",\"DataLSB\":\"0x070702FD\",\"Repeat\":0}",
"on": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E09966\",\"DataLSB\":\"0x070702FD\",\"Repeat\":0}",
"previousChannel": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E008F7\",\"DataLSB\":\"0x070710EF\",\"Repeat\":0}",
"nextChannel": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E048B7\",\"DataLSB\":\"0x070712ED\",\"Repeat\":0}",
"volumeDown": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0D02F\",\"DataLSB\":\"0x07070BF4\",\"Repeat\":0}",
"volumeUp": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0E01F\",\"DataLSB\":\"0x070707F8\",\"Repeat\":0}",
"mute": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0F00F\",\"DataLSB\":\"0x07070FF0\",\"Repeat\":0}",
"sources": {
"DTV": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0C23D\",\"DataLSB\":\"0x070743BC\",\"Repeat\":0}",
"Antenna": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0D827\",\"DataLSB\":\"0x07071BE4\",\"Repeat\":0}",
"HDMI": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0D12E\",\"DataLSB\":\"0x07078B74\",\"Repeat\":0}",
"HDMI 1": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E09768\",\"DataLSB\":\"0x0707E916\",\"Repeat\":0}",
"HDMI 2": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E07D82\",\"DataLSB\":\"0x0707BE41\",\"Repeat\":0}",
"HDMI 3": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E043BC\",\"DataLSB\":\"0x0707C23D\",\"Repeat\":0}",
"HDMI 4": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0A35C\",\"DataLSB\":\"0x0707C53A\",\"Repeat\":0}",
"3D": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E08679\",\"DataLSB\":\"0x0707619E\",\"Repeat\":0}",
"Channel 0": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E08877\",\"DataLSB\":\"0x070711EE\",\"Repeat\":0}",
"Channel 1": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E020DF\",\"DataLSB\":\"0x070704FB\",\"Repeat\":0}",
"Channel 2": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0A05F\",\"DataLSB\":\"0x070705FA\",\"Repeat\":0}",
"Channel 3": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0609F\",\"DataLSB\":\"0x070706F9\",\"Repeat\":0}",
"Channel 4": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E010EF\",\"DataLSB\":\"0x070708F7\",\"Repeat\":0}",
"Channel 5": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0906F\",\"DataLSB\":\"0x070709F6\",\"Repeat\":0}",
"Channel 6": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E050AF\",\"DataLSB\":\"0x07070AF5\",\"Repeat\":0}",
"Channel 7": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E030CF\",\"DataLSB\":\"0x07070CF3\",\"Repeat\":0}",
"Channel 8": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0B04F\",\"DataLSB\":\"0x07070DF2\",\"Repeat\":0}",
"Channel 9": "{\"Protocol\":\"SAMSUNG\",\"Bits\":32,\"Data\":\"0xE0E0708F\",\"DataLSB\":\"0x07070EF1\",\"Repeat\":0}"
}
}
}
Here another example but for climate
//GREE
{
"manufacturer":"Gree",
"supportedModels":[
"GREE"
],
"supportedController":"MQTT",
"commandsEncoding":"Raw",
"minTemperature":16.0,
"maxTemperature":30.0,
"precision":1.0,
"operationModes":[
"heat_cool",
"fan_only",
"dry",
"cool",
"heat"
],
"fanModes":[
"low",
"mid",
"high",
"auto"
],
"commands":{
"off":"{\"Vendor\":\"GREE\", \"Power\":\"Off\"}",
"heat_cool":{
"low":{
//The following row must be replicated incrementing value 16 at property name end and also at Temp propertie inside. This will make your conditioner set those temps. Removed for code brevity
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Auto\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Min\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"mid":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Auto\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Medium\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"high":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Auto\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Max\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"auto":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Auto\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Auto\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
}
},
"fan_only":{
"low":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"fan_only\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Min\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"mid":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"fan_only\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Medium\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"high":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"fan_only\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Max\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"auto":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"fan_only\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Auto\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
}
},
"dry":{
"low":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Dry\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Min\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"mid":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Dry\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Medium\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"high":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Dry\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Max\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"auto":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Dry\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Dry\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
}
},
"cool":{
"low":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Cool\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Min\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"mid":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Cool\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Medium\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"high":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Cool\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Max\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"auto":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Cool\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Cool\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
}
},
"heat":{
"low":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Heat\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Min\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"mid":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Heat\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Medium\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"high":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Heat\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Max\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
},
"auto":{
"16":"{\"Vendor\":\"GREE\",\"Model\":1,\"Mode\":\"Heat\",\"Power\":\"On\",\"Celsius\":\"On\",\"Temp\":16,\"FanSpeed\":\"Heat\",\"SwingV\":\"Highest\",\"SwingH\":\"Off\",\"Quiet\":\"Off\",\"Turbo\":\"Off\",\"Econo\":\"Off\",\"Light\":\"On\",\"Filter\":\"Off\",\"Clean\":\"Off\",\"Beep\":\"Off\",\"Sleep\":-1}",
}
}
}
}
In any case you finally will have your xxxx.json file uploaded on any of those folders and device_code property configured with same number.
controller_data
Here you just need to specify the MQTT topic between some other parameters.
MQTT topic is present on your tasmotized device configuration
cmnd/<your_mqtt_topic_here>/IRhvac
for air conditioner
cmnd/<your_mqtt_topic_here>/IRsend
for tv
Example of configuration.yaml configuration
smartir:
check_updates: false
media_player:
- platform: smartir
name: Bedroom TV
unique_id: bedroom_tv
device_code: 1070
controller_data: cmnd/tasmota_smart_ir_bedroom/IRsend
#power_sensor: media_player.chromecast_cuarto
climate:
- platform: smartir
name: Bedroom AC
unique_id: bedroom_ac
device_code: 1180
controller_data: cmnd/tasmota_smart_ir_bedroom/IRhvac
temperature_sensor: sensor.temp_hum_cuarto_temperature
humidity_sensor: sensor.temp_hum_cuarto_humidity
Feel free to let me know if something isn't clear!