So I have a lot of lights and other things that I trigger with automations and sometimes the state I sent it to change never got changed on the device. Like my outside lights that do not have that good connection from time to time.
So my question is if no one knows if there is a function in HA or maybe ZHA that like verify that the state sent got changed by the device and if not tries again? Or if someone have a good solution that is not a lot of work to implement in an automation or script that tries again?
If not could it become a good feature for HA in the future?
You need to check it yourself.
HA will often change the state to what it was supposed to be, but after a few seconds the device would be queried an the state will then be updated to sign with that result.
The issue with resending commands is that confirmation packets do often not exist in the protocols, so you have no way of knowing if some other action just changed the state back before you could detect the change.
Think about sitting in your den watching a scary movie in the dark and the better half of you enters the room and turns on the light, then realize you are there watching a movie, so the light is quickly turned off again.
In this situation HA would with your feature likely detect the light as not turned on as requested and turn it on again.