[SOLVED] Error sending switch command

Almost every time when I try to control my relay from Domoticz I get a "Error sending switch command, check device/hardware !" even though the relay turns on/off. There is maybe a 2-3 seconds delay between when I press the switch in Domoticz and when it reacts.

Don't know if it is the mysGateway not communicating properly with Domoticz or some other problem? Since the command works it seems to me that my sensors is working and talking to each other.

Any idea on what could be wrong or how to narrow down the problem?

I was hoping for a logfile for the mysController but haven't found anything. If there is some error between the gateway and the sensor.

However, watching the messages in MYScontroller I always see the same command sends two times (either on or off) every time when I get the error message in Domoticz. The few times when it works as it should, no error in Domoticz, on/off is only sent one time.

Don't know if it is possible to configure some more time in Domoticz before it produces a error? Or if the gateway is not communication properly with Domoticz saying "wait a second, need to resend the command", and therefore Domoticz thinks there is a problem with the command? Because it seems to me that the gateway at least understands that it needs to send the command twice sometimes.

Maybe a communication problem, but the command does work. Don't really see it as a problem that the gateway has to send the command twice sometimes, there is maybe a 0.5-1s delay because of it. But it is a problem that the controller screams error every time that occurs.

Don't know how a controller and gateway communicates, but it feels like it should be the gateway that tells the controller that it have failed to send the command. And I can't think that it does that at the same time as it sends the command again to my relay?
Or is it the controller that timeout to fast even though the gateway haven't reported the right status?

When you use a delay the Arduino completely delays your sketch meaning no incomming events can be processed. When you use a MySensors wait. The Arduino doesn't delay your sketch and will be able to handle incomming messages.