HASwitchPlate / openHASP

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

MQTT Settings hostname validation error is unclear regarding what is incorrect in the input #567

Open dekimsey opened 10 months ago

dekimsey commented 10 months ago

Perform all steps below and tick them with [x]

Describe the bug

I am unable to set a valid hostname on the MQTT Settings page. I am using 0.7.0-rc6.

To Reproduce

  1. Navigate to MQTT Settings (/config/mqtt)
  2. Attempt to define an hostname such as "plate-0"
  3. Error appears, "Please match the requested format"

Expected behavior

I'd like to ask a more descriptive message in the pop-up error message and document the character limitations in the docs that way it's more obvious to users what is not correct.

(It took me an embarrassingly long while to figure out what was wrong)

Anyway, thank you for the great project!

Screenshots or video

I dug around and found the pattern="[a-z0-9_]*" being set here.

dekimsey commented 10 months ago

I originally requested to be able to add normal RFC hostnames (permitting hyphens, possibly disallowing underscores). But after I got further along I realized the issue is that this hostname is sort of an entity ID in homeassistant and - isn't valid there! I've edited this request to reflect that.

Though I do wish I could use normal hostnames and just have invalid characters converted to an underscore for an entity id. I understand that may not be appropriate. Thank you!