Fix pin/component switchup in SX1509 pin configuration (#2593)

This commit is contained in:
Oxan van Leeuwen 2021-10-21 19:55:19 +02:00 committed by GitHub
parent 8735d3b83e
commit c0fc5b48ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View File

@ -80,8 +80,8 @@ def validate_mode(value):
CONF_SX1509 = "sx1509" CONF_SX1509 = "sx1509"
SX1509_PIN_SCHEMA = cv.All( SX1509_PIN_SCHEMA = cv.All(
{ {
cv.GenerateID(): cv.declare_id(SX1509Component), cv.GenerateID(): cv.declare_id(SX1509GPIOPin),
cv.Required(CONF_SX1509): cv.use_id(SX1509GPIOPin), cv.Required(CONF_SX1509): cv.use_id(SX1509Component),
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=15), cv.Required(CONF_NUMBER): cv.int_range(min=0, max=15),
cv.Optional(CONF_MODE, default={}): cv.All( cv.Optional(CONF_MODE, default={}): cv.All(
{ {

View File

@ -358,6 +358,7 @@ template<typename T> T clamp(const T val, const T min, const T max) {
return max; return max;
return val; return val;
} }
template uint8_t clamp(uint8_t, uint8_t, uint8_t);
template float clamp(float, float, float); template float clamp(float, float, float);
template int clamp(int, int, int); template int clamp(int, int, int);

View File

@ -59,6 +59,10 @@ tuya:
pipsolar: pipsolar:
id: inverter0 id: inverter0
sx1509:
- id: sx1509_hub
address: 0x3E
sensor: sensor:
- platform: homeassistant - platform: homeassistant
entity_id: sensor.hello_world entity_id: sensor.hello_world
@ -209,6 +213,7 @@ sensor:
- or: - or:
- throttle: "20min" - throttle: "20min"
- delta: 0.02 - delta: 0.02
# #
# platform sensor.apds9960 requires component apds9960 # platform sensor.apds9960 requires component apds9960
# #
@ -308,6 +313,11 @@ binary_sensor:
y_max: 212 y_max: 212
on_state: on_state:
- lambda: 'ESP_LOGI("main", "key0: %s", (x ? "touch" : "release"));' - lambda: 'ESP_LOGI("main", "key0: %s", (x ? "touch" : "release"));'
- platform: gpio
name: GPIO SX1509 test
pin:
sx1509: sx1509_hub
number: 3
climate: climate:
- platform: tuya - platform: tuya