- 积分
- 290
- 金钱
- 269
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
中级会员
- 积分
- 290
- 金钱
- 269
- HASS币
- 0
|
把以下代码添加到configuration.yaml后,重启失败,显示:The system cannot restart because the configuration is not valid: Error loading /config/configuration.yaml: 'utf-8' codec can't decode byte 0xce in position 890: invalid continuation byte
mqtt:
sensor:
- name: 'zm1_b0f8932769f0_temperature'
# friendly_name: 温度
state_topic: 'device/zm1/b0f8932769f0/sensor'
unit_of_measurement: '°C'
icon: 'mdi:thermometer'
value_template: '{{ value_json.temperature }}'
- name: 'zm1_b0f8932769f0_humidity'
# friendly_name: 湿度
state_topic: 'device/zm1/b0f8932769f0/sensor'
unit_of_measurement: '%'
icon: mdi:water-percent
value_template: '{{ value_json.humidity }}'
- name: 'zm1_b0f8932769f0_pm25'
# friendly_name: PM25
state_topic: 'device/zm1/b0f8932769f0/sensor'
unit_of_measurement: 'μg/m3'
icon: mdi:blur
value_template: '{{ value_json.PM25 }}'
- name: 'zm1_b0f8932769f0_hcho'
# friendly_name: 甲醛
state_topic: 'device/zm1/b0f8932769f0/sensor'
unit_of_measurement: 'mg/m3'
icon: mdi:chemical-weapon
value_template: '{{ value_json.formaldehyde }}'
light:
- name: zm1_b0f8932769f0_brightness
schema: template
command_topic: "device/zm1/b0f8932769f0/set"
state_topic: "device/zm1/b0f8932769f0/state"
command_on_template: >
{"mac": "b0f8932769f0"
{%- if brightness is defined -%}
, "brightness": {{ ((brightness-1) / 64 )|int +1 }}
{%- else -%}
, "brightness": 4
{%- endif -%}
}
command_off_template: '{"mac": "b0f8932769f0", "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 -%}
homeassistant:
customize:
light.zm1_b0f8932769f0_brightness:
friendly_name: 卧室M1亮度
sensor.zm1_b0f8932769f0_temperature:
friendly_name: 卧室温度
sensor.zm1_b0f8932769f0_humidity:
friendly_name: 卧室湿度
sensor.zm1_b0f8932769f0_pm25:
friendly_name: 卧室PM2.5
sensor.zm1_b0f8932769f0_hcho:
friendly_name: 卧室甲醛
|
|