the78mole / esphome_components

ESPhome Components from the little digger
Other
25 stars 11 forks source link

Pulled const strings into to const.py to prevent nasty typos #47

Closed the78mole closed 1 year ago

the78mole commented 1 year ago

I just pulled als constant strings from number.py, sensor.py,... into const.py. This prevents many typos already occured when I implemented the code generation and yaml-verification stuff in python files.

jensgraef commented 1 year ago

Hi @the78mole ! I think it's a very good idea to pull this out into constants. I'm not so happy with the names of the constants being hard to read. Would you mind writing SENSOR instead of SENS and so on? With modern IDEs there's not much more typing overhead in writing ERROR_BURNER_MALFUNCTION vs ERR_BURN_MALF But for helping people understand the code, full words are almost always better than abbreviations. Bytes are cheap ;-)

the78mole commented 1 year ago

You are right, bytes are cheap, but the width of screens is limited... But a few chars more is not a problem... Unfortunately, my VSCODE is not supporting much in refactoring, but I'll do it :-)