rsg98 / homebridge-gpio-wpi2

Homebridge Raspberry Pi GPIO Platform (API 2) Plugin - using WiringPi as a backend
48 stars 16 forks source link

Inver read logic #14

Closed varna33 closed 7 years ago

varna33 commented 7 years ago

Is there a setting that would allow to invert also read? Instead of putting the GPIO pin on 3.3v to give closed, but to give open status?

Janis

rsg98 commented 7 years ago

Adding "inverted": "true" should work for read as well. Make sure that you have "overrideCache" set to true as well, so that this setting is read from your config file rather than the cache.

Depending on how you've wired up the sensor, you might need to set "pull": "up" or "pull": "down" (down sets active_low, up sets active_high - see https://wiki.openwrt.org/doc/hardware/port.gpio for example circuits)

varna33 commented 7 years ago

Thank you, with resistor circuit it works perfect! I though it would be possible simply to put 3.3V on pin and it would work too.

Janis