Skip to content

Commit

Permalink
upda mqtt
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonsm committed Dec 5, 2023
1 parent 8334608 commit b418b50
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 80 deletions.
2 changes: 1 addition & 1 deletion custom_components/zhiaqara/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async def async_setup(hass, config):
return True

interface = conf.get(CONF_INTERFACE, 'any')
xiaomi = XiaomiGatewayDiscovery(hass.add_job, [], interface)
xiaomi = XiaomiGatewayDiscovery(interface)
await hass.async_add_executor_job(xiaomi.discover_gateways)
if len(xiaomi.gateways) == 0:
return False
Expand Down
158 changes: 79 additions & 79 deletions mqtt.yaml
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
# binary_sensor:
# - device_class: motion
# state_topic: NodeMCU5/digital
# state_topic: JingHuaQi3/digital
# payload_on: 1
# payload_off: 0
# name: 主卧感应
# availability_topic: NodeMCU5/status
# availability_topic: JingHuaQi3/status

sensor:
- name: 阳台温度
device_class: temperature
state_topic: NodeMCU1/temperature
state_topic: ChuanGanQi/temperature
unit_of_measurement: °C
availability_topic: NodeMCU1/status
availability_topic: ChuanGanQi/status
- name: 阳台湿度
device_class: humidity
state_topic: NodeMCU1/humidity
state_topic: ChuanGanQi/humidity
unit_of_measurement: '%'
availability_topic: NodeMCU1/status
availability_topic: ChuanGanQi/status
- name: 阳台空气质量
device_class: pm25
state_topic: NodeMCU1/pm2dot5
state_topic: ChuanGanQi/pm2dot5
unit_of_measurement: µg/m³
availability_topic: NodeMCU1/status
availability_topic: ChuanGanQi/status
- name: 书房温度
device_class: temperature
state_topic: NodeMCU2/temperature
state_topic: YinXiang/temperature
unit_of_measurement: °C
availability_topic: NodeMCU2/status
availability_topic: YinXiang/status
- name: 书房湿度
device_class: humidity
state_topic: NodeMCU2/humidity
state_topic: YinXiang/humidity
unit_of_measurement: '%'
availability_topic: NodeMCU2/status
availability_topic: YinXiang/status
- name: 书房二氧化碳
device_class: carbon_dioxide
state_topic: NodeMCU2/co2
state_topic: YinXiang/co2
unit_of_measurement: ppm
availability_topic: NodeMCU2/status
availability_topic: YinXiang/status
- name: 书房亮度
device_class: illuminance
state_topic: NodeMCU2/lux
state_topic: YinXiang/lux
unit_of_measurement: lx
availability_topic: NodeMCU2/status
availability_topic: YinXiang/status
- name: 餐厅亮度
device_class: illuminance
state_topic: NodeMCU5/analog
availability_topic: NodeMCU5/status
state_topic: JingHuaQi3/analog
availability_topic: JingHuaQi3/status
unit_of_measurement: lx
- name: 儿童房温度
device_class: temperature
state_topic: NodeMCU6/temperature
state_topic: JingHuaQi4/temperature
unit_of_measurement: °C
availability_topic: NodeMCU6/status
availability_topic: JingHuaQi4/status
- name: 儿童房湿度
device_class: humidity
state_topic: NodeMCU6/humidity
state_topic: JingHuaQi4/humidity
unit_of_measurement: '%'
availability_topic: NodeMCU6/status
availability_topic: JingHuaQi4/status
- name: 儿童房空气质量
device_class: pm25
state_topic: NodeMCU6/pm2dot5
state_topic: JingHuaQi4/pm2dot5
unit_of_measurement: µg/m³
availability_topic: NodeMCU6/status
availability_topic: JingHuaQi4/status
- name: 儿童房二氧化碳
device_class: carbon_dioxide
state_topic: NodeMCU6/co2
state_topic: JingHuaQi4/co2
unit_of_measurement: ppm
availability_topic: NodeMCU6/status
availability_topic: JingHuaQi4/status

- name: 餐厅温度
device_class: temperature
Expand Down Expand Up @@ -111,69 +111,69 @@ sensor:

