sensorReporter
sensorReporter copied to clipboard
Btn_Pressed_State not optional when PUD is DOWN
The advanced parameter for GPIO Sensor Btn_Pressed_State is not optional when PUD is set to DOWN.
I'd expect Btn_Pressed_State
to be optional regardless of the configuration of PUD
The default value for PUD
is DOWN
(line 95):
pud = GPIO.PUD_UP if dev_cfg["PUD"] == "UP" else GPIO.PUD_DOWN
so it shouldn't make a difference if it is configured to DOWN
or not present in the config.
Is there a runtime exception when configured as you describe?
I looked into this with my test system. I found 2 runtime exceptions:
-
AttributeError: 'RpiGpioSensor' object has no attribute 'pud'
Triggers whenBtn_Pressed_State
is not defined, just as you describe. - Also if
PUD
is not in the config I get aKeyError: 'PUD'
, as I recall PUD should be optional.
I'll fix both with my next PR!