Skip to content

Commit d20994c

Browse files
committed
Fix KeyError for gpiozero digital_outputs flyte#414
1 parent 678276f commit d20994c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: mqtt_io/modules/gpio/gpiozero.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,12 @@ def set_pin(self, pin: PinType, value: bool) -> None:
8282
self._out_pins[pin].off()
8383

8484
def get_pin(self, pin: PinType) -> bool:
85-
return cast(bool, self._in_pins[pin].is_active)
85+
if pin in self._in_pins:
86+
return cast(bool, self._in_pins[pin].is_active)
87+
elif pin in self._out_pins:
88+
return bool(self._out_pins[pin].value)
89+
else:
90+
raise ValueError(f"Pin {pin} not found")
8691

8792
def setup_interrupt_callback(
8893
self,

0 commit comments

Comments
 (0)