ankurp/homebridge-pi-thermostat

Invert gpio

Closed this issue · 2 comments

Hi how I can invert gpio state?

You can search online for inverting but the way this homebridge plugin is setup, turning on the relay Pin will turn on the relay switch and it will cause the current to flow between the Red and which ever wire it is connected to.

I had the same problem. Maybe creator used relays that triggered low?

You can invert them by opening index.js file and changing:

let Service, Characteristic, HeatingCoolingStateToRelayPin;
const OFF = true;
const ON = false;

TO:

let Service, Characteristic, HeatingCoolingStateToRelayPin;
const OFF = false;
const ON = true;

AND

gpio.setup(this.fanRelayPin, gpio.DIR_HIGH);
gpio.setup(this.heatRelayPin, gpio.DIR_HIGH);
gpio.setup(this.coolRelayPin, gpio.DIR_HIGH);

TO:

gpio.setup(this.fanRelayPin, gpio.DIR_LOW);
gpio.setup(this.heatRelayPin, gpio.DIR_LOW);
gpio.setup(this.coolRelayPin, gpio.DIR_LOW);