sensor:
- platform: template
sensors:
dc1_1_v:
friendly_name: 当前电压
value_template: "{{ states.switch.dc1_1.attributes.v }}"
unit_of_measurement: V
dc1_1_p:
friendly_name: 当前功率
value_template: "{{ states.switch.dc1_1.attributes.p }}"
unit_of_measurement: W
Logger: homeassistant.helpers.template
Source: helpers/template.py:1828
First occurred: 11:26:27 (12 occurrences)
Last logged: 11:26:27
Template variable warning: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'p' when rendering '{{ states.switch.dc1_1.attributes.p }}'
Template variable warning: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'v' when rendering '{{ states.switch.dc1_1.attributes.v }}'
bainiu 发表于 2022-4-13 00:15
我的dc1没有问题,硬刷的情留蚊子大佬的固件。你看看mqtt里,订阅的信息是否有。 ...
lwn 发表于 2022-4-19 18:26
需要把 switch.py里的 device_state_attributes 改成 extra_state_attributes
见:
欢迎光临 『瀚思彼岸』» 智能家居技术论坛 (https://bbs.hassbian.com/) | Powered by Discuz! X3.5 |