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
#2
i think you can use "switch", just change UI for "light" ico is better.
Reply
#3
Thank you, it works!
Reply
#4
(09-20-2023, 10:10 PM)admin Wrote: i think you can use "switch", just change UI for "light" ico is better.

But, if I have to do "light" in my config.yaml?
Please, help!!!
Reply


Forum Jump:


Users browsing this thread: