how to stop a smart light and switch states getting out of sync

what do we mean by getting out of sync:
Scenario one: You’ve two table lamps which are controlled independently either because they’re smart lamps or because you’ve two regular lamps controlled by two smart plugs/sockets.
Scenario two: Smart light bulbs can be turned on or off by the manufacturer’s app, or by a switch, or by a timer or by the TV remote, or by an automation routine that is triggers when a person enters a room. Your lamp might also be controlled by a wall switch (T4EU1C – 3 gang) which although is isn’t wired to this lamp it nevertheless switches the lamp on/off. When any of these other ways turn on this lamp, the wall switch remains in an ‘off’ state. The switch and light have got out of sync. Hence we’ve the strange situation where a light can be on when its switch is off
An automation puts this right.
use a Home Assistant automation blueprint to sync your lights and switches
note: When I first wrote this post I used ‘Synchronize states’ by Adrien Chevrier but this was rendered inoperative by an update to Home Assistant. No matter, I’ve switched over to an alternative: State Bonding – Dual and this can be found in the Home Assistant Blueprints Exchange.
Go to Configuration > Blueprints > Import a Blueprint

Enter the URL of the Synchronize states* Blueprint into the dialogue. Otherwise find the URL of State Bonding – Dual
*Adrien Chevrier (adchevrier)
Go to Configuration > Automations > Add Automation

Choose the Blueprint option and Synchronize states

Give your Automation a name and then choose the entities that you want to say in sync. In my case one is a hue lamp and one is a wall switch
Here on, after a couple of uses, the switch state is changed to match the lamp state.
Is it normal for smart lights and switches to get out of sync?
A smart light usually has a switch controlling it and this is a source of problems, if that switch is a smart switch, your light and switch will go out out of sync. If it’s a regular wall switch you’ve hopefully found a way to stop people using it. In my case I hung a picture over it to put it out of use.