HA SwitchPlate HASPone: DIY In-Wall Touchscreen Home Assistant Controller

Okay. It appears to be a power problem. Put the 4.3" TFT code back on the display and it came right up using the power only USB connection (that combo wasn’t working at all before).

Now, just need to get the PCBs in and built. I think those provide more power than I am getting with the power adaptors (which is strange since they are rated at 2.5A).

Allright, so next step is to try and figure out why this doesn’t want to talk to your MQTT broker. The good news is that, because it’s up and running on WiFi, you shouldn’t have to break it open and start screwing around inside. If you connect to the web page (IP address shown on the device screen), you should see an admin configuration page. At the bottom of that screen is a bunch of status information. Can you post a screenshot of what you see there?

image

What’s weird here is that rc=0 means it successfully attached :frowning:

If you watch MQTT explorer while the device boots up, do you see any traffic? Does the device seem to do anything on boot? I suspect that, by your username, you might have purchased this from me recently. Are you OK with opening this fella up? You can get a lot more debug information with the USB serial interface located inside, but it requires removing the 4 screws in back (philips #1) and then two socket head screws inside (1.5mm) to get the PCB out. If you do so, don’t have it connected to AC power while also connected to USB.

Alternately, you can try enabling telnet debug and try to catch the debug messages during power on. That’s harder, because you can’t attach until WiFi starts up which makes the timing tricky.

When it boots up I don’t see anything. Just repeated screen resets

I just finished with assembly yesterday. sort of anyway. being powered by usb until the power supply comes in.

How do I get to the serial interface?

If you plug in the USB interface to a computer, it should create a COM port (Windows terminology). Then using something like PuTTY, connect a terminal session to that COM port with settings 115200 bps, 8N1.

Here is a random guide I just googled on the topic, looks like it should cover you if you’re a Windows user.

I forgot I had putty. All I’m seeing is junk so let me change settings

[+156.343s] HMI OUT: 'p[0].b[1].txt="WiFi Connected!\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connecting:\r mqtt://192.168.1.173"'
[+156.357s] MQTT: Attempting connection to broker mqtt://192.168.1.173 on port 1883 with TLS disabled as clientID plate_1-40f52069c29
[+161.468s] MQTT connection attempt 15 failed with rc 0.  Trying again in 5 seconds.
[+161.489s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'

That got it working, but whenever it restarts (for whatever reason: bumped the wire, restarted via web page) it loses the mqtt settings, and bottom of the web page says:

MQTT Status: Disconnected, return code: 0
MQTT ClientID:
HASP Version: 0.41
LCD Model: NX3224T024_011R
LCD Version: 3
LCD Active Page: 0
LCD Serial Speed: 115200
CPU Frequency: 160MHz
Sketch Size: 638560 bytes
Free Sketch Space: 2506752 bytes
Heap Free: 21480
Heap Fragmentation: 9
ESP core version: 2_7_4
IP Address: 192.168.20.228
Signal Strength: -50
Uptime: 16
Last reset: External System

Also, when it was working, I deployed the media blueprint to page 8. It works, but the << || >> buttons show no icon. They work when touched, but no icon shows.

Scratch that, it looks good after another factory reset cycle.

When you say “scratch that”, are MQTT settings still needing to be set every boot?

Both you and @Edhall1044 are seeing that “Disconnected” with return code 0 which is a really weird situation. RC=0 is connection accepted, and after wading through the library source files, that return code is what my connection loop is testing. So, the program logic is: is return code 0? If not, display an error with the return code, which, in these cases, is… 0.

I’ll try and wrap some code around this and see if we can’t either resolve it, or get some better information logged so we can figure out why the heck this is happening.

I appreciate the help.

Hoping someone can help me troubleshoot one of my switch plate. It’s been working great for over a year and recently I’ve been messing around with it, pulling it in and out of the wall trying out different buzzers and vibration motors and at some point I’ve messed something up.

Anyway long story short, I put it back in the wall, fire the breaker back up and it works fine for about 10-15 minutes and then just goes dark. HA says it’s still connected and I can toggle the switch on and off for the backlight but nothing happens.

As I’m trying to troubleshoot I decided to pull it apart and plug in the D1 mini directly to power to see if i have a bad power supply or connection. The light on the D1 mini just barely flickers like it’s not getting much power and eventually fades away. None of this makes sense. I’m stumped.
I have the parts to replace everything except the mean well not sure which one to start with. Maybe the D1 mini?

Allright @Edhall1044 and @nickrout - I’ve pushed an updated HASP firmware build to dev:

https://raw.githubusercontent.com/aderusha/HASwitchPlate/dev/Arduino_Sketch/HASwitchPlate.ino.d1_mini.bin

I’ve made some changes to how the MQTT connection loop happens which should hopefully handle the initial connection a little better, fix all of your problems, prevent global warming, and create world peace.

Alternately, it’ll dump out some more useful debug messages.

One of those two things is bound to happen. Let me know how it goes!

Can you put a meter on the +5v and GND, and also the 3.3v and ground?

This is what I get

[+146.731s] MQTT connection attempt 26 failed with rc 0 and error: -3. Trying again in 5 seconds.
                 [+146.754s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+151.886s] MQTT connection attempt 27 failed with rc 0 and error: -3. Trying again in 5 seconds.
[+151.909s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+157.038s] MQTT connection attempt 28 failed with rc 0 and error: -3. Trying again in 5 seconds.
                        [+157.060s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+162.187s] MQTT connection attempt 29 failed with rc 0 and error: -3. Trying again in 5 seconds,
[+162.210s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'

I would but I don’t have a working voltmeter.

more serial output

================================================================================
                                                                               [+0.069s] SYSTEM: Starting HASwitchPlate v0.41
[+0.075s] SYSTEM: Last reset reason: Software/System restart
[+0.081s] SYSTEM: heapFree: 31808 heapMaxFreeBlockSize: 31704
================================================================================

                                                                               [+0.095s] SPIFFS: mounting SPIFFS
[+0.113s] SPIFFS: reading /config.json
[+0.124s] SPIFFS: read 369 bytes and parsed json:{"mqttServer":"mqtt://192.168.1.173","mqttPort":"1883","mqttUser":"mqttuser","mqttPassword":"tchdad200!","mqttTlsEnabled":false,"mqttFingerprint":"","haspNode":"plate01","groupName":"plates","configUser":"admin","configPassword":"","nextionBaud":"115200","motionPinConfig":"0","debugSerialEnabled":true,"debugTelnetEnabled":false,"mdnsEnabled":true,"beepEnabled":false}
[+0.161s] HMI: Waiting for LCD connection
[+0.386s] HMI IN: [7 bytes]: 0xfe 0x00 0x00 0x00 0xff 0xff 0xff
[+0.392s] HMI: Querying LCD backlight status
[+0.398s] HMI OUT: get dim
[+0.401s] HMI IN: [4 bytes]: 0x88 0xff 0xff 0xff
[+0.405s] HMI: Nextion panel connected.
[+0.586s] HMI IN: [5 bytes]: 0x66 0x00 0xff 0xff 0xff
[+0.592s] HMI IN: [sendme Page] '0'
[+0.595s] HMI IN: [8 bytes]: 0x71 0x64 0x00 0x00 0x00 0xff 0xff 0xff
[+0.602s] HMI IN: [Int Return] '100'
[+0.606s] HMI IN: lcdBacklightDim '100'
[+0.611s] HMI OUT: bkcmd=3
[+0.614s] HMI: Querying LCD firmware version number
[+0.620s] HMI OUT: get p[0].b[2].val
[+0.624s] HMI IN: [8 bytes]: 0x71 0x03 0x00 0x00 0x00 0xff 0xff 0xff
[+0.630s] HMI IN: [Int Return] '3'
[+0.634s] HMI IN: lcdVersion '3'
[+0.637s] HMI: Querying LCD model information
[+0.642s] HMI OUT: connect
                          [+0.650s] HMI IN: [69 bytes]: 0x63 0x6f 0x6d 0x6f 0x6b 0x20 0x31 0x2c 0x33 0x30 0x36 0x30 0x31 0x2d 0x30 0x2c 0x4e 0x58 0x33 0x32 0x32 0x34 0x54 0x30 0x32 0x34 0x5f 0x30 0x31 0x31 0x52 0x2c 0x31 0x35 0x31 0x2c 0x36 0x31 0x34 0x38 0x38 0x2c 0x44 0x45 0x36 0x39 0x42 0x43 0x38 0x32 0x39 0x42 0x38 0x42 0x31 0x43 0x32 0x34 0x2c 0x34 0x31 0x39 0x34 0x33 0x30 0x34 0xff 0xff 0xff
[+0.705s] HMI IN: nextionModel: NX3224T024_011R
[+0.712s] HMI OUT: 'p[0].b[1].font=6'
[+0.717s] HMI OUT: page 0
[+0.726s] HMI OUT: 'p[0].b[1].txt="WiFi Connecting...\rë Hall 2.4G_2GEXT"'
[+0.803s] HMI IN: [5 bytes]: 0x66 0x00 0xff 0xff 0xff
[+0.808s] HMI IN: [sendme Page] '0'
[+0.812s] WIFI: Connecting to previously-saved SSID: Hall 2.4G_2GEXT
[+2.142s] HMI OUT: 'p[0].b[1].font=6'
[+2.153s] HMI OUT: 'p[0].b[1].txt="WiFi Connected!\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178"'
[+2.161s] WIFI: Connected successfully and assigned IP: 192.168.1.178
[+2.169s] HTTP: Server started @ http://192.168.1.178
[+2.176s] ESP OTA: Over the Air firmware update ready
[+2.181s] MQTT: Configuring MQTT connection without TLS.
[+2.188s] HMI OUT: page 0
[+2.245s] HMI OUT: 'p[0].b[1].font=6'
[+2.259s] HMI OUT: 'p[0].b[1].txt="WiFi Connected!\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connecting:\r mqtt://192.168.1.173"'
[+2.384s] HMI IN: [5 bytes]: 0x66 0x00 0xff 0xff 0xff
[+2.389s] HMI IN: [sendme Page] '0'
[+2.392s] MQTT: Attempting connection to broker mqtt://192.168.1.173 on port 1883 with TLS disabled as clientID plate01-40f52069c29
[+7.516s] MQTT connection attempt 1 failed with rc 0 and error: -3. Trying again in 5 seconds.
[+7.539s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+12.679s] MQTT connection attempt 2 failed with rc 0 and error: -3. Trying again in 5 seconds.
[+12.703s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+17.836s] MQTT connection attempt 3 failed with rc 0 and error: -3. Trying again in 5 seconds.
[+17.858s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+22.985s] MQTT connection attempt 4 failed with rc 0 and error: -3. Trying again in 5 seconds.
[+23.008s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+28.139s] MQTT connection attempt 5 faihed with rc 0 and error: -3. Trying again in 5 seconds.
[+28.163s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+33.341s] MQTT connection attempt 6 failed with rc 0 and error: -3. Trying again in 5 seconds.
[+33.364s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+38.492s] MQTT connection attempt 7 failed with rc 0 and error: -3. Trying again in 5 seconds.
[+38.515s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+43.639s] MQTT connection attempt 8 failed with rc 0 and error: -3. Trying again in 5 seconds.
[+43.662s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+48.786s] MQTT connection attempt 9 failed with rc 0 and error: -3. Trying again in 5 seconds.
               [+48.809s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+53.947s] MQTT connection attempt 10 failed with rc 0 and error: -3. Trying again in 5 seconds.
[+53.970s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+59.102s] MQTT connection attempt 11 failed with rc 0 and error: -3. Trying again in 5 seconds.
[+59.125s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+64.243s] MQTT connection attempt 12 failed with rc 0 and error: -3. Trying again in 5 seconds.
[+64.266s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'
[+69.387s] MQTT connection attempt 13 failed with rc 0 and error: -3. Trying again in 5 seconds.
[+69.410s] HMI OUT: 'p[0].b[1].txt="WiFi Connected:\rë Hall 2.4G_2GEXT\rIP: 192.168.1.178\r\rMQTT Connect to:\r mqtt://192.168.1.173\rFAILED rc=0\r\rRetry in 5 sec"'

You mentioned a successful connection w/ MQTT Explorer - can you post a screenshot of your connection configuration there? For example: