fix pin range for xl9535 (#5722)

Co-authored-by: Samuel Sieb <samuel@sieb.net>
This commit is contained in:
Samuel Sieb 2023-11-09 17:53:35 -08:00 committed by GitHub
parent 01d28ce3fc
commit 98ec798bfc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -43,11 +43,17 @@ def validate_mode(mode):
return mode return mode
def validate_pin(pin):
if pin in (8, 9):
raise cv.Invalid(f"pin {pin} doesn't exist")
return pin
XL9535_PIN_SCHEMA = cv.All( XL9535_PIN_SCHEMA = cv.All(
{ {
cv.GenerateID(): cv.declare_id(XL9535GPIOPin), cv.GenerateID(): cv.declare_id(XL9535GPIOPin),
cv.Required(CONF_XL9535): cv.use_id(XL9535Component), cv.Required(CONF_XL9535): cv.use_id(XL9535Component),
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=15), cv.Required(CONF_NUMBER): cv.All(cv.int_range(min=0, max=17), validate_pin),
cv.Optional(CONF_MODE, default={}): cv.All( cv.Optional(CONF_MODE, default={}): cv.All(
{ {
cv.Optional(CONF_INPUT, default=False): cv.boolean, cv.Optional(CONF_INPUT, default=False): cv.boolean,

View file

@ -425,6 +425,15 @@ binary_sensor:
input: true input: true
inverted: false inverted: false
- platform: gpio
name: XL9535 Pin 17
pin:
xl9535: xl9535_hub
number: 17
mode:
input: true
inverted: false
climate: climate:
- platform: tuya - platform: tuya
id: tuya_climate id: tuya_climate