阶梯电价配置出错
Closed this issue · 1 comments
xiaoyuesansui commented
按照文档,yearly usage 部分我做了如下修改
- trigger:
- platform: event
event_type: state_changed
event_data:
entity_id: sensor.yearly_electricity_usage
sensor: - name: yearly_electricity_usage_entity
unique_id: yearly_electricity_usage_entity
state: "{{ states('sensor.yearly_electricity_usage') }}"
state_class: total_increasing
unit_of_measurement: "kWh"
device_class: energy
当前阶梯
- platform: event
sensors:
current_ladder:
unique_id: "current_ladder"
friendly_name: '当前阶梯'
unit_of_measurement: "级"
icon_template: mdi:elevation-rise
value_template: > #这里是上海的三个阶梯数值,第2阶梯3120,第三阶梯4800
{% if states("sensor.yearly_electricity_usage_entity") | float <= 2160 %}
1
{% elif states("sensor.yearly_electricity_usage_entity") | float >2160 and states("sensor.yearly_electricity_usage_entity") | float <= 4800 %}
2
{% else %}
3
{% endif %}
- platform: event
但是重启HA时报错
The system cannot restart because the configuration is not valid: Error loading /config/configuration.yaml: while scanning for the next token found character '%' that cannot start any token in "/config/configuration.yaml", line 102, column 10
请教这部分该如何修改
caibinqing commented
看 /config/configuration.yaml
这个文件的第 102 行, 应该是 %
需要加双引号