写法有点点问题吧,switch应该是这样
mqtt:
switch:
- name: 'ztc1_1_d0bae464159a'
unique_id: ztc1_1_d0bae464159a
state_topic: 'device/ztc1/d0bae464159a/state'
command_topic: 'device/ztc1/d0bae464159a/set'
payload_on: '{"mac":"d0bae464159a","plug_0":{"on":1}}'
payload_off: '{"mac":"d0bae464159a","plug_0":{"on":0}}'
value_template: '{{ value_json.plug_0.on }}'
state_on: '1'
state_off: '0'
- name: 'ztc1_2_d0bae464159a'
unique_id: ztc1_2_d0bae464159a
state_topic: 'device/ztc1/d0bae464159a/state'
command_topic: 'device/ztc1/d0bae464159a/set'
payload_on: '{"mac":"d0bae464159a","plug_1":{"on":1}}'
payload_off: '{"mac":"d0bae464159a","plug_1":{"on":0}}'
value_template: '{{ value_json.plug_1.on }}'
state_on: '1'
state_off: '0'
而不是每个实体前面一个switch吧,sensor也是这样,话说这样写为什么能够正常配置啊,应该会报错才对啊 |