本帖最后由 ms2 于 2020-10-20 16:26 编辑
官方的是没有的电量显示的,而且官方接入反应慢,要走服务器再反馈状态,有时候时间很长,我直接把官方的接入关了,全部用第三方插件接入了,电量插座必须用第三方插件,我有这个插座,看我这个帖子:https://bbs.hassbian.com/thread-10040-1-1.html,另外全橙的跟官方的端口不一样,要改一下,把4,5,6改成18,19,20,代码如下:
- platform: localtuya
host: 192.168.1.111
local_key: VVVVVVVVVV
device_id: XXXXXXXXXXXXXXX
protocol: 3.3
current: 18
current_consumption: 19
voltage: 20
switches:
switch1:
friendly_name: quancheng_SW01
id: 1
sensor:
- platform: template
sensors:
switch2_voltage:
friendly_name: "台扇电压"
value_template: >-
{{ state_attr('switch.quancheng_SW01', 'voltage') |float / 1 }}
unit_of_measurement: 'V'
switch2_current:
friendly_name: "台扇电流"
value_template: >-
{{ state_attr('switch.quancheng_SW01', 'current') |float / 100 }}
unit_of_measurement: 'A'
switch2_current_consumption:
friendly_name: "台扇功率"
value_template: >-
{{ state_attr('switch.quancheng_SW01', 'current_consumption') |float / 1 }}
unit_of_measurement: 'W'
|