myhomeiot / esphome-components

A collection of my ESPHome components
Other
257 stars 25 forks source link

Sanitize data from Home Assistant #13

Open BrianAker opened 2 years ago

BrianAker commented 2 years ago

These changes sanitize the data being exported from Home Assistant to the esp32. There is still a need to sanitize the data on the esp32 side as well, but these changes will fix the import data issues.

myhomeiot commented 2 years ago

Thanks for PR! I my case it's was possible to add few devices at once, just specify few MACs in a row. Here validation will allow to specify only one device MAC, do you think it's will be better?

BrianAker commented 2 years ago

For the most part, I just allow my setup to discover devices. In the few cases where I found a need to add addresses, I added them one at a time. It would certainly be possible to come up with a list format as well, though that is not something I thought of. I just wanted bad data out of the system, and some validation on what was being passed in. The nice thing about validation as well is that for someone who is knew to this, they get an idea of what sort of value that the text box takes. FWIW I think that once the device has been added, I think the value should go back to being blank.