Need help rebuilding home automation raspberry pi

I spent several hours building a machine with Bookworm installed and did not gain a single step forward. Everything was done with the guide and the responses all seem correct. I certainly agree with you regarding the simple test. What does it really prove? Is there some magic signal between the mqttout/in? And when I click on timestamp button, a timestamp appears magically in the debug pane! I would guess that the flow is correct but the part of the flow that I think is missing is the radio signal from the router to the device and the state msg from the device back to the router and back to the RPi . And I have to discount that possibility because the old system running Buster is sitting right here using the same radio system and working fine. I can't run them at the same time because I don't want to have to use different i/p addresses.
In retrospect, I should never have asked my original question!

That seems to confirm that your broker is accepting the connection from Node-red and you can publish and subscribe.

It does not confirm that it accepts the connection from the "device".
Perhaps your next step is to look into the logging offered by mosquitto to see if connections are being refused.

Hmm.

for "jbudd", I agree with your closing statement above and will search out the logging features of mosquitto .

In an effort to solve this issue, here is the latest status. Remember the first version of this system was created over two years ago from the RandomNerdTutorials course, “Smart home_RaspberryPi. Etc” v1.3. I am wanting to build another system for another application and it was suggested here on this forum that I would be better off going with the latest versions of the software and hardware involved. The course was also upgraded by the authors to v1.7 which is the guide I used to build this version. The original version is still working using a RPi3B+, updated/upgraded regularly. The new version is using a RPi4B with the latest image from RPi Imager. The software is identified in several of the screenshots.
The flow (simple.json) has been reduced to simply demonstrate the problem. The problem seems to have something to do in the flow that prevents the message from the switch from getting to the mqtt output node. All the nodes in this system with the exception of the simple “test1” were exported/imported from the original system. Updates were made to reflect the newer versions. The simple “test1” will produce an output into the “debug” pane of the node red window and it the reason for me saying that is working. The devices controlled in the system are all Sonoff basic switches programmed manually with the correct topic and names.
The problem is that none of the switches respond to the new system but still wok fine with the old system. I would like to think that one single item is at fault here. The simple four node test works but I am not sure how much of the connection between the mqtt nodes is actually used. The RPi4 is connected to the router via ethernet and it is using the same network as the original system.
I have all of the available logs running on Mosquitto but I am not sure what they are really telling me. If someone could enlighten me on the use of the logs, I might just find the error right he in front of me. The screenshots that I have included were taken from the terminal using the command “mosquito -v”. I can see when I make an input to the “test1” flow but I never see any activity when I input to the other flow.
screenshots with description
simple.json (6.9 KB)

Thanks for looking

[Admin edit] Fixed formatting to allow attachment to be accessed

OK one of a couple of problems - on each of the sonoff devices you have to tell them to communicate with a MQTT node - you do this by supplying the IP address of the node - if you have a 2nd box now configured it will have a different IP address than the original.

So you will have to login to each sonoff device and update where it talks to MQTT - i assume you have loaded an alternate firmware onto the Sonoffs as i do not recall any MQTT support in the default firmware (but have not used it or the app for years)

Presumably if they are talking purely MQTT and not Home Assistant protocol (as you do not mention that at all in the above) they point to the old IP address on the old machine.

You can create an MQTT in Node on the new box and configure it to point to the old IP address where the MQTT broker was and see if you see any messages coming in.

