1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-14 17:22:20 +01:00

handle bad pin schemas (#7711)

Co-authored-by: Samuel Sieb <samuel@sieb.net>
This commit is contained in:
Samuel Sieb
2024-11-01 02:54:34 -07:00
committed by GitHub
parent cefbfb75bd
commit 77bb46ff3b
5 changed files with 25 additions and 15 deletions

View File

@@ -67,8 +67,10 @@ def _translate_pin(value):
"This variable only supports pin numbers, not full pin schemas "
"(with inverted and mode)."
)
if isinstance(value, int):
if isinstance(value, int) and not isinstance(value, bool):
return value
if not isinstance(value, str):
raise cv.Invalid(f"Invalid pin number: {value}")
try:
return int(value)
except ValueError: