Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create light switch in home assistant using MQTT
#1
If I create a switch, it works ok,
switch:
  - name: 'a16-kcs-output-1'
    unique_id: a16-kcs-output-1
    state_topic: 'KC868_A16/B0B21CCF0978/STATE'
    command_topic: 'KC868_A16/B0B21CCF0978/SET'
    payload_on:  '{"output1":{"value":true}}'
    payload_off:  '{"output1":{"value":false}}'
    value_template: '{{ value_json.output1.value }}'
    state_on: true
    state_off: false

But if I create a "light",
light:
  - name: 'my_led'
    unique_id: a16-kcs-output-led-wc-1
    state_topic: 'KC868_A16/B0B21CCF0978/STATE'
    command_topic: 'KC868_A16/B0B21CCF0978/SET'
    payload_on:  '{"output1":{"value":true}}'
    payload_off:  '{"output1":{"value":false}}'
    state_value_template: '{{ value_json.output1.value }}'

the UI in home assistant showed "Unknown" status.     
Please help!
Reply


Messages In This Thread
Create light switch in home assistant using MQTT - by truongdq54 - 09-20-2023, 05:43 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)