HA with MySensors integration (MQTT)

I am trying to completely redo the MySensors integration. The current integration works, but I am unable to have nodes as part of the gateway. I hoping that starting over from scratch might work. 1st I stop the MySgw. then I delete the integration. This does not delete the persistent data; using Studio Code Server, I delete MySensors data. Next I delete the MySensors topics from the MQTT broker. Finally, I reboot Home Assistant. (In terminal execute reboot) when the reboot is complete, I re-integrate MySensors, ensuring that the version, “in” topics and “out” topics are identical to the MySgw. Then I restart the gateway. The data is getting the MQTT broker, but not to HA. Of course I backed up before doing this and when I do the full restore, all is working as it was before. I expect I should be able to start from scratch. What am I doing wrong?

I was unsuccessful in completely “redoing” the MySensors integration. For reasons unknown to me, I was able to create sensors/actuators on the gateway node.

What I did was create simple sensors/actuators in place of the ones I wanted and started the gateway. These showed up as child devices of device “0” in under the MySensors integration. Then I deleted the “0” device from the the My Sensors integration by clicking on the “0” device, the clicking on delete.

I learned two important things along the way:

  1. The controller needs an initial send for each child device. These sends must be in the loop routine, not the setup routine.
  2. I found I needed a 2 second delay after each send or else the message gets lost

This next part probably needs its own thread: Sending data to a MySensors device from HA
After trying several combinations, I found that HA will only send data types of V_TEXT presented as S_INFO

MyMessage msgZone(CHILD_ID_ZONE,V_TEXT);
void loop(){
   if(InitLoop) send(msgZone.set(ZoneToWater));
void receive(const MyMessage &message){
	if (message.getSender() == 0 ) {  // Only listen to messages from controller
		if (message.getSensor() == 1 ) {
			ZoneToWater = (int8_t)(message.getLong());

The message is sent from HA with:

service: notify.mysensors
  message: 1
  target: Zone

Note the “Zone” in presentation and receive! These must be identical and unique across all MySensors devices!

Note! The notify.mysensors service will not be available until the device is integrated into HA. (Yes, somewhat chicken-and-the-egg)

OK, on to other things!