need MQTT AD examples for all kinds of devices

For devices supporting the Auto Discovery feature. Like ZWaveJS2MQTT, Zigbee2MQTT.

Moderator: leecollings

Post Reply
Gravityz
Posts: 587
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2022.2
Location: Netherlands
Contact:

need MQTT AD examples for all kinds of devices

Post by Gravityz »

this has been asked a lot by several people.
They all ask the same question "what MQTT string do i need to send out so a certain devicetype is created"
i also want to know but there is no single source

there is a Tasmota alternative called OpenBK which runs on several NON ESP8266 chips like 7231N/T and is very nice.
it works with MQTT and is HA compatible. The problem is this HA implementation does not work 100% with domoticz(because domoticz is not 100% compatible)
These guys are willing to see if they can support domoticz MQTT(MQTT AD) but for that they info on what domoticz expects for all the devicetypes it supports

can somebody help me out with this

so basically we need somebody who wrote the code on MQTT AD to explain the functionality in a way both programmers and guys like me will understand
User avatar
waltervl
Posts: 5859
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: need MQTT AD examples for all kinds of devices

Post by waltervl »

Domoticz should be HA autodiscover compatible so if you find a incompatibility please report in the domoticz GitHub repository.

If OpenBK is HA autodiscover compatible then Domoticz should accept it. Problem is that perhaps OpenBK has another interpretation of HA Autodiscover then Zigbee2mqtt or ZwavejsUI (Zwavejs2mqtt). But please report your issue supported with the config and state topics of the device out of OpenBK with what should be expected.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5859
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: need MQTT AD examples for all kinds of devices

Post by waltervl »

I see you already made an issue in this case Wich was rejected.
Be aware that HA changed to another MQTT protocol so Domoticz supports HA Autodiscover MQTT, not HA MQTT.

I could not find the GitHub repository of OpenBK.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5859
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: need MQTT AD examples for all kinds of devices

Post by waltervl »

Found it...
According https://github.com/openshwprojects/Open ... issues/219 only basic HA Autodiscover is implemented.

But if perhaps check what is supported...
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Gravityz
Posts: 587
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: need MQTT AD examples for all kinds of devices

Post by Gravityz »

you saw gizmocuz reponse
this is not constructive since his solution will only possibly show what my light needs to receive, not what we need to send in order for domoticz to create a certain device.

i played around with the home assistant MQTT implementation which is basically clear
https://www.home-assistant.io/integrations/light.mqtt/

problem is that this functionality does not work 100% in domoticz

this is the code which accoording to OpenBK needs to be send out
it creats a RGBWZ light which does not react to on/off or dim

Code: Select all

mqtt:
  light:
  - unique_id: "OpenBK7231T_17A1C483_light"
    name: "lsclamp-shortname 64"
    rgb_command_template: "{{ '#%02x%02x%02x0000' | format(red, green, blue)}}"
    rgb_value_template: "{{ value[0:2]|int(base=16) }},{{ value[2:4]|int(base=16) }},{{ value[4:6]|int(base=16) }}"
    rgb_state_topic: "lsclamp/led_basecolor_rgb/get"
    rgb_command_topic: "cmnd/lsclamp/led_basecolor_rgb"
    command_topic: "cmnd/lsclamp/led_enableAll"
    state_topic: "lsclamp/led_enableAll/get"
    availability_topic: "lsclamp/connected"
    payload_on: 1
    payload_off: 0
    brightness_command_topic: "cmnd/lsclamp/led_dimmer"
    brightness_scale: 100
    #brightness_value_template: "{{ value }}"
    color_temp_command_topic: "cmnd/lsclamp/led_temperature"
    color_temp_state_topic: "lsclamp/led_temperature/get"
    #color_temp_value_template: "{{ value }}"

following this example i noticed it is impossible to create and RGB light this way because with HA you can use al kinds of rules on variables and you can not do this on domoticz(probalby needs seperate R,G,B,W numbers


i played around a bit to see if i could change the code to something simple which would work
This creates a simple dimmable lightbulb(no colortemperature, only dim)
it
switches on (good)
switches off(good)
you can dim it when on and the light brighness changes(good)
you can dim it when off, the light does not turn on(not good)
when switching on the brightness value is set to 1% and does not represent the actual brightness(not good)

so you see even with the basic implementation it does not work 100% and people at github do not care about it because they state this is not supported anyway.


topic:homeassistant/light/OpenBK7231T_17A1C483_light/config

string send to domoticz

Code: Select all

   {
        "unique_id": "OpenBK7231T_17A1C483_light",
        "name": "lsclamp",
        "command_topic": "cmnd/lsclamp/led_enableAll",
        "availability_topic": "lsclamp/connected",
        "state_topic": "lsclamp/led_enableAll/get",
        "availability_topic": "lsclamp/connected",
        "payload_on": 1,
        "payload_off": 0,
        "brightness_command_topic": "cmnd/lsclamp/led_dimmer",
        "brightness_value_template": "{{ value }}",
        "brightness_scale": 100,
        "brightness_state_topic": "lsclamp/led_dimmer/get",
        "on_command_type": "brightness",
        "state_value_template": "{{ value }}"
      }
User avatar
waltervl
Posts: 5859
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: need MQTT AD examples for all kinds of devices

Post by waltervl »

I think the problem is in this part:
rgb_command_template: "{{ '#%02x%02x%02x0000' | format(red, green, blue)}}"
rgb_value_template: "{{ value[0:2]|int(base=16) }},{{ value[2:4]|int(base=16) }},{{ value[4:6]|int(base=16) }}"

If you remove those lines it perhaps works already for creation of the device. Update will probably not work.

Seems to be related to RGB in HEX notation see https://github.com/home-assistant/core/pull/9304
So Domoticz does not support this now and OpenBK needs to send this in normal values.

Edit: this seems to be an interesting script to see the config and command topics HA is expecting for lights https://github.com/home-assistant/core/ ... t_light.py

I think Domoticz is expecting something like "test_light_rgb/rgb/set", "255,255,255"
And your device is sending probably something like test_light_rgb/rgb/set', '#ffffff'
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
mjray
Posts: 18
Joined: Wednesday 05 October 2022 2:31
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Contact:

Re: need MQTT AD examples for all kinds of devices

Post by mjray »

If it helps, you can see what MQTT AD I am sending for Ecodan climate devices at https://github.com/mjray/melcloud-mqtt.py
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest