好的,这里有两个关键属性可以让 smartir 在 MQTT 上工作(使用 tasmota)
设备代码
我认为只需在此处的 github 存储库中查找代码,然后为我的设备设置值即可使其工作,但事实并非如此。
您首先需要将 [code].json 文件上传到您的家庭助理安装位置,config/custom_components/smartir/codes/climate
用于空调或config/custom_components/smartir/codes/media_player
电视。
这听起来很简单,但最复杂的部分是 git repo 上可用的主要 .json 文件适用于 Broadlink 硬件,不适用于通过 MQTT 进行通信的 tasmotized 设备,因此您有两种选择。
- 谷歌很多,试图找到与你的设备共享 .json 文件的人。
- 使用原装遥控器自行获取代码。
要自己获取代码,您需要通过网络界面访问您的 tasmotized 设备并转到“控制台”。然后拿到遥控器并指向您的 IR 设备按一个按钮。您将在控制台上看到有关您按下的此按钮的信息。
您将使用此信息构建自己的 .json 文件,如下所示(三星电视)
//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}"
}
}
}
在任何情况下,您最终都会将 xxxx.json 文件上传到这些文件夹中的任何一个,并且 device_code 属性配置为相同的编号。
控制器数据
这里你只需要在其他一些参数之间指定 MQTT 主题。MQTT 主题存在于您的 tasmotized 设备配置中
cmnd/<your_mqtt_topic_here>/IRhvac
空调用
cmnd/<your_mqtt_topic_here>/IRsend
电视用
configuration.yaml 配置示例
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
如果有不清楚的地方,请随时告诉我!