washcroft / HttpGarageDoorController

A project for an Arduino based WiFi-enabled controller, IoT/M2M enabling an ordinary garage door operator.
MIT License
11 stars 4 forks source link

Light input? #8

Open mattiasclaesson opened 6 years ago

mattiasclaesson commented 6 years ago

Hi,

In the example schematics, the light input 12V DC is that from the built in door opener lamp?

The light output is that intended to control the same door opener lamp?

Is it possible to remove the light icon and functionality from being displayed in the homekit so that it is not visible in the app?

washcroft commented 6 years ago

In the example schematics, the light input 12V DC is that from the built in door opener lamp?

Yes, it just taps onto the opener's own light (LED in my case - it drives an opto isolator, which provides an isolated input to the Arduino).

The light output is that intended to control the same door opener lamp?

No, it's intended to connect to a relay to switch on all your main/primary lights in the garage. With the above input, this means the opener turns all your main lights in the garage whenever it switches on its own light (i.e. when the door is opening/closing).

Is it possible to remove the light icon and functionality from being displayed in the homekit so that it is not visible in the app?

Yes, by not configuring the light related config fields.

mattiasclaesson commented 6 years ago

Ok, I guess its not able to know if the main/primary lights is on or off then.

I did try to remove the "lightName" but ended up with a exception:

` /usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/index.js:642
this.garageLightCurrentState.setValue(this._lightCurrentState);
^

TypeError: Cannot read property 'setValue' of undefined
at HttpGarageDoorControllerAccessory._setLightCurrentState (/usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/index.js:642:32)
at /usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/index.js:482:13
at /usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/index.js:552:4
at Request._callback (/usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/index.js:831:5)
at Request.self.callback (/usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/node_modules/request/request.js:186:22)
at Request.emit (events.js:159:13)
at Request. (/usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/node_modules/request/request.js:1163:10)
at Request.emit (events.js:159:13)
at IncomingMessage. (/usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:254:19) `

Maybe there was more to remove then?

rjblake commented 6 years ago

I'm guessing Warren meant not configuring these (in config.h): const uint8_t LIGHT_OUTPUT_PIN = 2; const uint8_t LIGHT_INPUT_PIN = 1;

I'm looking to install this for my setup on an ESP8266, however have a 2x relay board setup (1x for Garage Door, 1x for Lights). Rather than re-cable my opener, would be great if I could control the 2x relays separately (also e.g. if you have 2x garage doors), and use the automation in the Home app to turn on/off the lights depending on state of door. Guess I need to dig into the code (looks great btw and really like the security aspects). I'm also using Domoticz, so hoping the Homebridge/MQTT will keep state in synch

washcroft commented 6 years ago

I assumed @mattiasclaesson was referring to the accompanying HomeBridge plugin for this, in there you can avoid setting the lightname configuration field and it wont expose a light accessory in HomeKit.

@mattiasclaesson, the "setValue" exception you mentioned is fixed in the latest version of that project: https://github.com/washcroft/homebridge-http-garagedoorcontroller/issues/8

There is nothing in this project to specifically remove the light related functionality, but simply assign unused pins to the light config and nothing will ever happen.

washcroft commented 6 years ago

@rjblake

Rather than re-cable my opener, would be great if I could control the 2x relays separately (also e.g. if you have 2x garage doors)

Currently the project activates two relays, one for your garage door opener button, the other to close/switch a lighting circuit. Are you suggesting an option to replace the light relay with another garage door opener button, for a second garage door? How would you then control the garage light, some other automation/smart bulb system?

It may be a good idea to simply support multiple lights/doors in this project, i.e. as many as GPIO pins you have avaiaible! The API spec would need to change to accomodate "which" door/light being controlled in the request.

rjblake commented 6 years ago

Currently the project activates two relays, one for your garage door opener button, the other to close/switch a lighting circuit. Are you suggesting an option to replace the light relay with another garage door opener button, for a second garage door? How would you then control the garage light, some other automation/smart bulb system? The 'Light Input' on your circuit has me confused - assumed that it uses this input to determine whether to turn on or off. I would not have this input, but just the lighting wired up to the 2nd relay and connected to a GPIO. On/Off for light could either be controlled separately, or made to follow the door status. In the case of the Hormann Supramatic opener, the built in light can be controlled separately, and is also on a timer.

washcroft commented 6 years ago

Most garage door openers have a built in light, usually this is a small LED and not very bright. By using this as an "input" to the controller, you can have the controller automatically operate the light "output" to switch more lighting on and off (i.e. all your main garage lighting) at the same time as the opener operates its own built in light (normally when it is opening or closing the door).

This input is more of a convenience, it can be triggered by whatever you like (caution: with the correct circuitry), however you can achieve the same with software automation rules (i.e. when garage door opening, operate garage light).

On mine, I have this wired up to my openers built in LED light (via an optoisolator) - so I don't need to worry about automation rules to ensure all my garage lighting comes on when the garage door is operated. My opener lighting is also useful as the source for the input, because it has built in delays (i.e. stays on several minutes after the door has finished opening/closing) and can be controlled independently via the original RF fob.

rjblake commented 6 years ago

Understand. My opener has a 12V 20W GU5.3 and has a built in timer (up to 15mins). Rather than rely on this, I'll have a look at what I need to adjust in the code to rely solely on the GPIO to turn on/off the light

washcroft commented 6 years ago

There's nothing you need to adjust in the code, set the light input pin to a pin you're not using (ensure it's a pin pulled down by the chip) and then the only way your light output pin will trigger is when requested via the API.

mattiasclaesson commented 6 years ago

Hi,

Are you sure its released in 2.0.1?

Because I get the same issue still: /usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/index.js:642
this.garageLightCurrentState.setValue(this._lightCurrentState);
^

TypeError: Cannot read property 'setValue' of undefined
at HttpGarageDoorControllerAccessory._setLightCurrentState (/usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/index.js:642:32)


Loading 2 accessories...
[2018-3-16 22:00:52] [Dörr] Initializing HttpGarageDoorController accessory...
[2018-3-16 22:00:52] [Dörr] Starting HttpGarageDoorControllerAccessory v2.0.1
[2018-3-16 22:00:52] [Dörr] INITIAL Garage Door state is: CLOSED
[2018-3-16 22:00:52] [Dörr] INITIAL Garage Door target state is: CLOSED

Or do I need to do something more to get the new version loaded?

/Mattias

washcroft commented 6 years ago

@mattiasclaesson Yes, but maybe this is a different issue... Can you share your homebridge config for the plugin (masking any sensitive info) and share a typical response from your garage door controller for the door state check (if not using the accompanying Arduino project).

mattiasclaesson commented 6 years ago

@washcroft Maybe its homekit that has a light configured from before, so it asks homebridge? I guess I should remove it from the homebridge accessories from that side first, right?

The callstack seem to indictate that there is a request for outside.

/M

TypeError: Cannot read property 'setValue' of undefined
at HttpGarageDoorControllerAccessory._setLightCurrentState (/usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/index.js:642:3 2)
at /usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/index.js:482:13
at /usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/index.js:552:4
at Request._callback (/usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/index.js:831:5)
at Request.self.callback (/usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/node_modules/request/request.js:186:22)
at Request.emit (events.js:159:13)
at Request. (/usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/node_modules/request/request.js:1163:10)
at Request.emit (events.js:159:13)
at IncomingMessage. (/usr/local/lib/node_modules/homebridge-http-garagedoorcontroller/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:254:19)