- 积分
- 174
- 金钱
- 128
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
注册会员
- 积分
- 174
- 金钱
- 128
- HASS币
- 0
|
发表于 2023-2-13 20:58:13
|
显示全部楼层
本帖最后由 kang.mk 于 2023-2-13 21:08 编辑
就是斐讯的原生固件是吧?
我HASS和MQTT部署在同一个虚拟机上,然后HASS和正确添加了MQTT,并连接成功
aircat.phicomm.com域名也已经劫持到MQTT和HASS的服务器上
配置文件configuration.yaml里面添加
mqtt:
sensor:
- name: 'zm1_b0f893116826_temperature'
# friendly_name: 温度
state_topic: 'device/zm1/b0f893116826/sensor'
unit_of_measurement: '°C'
icon: 'mdi:thermometer'
value_template: '{{ value_json.temperature }}'
unique_id: "温度"
- name: 'zm1_b0f893116826_humidity'
# friendly_name: 湿度
state_topic: 'device/zm1/b0f893116826/sensor'
unit_of_measurement: '%'
icon: mdi:water-percent
value_template: '{{ value_json.humidity }}'
unique_id: "湿度"
- name: 'zm1_b0f893116826_pm25'
# friendly_name: PM25
state_topic: 'device/zm1/b0f893116826/sensor'
unit_of_measurement: 'μg/m³'
icon: mdi:blur
value_template: '{{ value_json.PM25 }}'
unique_id: "PM2.5"
- name: 'zm1_b0f893116826_hcho'
# friendly_name: 甲醛
state_topic: 'device/zm1/b0f893116826/sensor'
unit_of_measurement: 'mg/m³'
icon: mdi:chemical-weapon
unique_id: "甲醛"
value_template: '{{ value_json.formaldehyde }}'
light:
- name: zm1_b0f893116826_brightness
unique_id: "亮度"
schema: template
command_topic: "device/zm1/b0f893116826/set"
state_topic: "device/zm1/b0f893116826/state"
command_on_template: >
{"mac": "b0f893116826"
{%- if brightness is defined -%}
, "brightness": {{ ((brightness-1) / 64 )|int +1 }}
{%- else -%}
, "brightness": 4
{%- endif -%}
}
command_off_template: '{"mac": "b0f893116826", "brightness": 0}'
state_template: >
{%- if value_json.brightness == 0 -%}
off
{%- else -%}
on
{%- endif -%}
brightness_template: >
{%- if value_json.brightness is defined -%}
{{ ( value_json.brightness *64 )|int }}
{%- endif -%}
unique_id: "亮度" unique_id: "甲醛值"
MQTT下有传感器了 但是没有数值,应该是MQTT和斐讯M1没有连接上,这个应该怎么连接? 怎么让MQTT读取到斐讯的数据?M1的固件是斐讯原生的,已经连接WiFi,是不是必须要刷 https://github.com/a2633063/zM1 的固件才行?
|
|