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

two meanings of getting out of sync:
Scenario one: You’ve two independently controlled table lamps which you’d prefer to turn on or off together. The lamps could be smart lamps or they could be regular lamps controlled by two smart sockets. In either case you’d prefer that one switch turns them both on or off.
Scenario two: You’ve a table lamp with a smart light bulb that can be turned on or off in multiple ways: it can turned on by the lamp manufacturer’s app, or by a smart switch, or by a timer or by the TV remote, or by an automation routine that triggers when a person enters a room. A syncing problem occurs when some of these other ways turn on this lamp and a switch can appear to be off when the lamp is on.
For example, I’ve a lamp controlled by a wall switch (T4EU1C – 3 gang) which isn’t wired to a lamp but it’s useful because it can trigger a Home Assistant automation to switch a lamp on/off. If I use some other way to switch on the lamp, the switch and lamp states go out of sync. In other words a light is on when its switch is off.
An automation can right these two situations.
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. The screenshots below show the dialogues from both of them:
Go to Configuration > Blueprints > Import a Blueprint

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

Choose the Blueprint option and then Synchronize states or State Bonding – Dual


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. From now 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?
When a smart lamp is controlled by a smart switch, the lamp and switch are invariably independent of each other so they can go out out of sync.
A different and more common problem occurs when we have smart lamps controlled by a regular wall switch at the door. The solution to this one is to stop people using the regular wall switch. I hung a picture over the switch to put it out of use. Do share your own other non-violent means of doing this.