dubocr / homebridge-gpio-device

Homebridge GPIO device expose several HomeKit accessories interacting with GPIO
Apache License 2.0
65 stars 22 forks source link

spam in logs #68

Open Partizan7676 opened 5 years ago

Partizan7676 commented 5 years ago

i got that - a lot of messages in log [2019-7-19 11:57:42] [Garage] sensorPin[29] switch to 1 => nothing to do (unknown pin or no state change) [2019-7-19 11:57:43] [Garage] sensorPin[29] switch to 1 => nothing to do (unknown pin or no state change) [2019-7-19 11:57:43] [Garage] sensorPin[29] switch to 1 => nothing to do (unknown pin or no state change) [2019-7-19 11:57:44] [Garage] sensorPin[29] switch to 1 => nothing to do (unknown pin or no state change) [2019-7-19 11:57:44] [Garage] sensorPin[29] switch to 1 => nothing to do (unknown pin or no state change) [2019-7-19 11:57:45] [Garage] sensorPin[29] switch to 1 => nothing to do (unknown pin or no state change) [2019-7-19 11:57:45] [Garage] sensorPin[29] switch to 1 => nothing to do (unknown pin or no state change) [2019-7-19 11:57:46] [Garage] sensorPin[29] switch to 1 => nothing to do (unknown pin or no state change) [2019-7-19 11:57:46] [Garage] sensorPin[29] switch to 1 => nothing to do (unknown pin or no state change) [2019-7-19 11:57:47] [Garage] sensorPin[29] switch to 1 => nothing to do (unknown pin or no state change) [2019-7-19 11:57:47] [Garage] sensorPin[29] switch to 1 => nothing to do (unknown pin or no state change) [2019-7-19 11:57:48] [Garage] openSensorPin[29] switch to 0 (active) => door opened [2019-7-19 11:57:49] [Garage] sensorPin[29] switch to 0 => nothing to do (unknown pin or no state change) this occurs when garage door is closing. it has open sensor only and one pin for operating config are: { "accessory": "GPIODevice", "name": "Garage", "type": "GarageDoorOpener", "pin": 28, "inverted": true, "pulseDuration": 1000, "openSensorPin": 29, "openingDuration": 17 },

shanelilley commented 4 years ago

I have the same problem. I've been trouble shooting for weeks and have no answer. On another RPi with the same plugin which controls my front gate I do not have this problem even though I have the same set up - open and close sensor pins and open/close button. I tried messing with the code to lower the time it polls for a state change but it made no difference.

I use this plugin for irrigation, gate and other switches in the house so I'm thinking the problem is just isolated to the GarageDoorOpener only..

shanelilley commented 4 years ago

Hi - I found a couple of ways to rid this constant log update. I had the problem with my garage door that I found the state change detection was too fast. Once in a while I would get a state change (eg opening...closed...whatever) for no reason. There may have been a slight fluctuation in the sensor voltage which triggered a drop/rise, just enough to see it as a door open/close change.

So my first idea was to find where in the code this detection takes place. Its in a line in the GarageDoor constructor code - function GarageDoor(accesory, log, config) { look for - this.unbouncing = config.unbouncing || 500; I could not find any where else in the code where .unbouncing is set, so 500 (milliseconds) is what you'll always get. Thats two log entries per second, which is the "spam" I was getting too.. I have now lowered this detection to every 12 seconds and its great. No more false detections.

If you want to get rid of the log entry completely, simply comment out the following line -

this.log("sensorPin["+pin+"] switch to " + state + " => nothing to do (unknown pin or no state change)");

And restart homebridge... problem solved.

Hope this helps Kind regards, Shane