Closed thexperiments closed 7 years ago
It doesn't and never did. It just reacts to events sent from either HomeKit or pimatic. Which plugin do you use to switch and dim your lights? Please don't say pimatic-hap, I mean the plugin which adds the devices to pimatic ;-).
Oh, and about flickering: I'm currently investigating this, it happened to me, most times when I switched my homeduino lights using the original remote really fast from on to off. I think it's a racing condition here.
This is related to my issue posted earlier. I also have this behaviour with some of my homeduino switches. Onnis activated by a contact switch and sometimes start oscillating on off on off etc reboot is the only way. Also here I think to fast switching of homeduino and hap is in counter phase
Dimming lights is happening via hue-zll plugin and there are rules which react on "recieves on" from the pimatic-homeduino but they don't explicitly change the dimlevel. I however have some buttons devices which change the dimlevel via rules.
For the Kitchen light which flickered I use pimatic-zway and this light is only triggered by a pimatic-mysensors PIR motion sensor.
I had some flickering with my entrance lights some time ago which are using my orvibo-plugin and a pimatic-mysensors PIR motion sensor.
So my educated guess is: Flickering --> Maybe some general problem with how rules are evaluated or plugins are feeding back the device state. Turning hues on when starting pimatic --> Issue with pimatic HAP as this doesn't happen anymore as soon as I disable the pimatic-hap plugin.
Flickering is also discussed in #39. -> i have a feeling what the problem is and I'm on it Turning on the hues when starting is pretty complicated when just looking at the code of the pimatic-hue-zll plugin. This might be related to https://github.com/markbergsma/pimatic-hue-zll/blob/master/hue-zll.coffee#L266, but i can't verify this
I have seen same issue related to homeduino mentioned here: https://github.com/dgmltn/android-pimatic-app/issues/35 (no replies to it)
@michbeck100 I think I can now confirm that the flickering is a general problem had it today with pimatic-mysensors switch when "identifying" the device via homekit which initiates a quick toggle of the switch.
Yes, I will probably remove the identification code for switches and lights. Was just a gimmick anyway.
I think in general it is very good for usability but it should only be active for lights and the interval should be a bit longer. For example it toggled my door opener and some sockets for appliances when going through homekit setup.
Since iOS 10 the devices are called to identify during the homekit setup. This wasn't the case before iOS 10. Now it's pretty annoying.
Please checkout https://github.com/michbeck100/pimatic-hap/tree/request_queue and test if the issue is resolved for you.
FYI: I left the identification code as it was. I think a switch also should be able to identify itself by switching.
did you test the branch in https://github.com/michbeck100/pimatic-hap/tree/request_queue? the flickering should be fixed with the changes.
doesn't help :( just restarted with it and had to kill pimatic as one of my hues would not stop flickering
maybe a patch for the huezll plugin is needed?
19:28:18.681 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:18.716 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:18.749 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:18.783 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:18.815 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:18.846 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:18.878 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:18.909 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:18.940 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:18.972 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:19.003 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:19.036 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:19.102 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:19.144 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:19.190 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:19.232 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:19.274 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:19.309 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:19.344 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:19.411 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:19.445 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:19.478 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:19.512 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:19.546 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:19.583 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:19.618 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:19.654 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:19.695 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:19.732 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:19.768 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
19:28:19.807 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to true
19:28:19.844 [pimatic-hap] debug: switching device Indirekt Wohnzimmer 2 to false
fixes the problems for me not noticed side effects yet.
I found out that at the moment the plugin tries to determine if it should switch the state @_state was null and it was only written in the constructor at this point in time. I think it is legit to get the device state on every new set which comes in from homekit and use this for evaluation. In addition to that I think there can be the case that a device still was not yet able to update its internal state if a "set" comes from homekit. We should not switch a device in this state and thus I added a null check.
I don't see why your change helps. I would say it must be of no interest if the state of the device is still null. What if you change the state from pimatic itself. Then it works, too. Additionally, because not all plugins set the state of the device correct, pimatic-hap saves its own state. So even if a device always has a null state, there should be no infinite loop.
I have to admit I need to debug it again. What you are saying sounds correct but doing the changes I did was totally obvious when I was doing them. Sadly I will not be home for some time now.
Maybe the changes I made maybe only mask the real problem.
When I was debugging the function for switching the hues was called with ON before the hues were even initialized. They were clearly off before restarting pimatic and also displayed like that in homekit.
It then looked like an endless loop...
Maybe I get the chance to get hold of some hues here the next days and supply more info.
Nevertheless, my fix/workaround has been working great with my system.
Did you have the time to debug some more? I still don't see why your changes make any difference. Are you using hue lamps? And the hue-zll plugin? I will see if there might be an issue with their implementation regarding the order of switching and state saving.
With https://github.com/michbeck100/pimatic-hap/commit/a076a592a492bdd34caa28f07fd520daab7d34a6 i've done some changes, that will hopefully fix the infinite loops. Please test and reopen this issue if it doesn't help. The original problem (that the lights are switched on at startup) might be fixed by https://github.com/markbergsma/pimatic-hue-zll/issues/15
Hi, for some time now my hues were turned on when I restarted pimatic. I now found out that this doesn't happen when I disable the hap plugin. Today it even startet toggeling my Kitchen light like crazy when I restarted.
Turning on the hue in my bedroom
and the others also (It is setting them to false but I think changing the dimlevel causes them to turn on)
Why is it changing something in the startup state? I would guess the first thing the plugin should do after startup is to communicate the current states to homekit.