switch:
- name: 餐厅筒灯
state_topic: Sonoff1/relay/1
command_topic: Sonoff1/relay/1/set
availability_topic: Sonoff1/status
state_topic: KeTingTongDeng/relay/1
command_topic: KeTingTongDeng/relay/1/set
availability_topic: KeTingTongDeng/status
- name: 客厅筒灯
state_topic: Sonoff1/relay/2
command_topic: Sonoff1/relay/2/set
availability_topic: Sonoff1/status
state_topic: KeTingTongDeng/relay/2
command_topic: KeTingTongDeng/relay/2/set
availability_topic: KeTingTongDeng/status
- name: 洗手间排气扇
state_topic: Hassmart2/relay/1
command_topic: Hassmart2/relay/1/set
availability_topic: Hassmart2/status
state_topic: XiShouJianDeng/relay/1
command_topic: XiShouJianDeng/relay/1/set
availability_topic: XiShouJianDeng/status
icon: mdi:fan
- name: 书房音箱
state_topic: NodeMCU2/relay/0
command_topic: NodeMCU2/relay/0/set
availability_topic: NodeMCU2/status
state_topic: YinXiang/relay/0
command_topic: YinXiang/relay/0/set
availability_topic: YinXiang/status
value_template: '{% if value == "关闭" %}OFF{% else %}ON{% endif %}'
icon_template: '{% if value == "关闭" %}mdi:speaker-off{% elif value == "蓝牙" %}mdi:speaker-bluetooth{% elif value == "光纤" %}mdi:speaker-wireless{% elif value == "优盘" %}mdi:usb{% elif value == "辅助" %}mdi:video-input-component{% else %}mdi:speaker{% endif %}'

