HASwitchPlate / openHASP

HomeAutomation Switchplate based on lvgl for ESP32
https://www.openhasp.com
MIT License
726 stars 185 forks source link

MQTT Server Domain gets truncated when set via web interface #304

Closed fake-name closed 2 years ago

fake-name commented 2 years ago

Perform all steps below and tick them with [x]

Describe the bug

I have my mqtt server on a sub-domain of a domain I own.

When I set it, the trailing TLD get's truncated, which breaks it.

To Reproduce

Expected behavior

I'd expect setting the mqtt server to set the mqtt server.

Playing around, it seems like the MQTT server address is being truncated to 16 characters. If this field is supposed to just be an IP address that's fine, but the documentation says Set the IP or *hostname* of your MQTT Broker.

Logs:


        open____ _____ _____ _____
          |  |  |  _  |   __|  _  |
          |     |     |__   |   __|
          |__|__|__|__|_____|__|
        Home Automation Switch Plate
        Open Hardware edition v0.6.2

[07:05:44.173][113792/197836 42][    0/    0  0] DBUG: Started @ 115200 Bps
[07:05:44.185][113792/197836 42][    0/    0  0] DBUG: Environment: m5stack-core2
[07:05:44.198][113792/197836 42][    0/    0  0] CONS: Started
[07:05:44.209][113792/197836 42][    0/    0  0] CONS: Client login from serial
[07:05:44.222][113792/197836 42][    0/    0  0] CONF: SPI flash FS mounted
[07:05:44.249][113792/197836 42][    0/    0  0] FILE: Partition size: total: 12517376, used: 12288
[07:05:44.264][113792/197836 42][    0/    0  0] CONF: Loading /config.json
[07:05:44.278][113792/197196 42][    0/    0  0] CONF: {"wifi":{"ssid":"(╯°□°)╯︵ ┻━┻","pass":"********"},"mqtt":{"name":"plate","gr"user":"","pass":"********"},"telnet":{"enable":1,"port":23},"mdns":{"enable":1},"http":{"enable":true,"port":80,"user":"","pass":"*0,0,0,0]},"debug":{"baud":0,"tele":300,"host":"","port":514,"proto":0,"log":0},"gui":{"idle1":60,"idle2":120,"bckl":-1,"rotate":1,"c":[0,65535,0,65535,0]},"hasp":{"startpage":1,"startdim":255,"theme":2,"hue":200,"font":"","pages":"/pages.jsonl"}}
[07:05:44.339][113792/197196 42][    0/    0  0] CONF: Loaded /config.json
[07:05:44.351][113792/197896 42][    0/    0  0] DBUG: Loading debug settings
[07:05:44.364][113792/197416 42][    0/    0  0] DBUG: {"baud":0,"tele":300,"host":"","port":514,"proto":0,"log":0}
[07:05:44.380][113792/197896 42][    0/    0  0] GPIO: Loading GUI settings
[07:05:44.393][113792/197416 42][    0/    0  0] GUI : {"idle1":60,"idle2":120,"bckl":-1,"rotate":1,"cursor":false,"invert":1,"calib
[07:05:44.413][113792/197896 42][    0/    0  0] GUI : First Touch Calibration enabled
[07:05:44.426][113792/197896 42][    0/    0  0] HASP: Loading HASP settings
[07:05:44.439][113792/197416 42][    0/    0  0] HASP: {"startpage":1,"startdim":255,"theme":2,"hue":200,"font":"","pages":"/pages.j
[07:05:44.457][113792/197896 42][    0/    0  0] WIFI: Loading WiFi settings
[07:05:44.470][113792/197416 42][    0/    0  0] WIFI: {"ssid":"(╯°□°)╯︵ ┻━┻","pass":"********"}
[07:05:44.486][113792/197896 42][    0/    0  0] MQTT: Loading MQTT settings
[07:05:44.499][113792/197416 42][    0/    0  0] MQTT: {"name":"plate","group":"plates","host":"","port":1883,"user":"","pass":"****
[07:05:44.517][113792/197896 42][    0/    0  0] TELN: Loading Telnet settings
[07:05:44.530][113792/197416 42][    0/    0  0] TELN: {"enable":1,"port":23}
[07:05:44.542][113792/197896 42][    0/    0  0] MDNS: Loading MDNS settings
[07:05:44.555][113792/197416 42][    0/    0  0] MDNS: {"enable":1}
[07:05:44.567][113792/197896 42][    0/    0  0] HTTP: Loading HTTP settings
[07:05:44.580][113792/197416 42][    0/    0  0] HTTP: {"enable":true,"port":80,"user":"","pass":"********"}
[07:05:44.595][113792/197896 42][    0/    0  0] GPIO: Loading GPIO settings
[07:05:44.608][113792/197416 42][    0/    0  0] CONF: {"config":[0,0,0,0,0,0,0,0]}
[07:05:44.621][113792/197896 42][    0/    0  0] CONF: Settings loaded
[07:05:44.633][113792/199444 42][    0/    0  0] MSGR: Starting...
[07:05:44.645][113792/199444 42][    0/    0  0] MSGR: Started
[07:05:44.656][113792/199444 42][    0/    0  0] TFT : Starting...
[07:05:44.940][113792/199312 42][    0/    0  0] TFT : Rotation   : 1
[07:05:44.952][113792/199312 42][    0/    0  0] TFT : Invert Disp: Yes
[07:05:44.998][113792/199312 42][    0/    0  0] TFT : TFT_eSPI   : v2.3.70
[07:05:45.010][113792/199312 42][    0/    0  0] TFT : Transactns : Yes
[07:05:45.022][113792/199312 42][    0/    0  0] TFT : Interface  : SPI
[07:05:45.034][113792/199312 42][    0/    0  0] TFT : Driver     : ILI9341
[07:05:45.047][113792/199312 42][    0/    0  0] TFT : Resolution : 240x320
[07:05:45.060][113792/199312 42][    0/    0  0] TFT : MOSI       : 23 (GPIO 23)
[07:05:45.073][113792/199312 42][    0/    0  0] TFT : MISO       : 38 (GPIO 38)
[07:05:45.086][113792/199312 42][    0/    0  0] TFT : SCLK       : 18 (GPIO 18)
[07:05:45.099][113792/199312 42][    0/    0  0] TFT : TFT_CS     : 5 (GPIO 05)
[07:05:45.111][113792/199312 42][    0/    0  0] TFT : TFT_DC     : 15 (GPIO 15)
[07:05:45.124][113792/199312 42][    0/    0  0] TFT : Display SPI freq. : 60.0 MHz
[07:05:45.138][113792/199312 42][    0/    0  0] TFT : Started
[07:05:45.150][113792/166528 31][    0/    0  0] LVGL: Starting...
[07:05:45.169][113792/166528 31][46660/46996  1] LVGL: Version    : 7.11.0
[07:05:45.183][113792/166528 31][46260/46284  1] LVGL: Filesystem : Enabled
[07:05:45.202][113792/165628 31][46176/46196  1] HASP: TEST Opening config.json OK
[07:05:45.215][113792/166528 31][45420/45484  1] GUI : DMA        : Disabled
[07:05:45.228][113792/166528 31][45420/45484  1] GUI : Backlight  : Pin not set
[07:05:45.241][113792/166528 31][45420/45484  1] LVGL: MEM size   : 49152
[07:05:45.253][113792/166528 31][45420/45484  1] LVGL: VFB size   : 32768
[07:05:45.265][113792/166528 31][45304/45332  1] DRVR: Touch SDA     : 21
[07:05:45.278][113792/166528 31][45304/45332  1] DRVR: Touch SCL     : 22
[07:05:45.290][113792/166528 31][45304/45332  1] DRVR: Touch freq.   : 400000
[07:05:45.303][113792/166528 31][45304/45332  1] DRVR: Touch address : 38
[07:05:45.926][113792/166480 31][45304/45332  1] DRVR: Scanning I2C...
[07:05:45.944][113792/166480 31][45304/45332  1] DRVR:     *  Found device 0x34
[07:05:45.957][113792/166480 31][45304/45332  1] DRVR:     *  Found device 0x38
[07:05:45.972][113792/166480 31][45304/45332  1] DRVR:     *  Found device 0x51
[07:05:45.987][113792/166480 31][45304/45332  1] DRVR:     *  Found device 0x68
[07:05:46.002][113792/166480 31][45304/45332  1] DRVR: Scan complete
fake-name commented 2 years ago

Ok, this seems to be a dupe of https://github.com/HASwitchPlate/openHASP/issues/150, but I literally just installed from https://github.com/HASwitchPlate/openHASP/releases/tag/v0.6.2 (which was released 6 months after that issue).

Either the problem occurs in multiple places, or something didn't get merged?

fake-name commented 2 years ago

Setting the domain via serial (mqtthost <xxxx>) also results in the truncation.

fake-name commented 2 years ago

Pulling the source from the 0.6.2 release page:

char mqttServer[16]   = MQTT_HOST;
char mqttUser[23]     = MQTT_USER;
char mqttPassword[32] = MQTT_PASSW;
// char mqttNodeName[16]  = MQTT_NODENAME;
char mqttGroupName[16] = MQTT_GROUPNAME;
uint16_t mqttPort      = MQTT_PORT;
PubSubClient mqttClient(mqttNetworkClient);

So somehow #150 didn't make it into 0.6.2.

What happened?

fake-name commented 2 years ago

Ok, grabbing a current release from CI (https://github.com/HASwitchPlate/openHASP/actions/runs/1834150765) fixes the issue.

Maybe cut a new release?

fvanroie commented 2 years ago

This will be fixed (again) in the next release.