rudders / homebridge-http

HTTP Plugin for Homebridge
Apache License 2.0
178 stars 110 forks source link

Too many requests #53

Open TonyFeestneus opened 7 years ago

TonyFeestneus commented 7 years ago

I am running this on a Raspberry Pi 2, clean install combined with Nginx and some simple php files.

I have 1 switch with brightness, when you scroll through the brightness an unbelievable amount of requests is generated. I have a PHP file set up to write the brightness to a .txt file (since MySQL couldn't keep up), but even this can't cope. I am just reading the .txt file with tail -f, but it stops working FAST...

Do you have these issues too?

NovaGL commented 7 years ago

Maybe you are running in debug mode or using realtime. Since I am not a great coder, realtime really just polls every second and then updates status if changed. I use PHP and have no problems with mine. Why do you need to write to a txt file I just poll the php direct.

TonyFeestneus commented 7 years ago

I just poll the php direct as well, but need something to remember the current value to give back to the brightness setting. It is far more than every second when you scroll through the brightness, more like 100x per second which chokes up the Pi...

sidebar: what do you actuate with your php file and how do you get status?

NovaGL commented 7 years ago

Why do you need to remember the brightness value if you are just going to poll it again. Maybe don't use realtime polling, that's really just for motion sensors.

I use mine to poll things like sonos volume and if tv is on or off. I used to use it for motion sensors but dont have any at my current place.

TonyFeestneus commented 7 years ago

I have devices which I can control in multiple ways, not only through homekit. Also, the status is not pollable in the device itself, so I must save it somewhere else...

TonyFeestneus commented 7 years ago

So, I am using devices without saving status, which works, but dimmable devices need a brightness status or else Homekit will say they do not respond. They do work though and I am able to set them at any brightness, but after that it just displays as On in stead of 45% for example...

Any fix for this? Can you make HomebridgeHTTP so that brightness does not need status?

NovaGL commented 7 years ago

Not possible, it's a homekit thing not a homebridge thing. I also can't make changes that might break other people's installations. What lights do you have that won't tell you their brightness?

TonyFeestneus commented 7 years ago

Zwave... I'm struggling with polling them through open zwave.

But also 433mhz can't tell you the brightness... I have some Hue which do of course.

NovaGL commented 7 years ago

There might be a zwave plugin that might be more appropriate. Unfortunatly we don't have much say in the feedback Siri provides. Sometimes even when everything is correct and the action is performed Siri still says can't contact device.

You can make custom characteristics but then Siri won't work at all if you say set brightness

fredylg commented 7 years ago

I have a similar issue, my setup is ios-->raspberry--> sonoff (running tasmota firmare) but the amount of request to check the status of the device gets it slow that the micro cant respont and goes of.. would be great to have a refreshing rate parameter on the config.json

NovaGL commented 7 years ago

Have you tried not using realtime? Maybe someone who is a better programmer than be can work out the refresh rate for you.

fredylg commented 7 years ago

@NovaGL is there any other options possible to set besides real-time, I tried adding one-minute cache into my php api but for some reason the light goes off randomly...

NovaGL commented 7 years ago

If realtime is off. It only polls when the app is opened.

Try changing line 59, interval and see if that resolves anything

}, { longpolling: true, interval: 300, longpollEventName: "statuspoll" });