ZIgbee2MQTT integration incomplete

I would like to ask for a support with one quite weird issue. So, recently I have bought the Zigbee smart plug, connected it via Zigbee2MQTT to Home Assistant and all works but one very important feature - I cannot neither turn it on or off via home assistant but I can do that via Zigbe2MQTT UI. I tried re-pairing, removing and re-adding the device - nothing helps for some reason. The device is identified as BSD29_1 - it has to be fully supported but unfortunately this particular part is missing. The funny thing is that I can even execute a “child lock” from HA to this device, see power consumption BUT cannot see if it is on or off and can’t change the state. Can anyone help with the issue please?

Try plug in plug closer to the coordinator. Maybe in the same room if possible. If it works than you have weak signal.

Ah no, the connection is perfect - it is just the fact that the entitiy control on/off is not populated to HA from Z2M for some reason…

Then you have some problem with mqtt. Check mqtt integration and or addon if you are using that.
Edit:
Or if everything sims fine, remove that plug from z2m, remove it from mqtt and restart home assistant.
Then add it again.

Unfortunately that didn’t help… I’ve done that and the result is exactly the same :frowning:

In lovelace every device is controlled by mqtt. In z2m ui it is controlled by zigbee.
So it must be some problem with mqtt in my opinion.

Welcome!

In theory, with Home Assistant ‘auto discovery’ if turned on for service such as Zigbee2MQTT, devices that communicate via MQTT should auto-magically appear as Home Assistant entities. This is cool and should work most of the time. That said, I would take the time/effort to learn about the MQTT message that your device is publishing and looking for. This is the ‘manual’ mode, and can take some time to learn now to create MQTT based entities in Home Assistant via YAML. Doing one or two zigbee devices this way will give you a good understanding of the underlying mechanics. Hopefully, after learning with these one or test devices, you can go back to the ‘auto-magic’ path with a much better understanding of what to look for.

Do some searches on this forum for some of these terms, you should find some smart folks posting help.

‘manual zigbee2mqtt device setup’
‘mqtt switch’

Good hunting!

What does the device look like in the HA devices & services page?

Okay, apologies for not answering so long - had other things to do. So I have dug deep and it seems to be that issue is definitely in HA, not zigbee2mqtt or mosquitto. Basically HA doesn’t utilize the “state” payload to be turned on or off.
So, what to do (if someone later gets here from search):

  1. Zigbee2MQTT - go to device settings, tab “Settings (specific)” and set " **State action**" to “true” (there is a comment: “State actions will also be published as 'action' when true (default false).”)
  2. HA: you have to create a script. Open script editing - e.g. https://your-home-assistant-url:8123/config/script/dashboard , there click “create script” at the bottom right. Call it “Whatever-name ON”. Check if the field “action” is single. Now, in “Sequence” - add “Call service”; select “MQTT Publish”; topic - “zigbee2mqtt/your-fancy-zigbee-device-name/set”, where “your-fancy-zigbee-device-name” is the UI name of the device (how is it called in zigbee2mqtt). Set checkbox near “payload”. Enter in the field right to it {"state": "ON"} string ; turn off checkboxes for “payload template” and “qos”. Save. Then in top-right corner press three-dots-button and in the menu select “duplicate”. In the duplicated script change name to “Whatever-name OFF” and in sequence - in payload {"state": "OFF"} .
  3. Now you have 2 scripts for the device, which can turn on and off it. Enjoy!

P.S. or you can also manually create in configuration.yml file in mqtt section the same configuration as plugin did plus adding power control. Well, it will be the hard way (I have gone through it though) but works. E.g. adding these: Integrations - Home Assistant