This is not a zigbee2mqtt issue.
This OSRAM Smart+ plug (AB3257001NJ) issue + solution.
******* Description of the problem:
I was having the following problem:
When I turn ON (or OFF) the plug, it immediately turns ON (or OFF)
but then sometimes 2 to 5 seconds later, the plug turn back OFF (or ON).
This problem disappears when the plug is very close to the coordinator.
I have observed this behavior with the 2 plugs I have.
I also saw a confirmation of OSRAM Smart+ plug range issue here:
https://fvdm.com/text/hacking/connecting-an-osram-smart-plug-to-philips-hue
More precisely:
"
On deciding the definitive location make sure the distance to a Hue light or the bridge is at most 4 meters. The radio antenna inside the plug is very small.
"
******* Solution = antenna modification
The plug is relatively easy to open.
You can see some pictures here:
https://forum.smartapfel.de/forum/thread/1843-osram-smart-plug-zerlegt-zigbee-switch/
Yesterday I replaced the PCB antenna by a small wire antenna.
I used a wire of about 30mm
30mm is about 1/4 of wavelength at 2.45GHz
The link quality is now much better.
The plug switches properly every time.
I will try to add a picture of the antenna modification ASAP.
Note that the issue tracker is meant for tracking bugs, for questions please use http://zigbee2mqtt.discourse.group/ or https://discord.gg/dadfWYE.
@Koenkk this is not really a question but some information regarding a "supported device".
I think that people who are looking at buying devices would be interested by this info.
I don't know what is the best technical solution but I think that it would be great to have a central location for information related to supported devices:
pros/cons, improvements/mods, repair , etc.
@fred-c1 each device has a page where info can be put: https://www.zigbee2mqtt.io/devices/AB3257001NJ.html
@Koenkk I agree, this page should be the central location for device specific information.
but technically I don't know how this should be done.
Do you suggest I edit this document?
https://github.com/Koenkk/zigbee2mqtt.io/blob/master/docgen/device_page_notes.js
I am concerned that if we do this this way it will be difficult to manage given the large amount of information subjects like pros/cons, issues, improvements/mods, repair , etc. can generate.
Just edit this file: https://github.com/Koenkk/zigbee2mqtt.io/blob/master/docs/devices/AB3257001NJ.md
@fred-c1 Can you post the photos of your modification?
I would like to do the same to my Smart+ plugs.
I believe I found the antenna part, but it's integrated (PCB antenna). The wireless chip is under metal shielding. Not sure how to solder the wire.
@ pa0los
Here is a small guide (even if you only need a small part of this):
remove the external screw => torx head
open the box by separating the white plastic from the grey plastic
There are 4 plastic latches. One at the center of each edge.
An old credit card can help.
remove the 2 internal screws => torx head
You can now get the boards out of the box
disconnect the PCB antenna by cutting the trace
Be sure to remove at least 1 to 2mm of the trace with this cut.
Looking at my picture the cut is just left of the solder (under the new wire antenna).
solder the new wire antenna
the red varnish (nail varnish should work) will make this mod more robust and will prevent any oxidation.
Here is the picture:

The antenna design of this product is really bad.
The above picture is actually showing a plug which is not so bad (but still very poor range).
I have some plugs for which this mod will be much more difficult because the location of the cut (and solder) is under the shield... which make the range of the PCB antenna even worse.
Most helpful comment
@ pa0los
Here is a small guide (even if you only need a small part of this):
Here is the picture:
The antenna design of this product is really bad.
The above picture is actually showing a plug which is not so bad (but still very poor range).
I have some plugs for which this mod will be much more difficult because the location of the cut (and solder) is under the shield... which make the range of the PCB antenna even worse.