If not then you will need to login to the old box at the terminal/SSH level (more information needed as to how NR is running on that box and whether it does indeed run Home Assistant (and if so which version and install method) and you can then monitor the live data in the MQTT server

Craig

Your screenshot says it is not available in my region. You can just paste it inline. Also please paste the flow inline here. Make sure you only export those nodes that are necessary to see the problem. In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

See this post for more details - How to share code or flow json

Could you expand on the above statement?
Programmed manually.
Do you mean they have been flashed with Tasmota or some other firmware?

So in summary... you have a set of SonOff switches "talking" to a RPi-4 via MQTT
and the RPi-4 is running Node-RED and Mosquitto (as your MQTT broker)?

Here is the flow file from your attachment

[
    {
        "id": "689a8ea47644053d",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "7318524b661c6311",
        "type": "inject",
        "z": "689a8ea47644053d",
        "name": "ON",
        "props": [
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "on",
        "x": 90,
        "y": 80,
        "wires": [
            [
                "8d4d8023772c2e4f"
            ]
        ]
    },
    {
        "id": "b93e8f4590ef8f7b",
        "type": "inject",
        "z": "689a8ea47644053d",
        "name": "OFF",
        "props": [
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "off",
        "x": 90,
        "y": 140,
        "wires": [
            [
                "8d4d8023772c2e4f"
            ]
        ]
    },
    {
        "id": "8d4d8023772c2e4f",
        "type": "ui_switch",
        "z": "689a8ea47644053d",
        "name": "Hot Water switch",
        "label": "Hot Water switch",
        "tooltip": "",
        "group": "59214996.9e7fa8",
        "order": 12,
        "width": 0,
        "height": 0,
        "passthru": true,
        "decouple": "false",
        "topic": "topic",
        "topicType": "msg",
        "style": "",
        "onvalue": "On",
        "onvalueType": "str",
        "onicon": "",
        "oncolor": "",
        "offvalue": "Off",
        "offvalueType": "str",
        "officon": "",
        "offcolor": "",
        "animate": false,
        "className": "",
        "x": 290,
        "y": 100,
        "wires": [
            [
                "759c50bb87126704"
            ]
        ]
    },
    {
        "id": "4cf8810714871578",
        "type": "mqtt in",
        "z": "689a8ea47644053d",
        "name": "home/office/4004_05/state",
        "topic": "home/office/4004_05/state",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "db9e6b85.5d9138",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 530,
        "y": 180,
        "wires": [
            [
                "49ad72d76484bccf",
                "8aa44fc853573bc0"
            ]
        ]
    },
    {
        "id": "759c50bb87126704",
        "type": "mqtt out",
        "z": "689a8ea47644053d",
        "name": "home/office/4004_05",
        "topic": "home/office/4004_05",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "db9e6b85.5d9138",
        "x": 300,
        "y": 180,
        "wires": []
    },
    {
        "id": "49ad72d76484bccf",
        "type": "ui_text",
        "z": "689a8ea47644053d",
        "group": "59214996.9e7fa8",
        "order": 13,
        "width": 0,
        "height": 0,
        "name": "Hot Water XX",
        "label": "Hot Water XX",
        "format": "{{msg.payload}}",
        "layout": "row-left",
        "className": "",
        "style": false,
        "font": "",
        "fontSize": 16,
        "color": "#000000",
        "x": 840,
        "y": 180,
        "wires": []
    },
    {
        "id": "8aa44fc853573bc0",
        "type": "debug",
        "z": "689a8ea47644053d",
        "name": "Hot water Zz",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 830,
        "y": 220,
        "wires": []
    },
    {
        "id": "d65d0e3cda1f65b5",
        "type": "inject",
        "z": "689a8ea47644053d",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 220,
        "y": 360,
        "wires": [
            [
                "0af0f777b78897b1"
            ]
        ]
    },
    {
        "id": "3db64d5c4994f476",
        "type": "debug",
        "z": "689a8ea47644053d",
        "name": "debug XX",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 720,
        "y": 360,
        "wires": []
    },
    {
        "id": "3c80922e8ee33541",
        "type": "mqtt in",
        "z": "689a8ea47644053d",
        "name": "",
        "topic": "test1",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "db9e6b85.5d9138",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 550,
        "y": 360,
        "wires": [
            [
                "3db64d5c4994f476"
            ]
        ]
    },
    {
        "id": "0af0f777b78897b1",
        "type": "mqtt out",
        "z": "689a8ea47644053d",
        "name": "",
        "topic": "test1",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "db9e6b85.5d9138",
        "x": 390,
        "y": 360,
        "wires": []
    },
    {
        "id": "59214996.9e7fa8",
        "type": "ui_group",
        "name": "4004",
        "tab": "4c1cfcd6.cb35c4",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "db9e6b85.5d9138",
        "type": "mqtt-broker",
        "name": "localhost:1883",
        "broker": "localhost",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "5",
        "keepalive": "60",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    },
    {
        "id": "4c1cfcd6.cb35c4",
        "type": "ui_tab",
        "name": "HOME",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    },
    {
        "id": "e18fd8c4be1a533e",
        "type": "global-config",
        "env": [],
        "modules": {
            "node-red-dashboard": "3.6.6"
        }
    }
]

If you add an mqtt In node subscribing to home/office/4004_05 you can check that the message is getting published ok.

Can you tell by looking at something on the end device is receiving the command?
Can you tell whether the end device has connected to your broker?
If you don't know then look in the mosquitto log and it will tell you. Run something like
sudo tail -f -n 100 /var/log/mosquitto/mosquitto.log

Here is a snippet from my mosquitto.log, after restarting the Pi

1774009259: mosquitto version 2.0.11 starting
1774009256: Config loaded from /etc/mosquitto/mosquitto.conf.
1774009256: Opening ipv4 listen socket on port 1883.
1774009256: Opening ipv6 listen socket on port 1883.
1774009256: mosquitto version 2.0.11 running

1774009267: New connection from 127.0.0.1:59978 on port 1883.
1774009268: New client connected from 127.0.0.1:59978 as nodered5d728e8efb19a941 (p2, c1, k60, u'admin').

1774009269: New connection from 192.168.1.100:65239 on port 1883.
1774009269: New client connected from 192.168.1.100:65239 as ESP32C3-AC:XX:XX:XX:XX:XX (p2, c1, k15, u'admin').

First lines show Mosquitto is running and accepting connections on port 1883.

Timestamps are Unix timestamps: seconds since the creation of the world.
unixtimestamp.com tells me these are roughly Fri Mar 20 2026 12:20:59 GMT+0000, ie now-ish.

Then we see a connection from the broker computer itself - the IP is 127.0.0.1 or localhost.
Since the username begins with "nodered" we can tell the connection is from Node-red, and it is using a username and password - username 'admin'.

Next a connection from an ESP32 microcontroller at 192.168.1.100, also using username 'admin'.

I changed the mqtt broker settings on another Node-red machine (wrong username/password).
Now I see multiple failed connection attempts in the logfile

1774009920: New connection from 192.168.1.27:42514 on port 1883.
1774009920: Client <unknown> disconnected, not authorised.