|
发表于 2024-3-29 20:52:47
|
显示全部楼层
新版早改了。mqtt:
#斐讯zM1
sensor:
- name: 'zm1_b0f893885a86_temperature'
unique_id: zm1_b0f893885a86_temperature
# friendly_name: 温度
state_topic: 'device/zm1/b0f893225a86/sensor'
unit_of_measurement: '°C'
icon: 'mdi:thermometer'
value_template: '{{ value_json.temperature }}'
# availability_topic: "device/zm1/b0f893885a86/availability"
# payload_available: 1
# payload_not_available: 0
- name: 'zm1_b0f893885a86_humidity'
unique_id: zm1_b0f893885a86_humidity
# friendly_name: 湿度
state_topic: 'device/zm1/b0f893885a86/sensor'
unit_of_measurement: '%'
icon: mdi:water-percent
value_template: '{{ value_json.humidity }}'
# availability_topic: "device/zm1/b0f893885a86/availability"
# payload_available: 1
# payload_not_available: 0
- name: 'zm1_b0f893225a86_pm25'
unique_id: zm1_b0f893885a86_pm25
# availability_topic: "device/zm1/b0f893885a86/availability"
# payload_available: 1
# payload_not_available: 0
# friendly_name: PM25
state_topic: 'device/zm1/b0f893885a86/sensor'
unit_of_measurement: 'μg/m³'
icon: mdi:blur
value_template: '{{ value_json.PM25 }}'
- name: 'zm1_b0f893885a86_hcho'
unique_id: zm1_b0f893885a86_hcho
# friendly_name: 甲醛
state_topic: 'device/zm1/b0f893885a86/sensor'
unit_of_measurement: 'mg/m³'
icon: mdi:chemical-weapon
value_template: '{{ value_json.formaldehyde }}'
# availability_topic: "device/zm1/b0f893225a86/availability"
# payload_available: 1
# payload_not_available: 0
light:
name: zm1_b0f893885a86_brightness
unique_id: zm1_b0f893885a86_brightness
schema: template
command_topic: "device/zm1/b0f893885a86/set"
state_topic: "device/zm1/b0f893885a86/state"
command_on_template: >
{"mac": "b0f893885a86"
{%- if brightness is defined -%}
, "brightness": {{ ((brightness-1) / 64 )|int +1 }}
{%- else -%}
, "brightness": 4
{%- endif -%}
}
command_off_template: '{"mac": "b0f893885a86", "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 -%}
|
|