light:
- name: 客厅筒灯
icon: mdi:track-light
state_topic: Hassmart1/relay/0
command_topic: Hassmart1/relay/0/set
availability_topic: Hassmart1/status
state_topic: CanTingTongDeng/relay/0
command_topic: CanTingTongDeng/relay/0/set
availability_topic: CanTingTongDeng/status
- name: 餐厅筒灯
icon: mdi:track-light
state_topic: Hassmart1/relay/1
command_topic: Hassmart1/relay/1/set
availability_topic: Hassmart1/status
state_topic: CanTingTongDeng/relay/1
command_topic: CanTingTongDeng/relay/1/set
availability_topic: CanTingTongDeng/status
- name: 洗手间灯
icon: mdi:ceiling-light
state_topic: Hassmart2/relay/0
command_topic: Hassmart2/relay/0/set
availability_topic: Hassmart2/status
state_topic: XiShouJianDeng/relay/0
command_topic: XiShouJianDeng/relay/0/set
availability_topic: XiShouJianDeng/status
# - name: 浴室灯
# icon: mdi:ceiling-light
# state_topic: Hassmart3/relay/1
# command_topic: Hassmart3/relay/1/set
# availability_topic: Hassmart3/status
- name: 过道柜灯
icon: mdi:car-light-dimmed
state_topic: Sonoff1/relay/0
command_topic: Sonoff1/relay/0/set
availability_topic: Sonoff1/status
state_topic: KeTingTongDeng/relay/0
command_topic: KeTingTongDeng/relay/0/set
availability_topic: KeTingTongDeng/status
- name: 过道筒灯
icon: mdi:track-light
state_topic: Sonoff2/relay/0
command_topic: Sonoff2/relay/0/set
availability_topic: Sonoff2/status
state_topic: GuoDaoTongDeng/relay/0
command_topic: GuoDaoTongDeng/relay/0/set
availability_topic: GuoDaoTongDeng/status
# - name: 主卧吸顶灯
# state_topic: NodeMCU5/analog
# state_topic: JingHuaQi3/analog
# state_value_template: '{% if (value | int > 1000) or ((value | int > 600) and is_state("sun.sun", "below_horizon")) %}3526,1658,426,418,426,1292,426,420,426,1288,428,418,426,1290,430,418,426,1290,428,418,426,418,426,416,426,1290,428,416,430,1290,428,1290,428,418,428,1288,428,416,428,418,426,418,428,1288,428,1288,428,1290,428,418,428,1290,428,418,428,1290,428,416,428,1290,428,1290,428,416,428,418,426,418,428,416,428,418,426,416,428,418,426,416,428,416,428,418,426,1292,426,418,428,1290,428,416,428,1292,424,1292,424,1294,424,418,426,1290,426,420,424,418,426,420,424,422,424,1294,424,420,424,420,424,1294,424,420,424,422,422,422,422,1298,422,422,422,1296,422,422,422,1,2,38{% else %}3528,1658,426,418,426,1292,380,462,382,1334,382,464,382,1338,380,462,382,1336,382,462,382,462,382,462,382,1336,382,462,382,1336,380,1336,382,464,382,1338,378,462,384,462,382,464,380,1336,382,1336,382,1336,382,462,382,1334,384,464,382,1336,382,462,382,1336,382,1336,382,464,382,462,382,464,382,464,380,462,382,462,382,464,382,464,380,464,382,464,382,464,380,1338,380,462,382,464,382,462,380,464,380,464,380,464,380,1334,382,464,380,464,380,464,380,464,382,1336,382,464,382,462,382,1334,382,464,382,464,382,464,380,1336,382,1336,382,464,382,1338,380,1,2,38{% endif %}'
# command_topic: NodeMCU5/irout/set
# availability_topic: NodeMCU5/status
# command_topic: JingHuaQi3/irout/set
# availability_topic: JingHuaQi3/status
# payload_on: 3526,1658,426,418,426,1292,426,420,426,1288,428,418,426,1290,430,418,426,1290,428,418,426,418,426,416,426,1290,428,416,430,1290,428,1290,428,418,428,1288,428,416,428,418,426,418,428,1288,428,1288,428,1290,428,418,428,1290,428,418,428,1290,428,416,428,1290,428,1290,428,416,428,418,426,418,428,416,428,418,426,416,428,418,426,416,428,416,428,418,426,1292,426,418,428,1290,428,416,428,1292,424,1292,424,1294,424,418,426,1290,426,420,424,418,426,420,424,422,424,1294,424,420,424,420,424,1294,424,420,424,422,422,422,422,1298,422,422,422,1296,422,422,422,1,2,38
# payload_off: 3528,1658,426,418,426,1292,380,462,382,1334,382,464,382,1338,380,462,382,1336,382,462,382,462,382,462,382,1336,382,462,382,1336,380,1336,382,464,382,1338,378,462,384,462,382,464,380,1336,382,1336,382,1336,382,462,382,1334,384,464,382,1336,382,462,382,1336,382,1336,382,464,382,462,382,464,382,464,380,462,382,462,382,464,382,464,380,464,382,464,382,464,380,1338,380,462,382,464,382,462,380,464,380,464,380,464,380,1334,382,464,380,464,380,464,380,464,382,1336,382,464,382,462,382,1334,382,464,382,464,382,464,380,1336,382,1336,382,464,382,1338,380,1,2,38
# brightness_state_topic: NodeMCU5/analog
# brightness_command_topic: NodeMCU5_/analog/set
# brightness_state_topic: JingHuaQi3/analog
# brightness_command_topic: JingHuaQi3_/analog/set
# brightness_scale: 1024
# - name: 儿童房吸顶灯
# command_topic: NodeMCU6/irout/set
# availability_topic: NodeMCU6/status
# command_topic: JingHuaQi4/irout/set
# availability_topic: JingHuaQi4/status
# payload_on: 3526,1658,426,418,426,1292,426,420,426,1288,428,418,426,1290,430,418,426,1290,428,418,426,418,426,416,426,1290,428,416,430,1290,428,1290,428,418,428,1288,428,416,428,418,426,418,428,1288,428,1288,428,1290,428,418,428,1290,428,418,428,1290,428,416,428,1290,428,1290,428,416,428,418,426,418,428,416,428,418,426,416,428,418,426,416,428,416,428,418,426,1292,426,418,428,1290,428,416,428,1292,424,1292,424,1294,424,418,426,1290,426,420,424,418,426,420,424,422,424,1294,424,420,424,420,424,1294,424,420,424,422,422,422,422,1298,422,422,422,1296,422,422,422,1,2,38
# payload_off: 3528,1658,426,418,426,1292,380,462,382,1334,382,464,382,1338,380,462,382,1336,382,462,382,462,382,462,382,1336,382,462,382,1336,380,1336,382,464,382,1338,378,462,384,462,382,464,380,1336,382,1336,382,1336,382,462,382,1334,384,464,382,1336,382,462,382,1336,382,1336,382,464,382,462,382,464,382,464,380,462,382,462,382,464,382,464,380,464,382,464,382,464,380,1338,380,462,382,464,382,462,380,464,380,464,380,464,380,1334,382,464,380,464,380,464,380,464,382,1336,382,464,382,462,382,1334,382,464,382,464,382,464,380,1336,382,1336,382,464,382,1338,380,1,2,38
# - name: 餐厅检测仪
Expand Down Expand Up @@ -232,13 +232,13 @@ fan:
# payload_oscillation_off: 'OFF'
- name: 餐厅净化器
icon: mdi:cupcake
state_topic: NodeMCU5/relay/0
command_topic: NodeMCU5/relay/0/set
availability_topic: NodeMCU5/status
oscillation_state_topic: NodeMCU5/relay/1
oscillation_command_topic: NodeMCU5/relay/1/set
preset_mode_state_topic: NodeMCU5/relay/0
preset_mode_command_topic: NodeMCU5/relay/0/set
state_topic: JingHuaQi3/relay/0
command_topic: JingHuaQi3/relay/0/set
availability_topic: JingHuaQi3/status
oscillation_state_topic: JingHuaQi3/relay/1
oscillation_command_topic: JingHuaQi3/relay/1/set
preset_mode_state_topic: JingHuaQi3/relay/0
preset_mode_command_topic: JingHuaQi3/relay/0/set
state_value_template: '{% if value == "0" %}OFF{% else %}ON{% endif %}'
preset_modes: [关闭, 自动, 梅雨, 花粉, 静音, 中档, 高档]
preset_mode_command_template: '{% if value == "自动" %}1{% elif value == "梅雨" %}2{% elif value == "花粉" %}3{% elif value == "静音" %}4{% elif value == "中档" %}5{% elif value == "高档" %}6{% else %}0{% endif %}'
Expand All @@ -247,29 +247,29 @@ fan:
payload_oscillation_off: 'OFF'
- name: 儿童房净化器
icon: mdi:cupcake
state_topic: NodeMCU6/relay/0
command_topic: NodeMCU6/relay/0/set
availability_topic: NodeMCU6/status
oscillation_state_topic: NodeMCU6/relay/1
oscillation_command_topic: NodeMCU6/relay/1/set
preset_mode_state_topic: NodeMCU6/relay/0
preset_mode_command_topic: NodeMCU6/relay/0/set
state_topic: JingHuaQi4/relay/0
command_topic: JingHuaQi4/relay/0/set
availability_topic: JingHuaQi4/status
oscillation_state_topic: JingHuaQi4/relay/1
oscillation_command_topic: JingHuaQi4/relay/1/set
preset_mode_state_topic: JingHuaQi4/relay/0
preset_mode_command_topic: JingHuaQi4/relay/0/set
state_value_template: '{% if value == "0" %}OFF{% else %}ON{% endif %}'
preset_modes: [关闭, 自动, 梅雨, 花粉, 静音, 中档, 高档]
preset_mode_command_template: '{% if value == "自动" %}1{% elif value == "梅雨" %}2{% elif value == "花粉" %}3{% elif value == "静音" %}4{% elif value == "中档" %}5{% elif value == "高档" %}6{% else %}0{% endif %}'
preset_mode_value_template: '{% if value == "1" %}自动{% elif value == "2" %}梅雨{% elif value == "3" %}花粉{% elif value == "4" %}静音{% elif value == "5" %}中档{% elif value == "6" %}高档{% else %}关闭{% endif %}'
payload_oscillation_on: 'ON'
payload_oscillation_off: 'OFF'
# - name: 主卧壁扇
# availability_topic: NodeMCU5/status
# command_topic: NodeMCU5/irout/set
# availability_topic: JingHuaQi3/status
# command_topic: JingHuaQi3/irout/set
# payload_on: 9150,4770,380,812,438,782,410,754,436,756,412,778,812,380,812,408,782,384,410,806,810,358,408,808,782,410,782,410,784,408,784,408,782,382,382,814,410,806,384,780,386,806,410,762,432,808,806,386,402,762,808,382,810,384,808,382,808,382,812,380,810,410,382,808,784,382,1208,8334,9130,4796,356,814,408,782,408,782,410,782,408,782,810,382,808,384,808,382,410,782,808,382,412,780,810,382,810,384,832,358,808,382,810,382,384,810,412,780,412,778,412,780,412,780,412,780,810,384,408,782,810,382,810,382,810,382,808,382,834,358,810,382,410,780,810,382,1210,8338,9126,4796,382,812,382,808,382,784,408,808,382,786,806,410,782,410,780,412,382,808,782,410,358,832,758,434,758,434,780,412,758,434,758,434,378,788,386,808,384,830,360,830,360,804,388,832,760,432,360,830,762,430,762,432,760,432,760,430,762,430,762,428,388,804,784,408,1186,1,2,38
# payload_off: 9150,4770,380,812,438,782,410,754,436,756,412,778,812,380,812,408,782,384,410,806,810,358,408,808,782,410,782,410,784,408,784,408,782,382,382,814,410,806,384,780,386,806,410,762,432,808,806,386,402,762,808,382,810,384,808,382,808,382,812,380,810,410,382,808,784,382,1208,8334,9130,4796,356,814,408,782,408,782,410,782,408,782,810,382,808,384,808,382,410,782,808,382,412,780,810,382,810,384,832,358,808,382,810,382,384,810,412,780,412,778,412,780,412,780,412,780,810,384,408,782,810,382,810,382,810,382,808,382,834,358,810,382,410,780,810,382,1210,8338,9126,4796,382,812,382,808,382,784,408,808,382,786,806,410,782,410,780,412,382,808,782,410,358,832,758,434,758,434,780,412,758,434,758,434,378,788,386,808,384,830,360,830,360,804,388,832,760,432,360,830,762,430,762,432,760,432,760,430,762,430,762,428,388,804,784,408,1186,1,2,38
# oscillation_state_topic: NodeMCU5/status
# oscillation_command_topic: NodeMCU5/irout/set
# oscillation_state_topic: JingHuaQi3/status
# oscillation_command_topic: JingHuaQi3/irout/set
# payload_oscillation_on: 9152,4774,428,764,386,832,360,808,384,806,386,830,760,432,758,434,758,434,358,808,784,432,362,830,760,432,760,432,758,434,758,432,760,432,380,790,384,830,360,832,362,830,760,432,360,832,360,830,364,828,762,430,762,428,762,432,760,432,362,802,788,432,762,430,762,430,1162,8334,9158,4766,432,786,388,778,390,826,364,804,388,828,762,430,760,430,762,430,364,828,764,428,364,804,786,430,760,432,760,432,762,430,760,432,380,814,386,806,364,828,362,830,762,432,360,830,362,830,362,830,760,432,760,432,758,434,760,432,360,806,784,434,758,434,758,434,1156,8336,9178,4748,406,790,404,810,382,810,382,786,406,808,782,410,780,412,780,412,380,786,804,412,382,784,806,412,780,412,780,412,780,412,780,410,380,814,382,784,408,810,382,808,782,410,382,784,408,808,384,784,806,412,780,410,780,412,782,410,380,810,780,412,782,410,780,410,1180,1,2,38
# payload_oscillation_off: 9152,4774,428,764,386,832,360,808,384,806,386,830,760,432,758,434,758,434,358,808,784,432,362,830,760,432,760,432,758,434,758,432,760,432,380,790,384,830,360,832,362,830,760,432,360,832,360,830,364,828,762,430,762,428,762,432,760,432,362,802,788,432,762,430,762,430,1162,8334,9158,4766,432,786,388,778,390,826,364,804,388,828,762,430,760,430,762,430,364,828,764,428,364,804,786,430,760,432,760,432,762,430,760,432,380,814,386,806,364,828,362,830,762,432,360,830,362,830,362,830,760,432,760,432,758,434,760,432,360,806,784,434,758,434,758,434,1156,8336,9178,4748,406,790,404,810,382,810,382,786,406,808,782,410,780,412,780,412,380,786,804,412,382,784,806,412,780,412,780,412,780,412,780,410,380,814,382,784,408,810,382,808,782,410,382,784,408,808,384,784,806,412,780,410,780,412,782,410,380,810,780,412,782,410,780,410,1180,1,2,38
# preset_mode_command_topic: NodeMCU5/irout/set
# preset_mode_command_topic: JingHuaQi3/irout/set
# preset_modes:
# - 'off'
# - low
Expand Down

0 comments on commit b418b50

Please sign in to comment.