michbeck100 / pimatic-hap

Pimatic homekit bridge
GNU General Public License v2.0
30 stars 10 forks source link

ShellSwitch executes twice & Sliding back dimmers #37

Closed thymian closed 8 years ago

thymian commented 8 years ago

sadly i have two other issues with the pimatic-hap plugin:

1) Shell Switch executes twice If hap is activated the command of my ShellSwitch always gets activated (and deactivated) twice. If hap is deactivated everything works as it should and even the same command with a DummySwitch combined with a rule works without problem if hap is activated.

The log does only show one state change (not explaining the two executions):

09:42:40 debug [pimatic-hap]: switching device to true 09:42:39 debug [pimatic-hap]: switching device to false

there was someone with the same issue: pimatic/issue#792

2) Sliding back dimmers Similar to this hap issue#25 the dimmer of my led-device keeps on sliding to 100% brightness whenever i click on a color. And as 100% Brightness is plain white thats pretty bad. Same as above: doesn't occur when deactivating hap, no special info in the log Video with log

Note: in the beginning at 10 sec mark you can see the other Issue i have: pimatic-hap/issue#36

In some threads i saw you talking about sliding back dimmers and double execution, but they didnt have a specific fix. I'm a github beginner, but i saw that v0.9.x branch is "5 commits ahead, 11 commits behind master." Maybe some of the fixes didnt made it to 0.9 branch?!

rspaargaren commented 8 years ago

Last week I have reactivated the pimatic hap plugin as I really like the benefits. I also had problems with sliding back dimmers. But this is now solved as it was a bug in the homeduino plugin... Now after activating the hap plugin I have some resonating devices which might be related to the same cause? I have had it with my dimmers they keep changing value and there is no way to stop them then to restart pimatic and with a contact control. Keeps switching on and off. Here is a quick copy of a part of the log file. (The value of dimming is 33 to 34 to 33 to 34) and so on.

So again the cause could be in either the homeduino or the hap plugin or the combination of both....

The behaviour is unfortunately not consistent. So I do not have a way to repeat. It just happens.

2:35:14.712 [pimatic-hap] debug: changing dimlevel of Lamp B$ 22:35:14.722 [pimatic-homeduino] debug: Sending Protocol: dim$ 22:35:14.773 [pimatic-homeduino] debug: data: "RF receive 293$ 22:35:14.783 [pimatic-homeduino] debug: received: [ 293, 1297$ 22:35:14.801 [pimatic-homeduino] debug: dimmer1: { id: 13371$ 22:35:14.812 [pimatic-hap] debug: changing dimlevel of Lamp B$ 22:35:14.820 [pimatic-homeduino] debug: Sending Protocol: dim$ 22:35:15.366 [pimatic-homeduino] debug: data: "ACK" 22:35:15.394 [pimatic-homeduino] debug: data: "RF receive 292$ 22:35:15.407 [pimatic-homeduino] debug: received: [ 292, 1297$ 22:35:15.425 [pimatic-homeduino] debug: dimmer1: { id: 13371$ 22:35:16.045 [pimatic-homeduino] debug: data: "ACK" 22:35:16.070 [pimatic-hap] debug: changing dimlevel of Lamp B$ 22:35:16.079 [pimatic-homeduino] debug: Sending Protocol: dim$ 22:35:16.126 [pimatic-homeduino] debug: data: "RF receive 292$ 22:35:16.136 [pimatic-homeduino] debug: received: [ 292, 1297$ 22:35:16.153 [pimatic-homeduino] debug: dimmer1: { id: 13371$ 22:35:16.163 [pimatic-hap] debug: changing dimlevel of Lamp B$ 22:35:16.171 [pimatic-homeduino] debug: Sending Protocol: dim$ 22:35:16.723 [pimatic-homeduino] debug: data: "ACK" 22:35:16.752 [pimatic-homeduino] debug: data: "RF receive 292$ 22:35:16.765 [pimatic-homeduino] debug: received: [ 292, 1297$ 22:35:16.782 [pimatic-homeduino] debug: dimmer1: { id: 13371$ 22:35:17.404 [pimatic-homeduino] debug: data: "ACK" 22:35:17.431 [pimatic-hap] debug: changing dimlevel of Lamp B$ 22:35:17.441 [pimatic-homeduino] debug: Sending Protocol: dim$ 22:35:17.498 [pimatic-homeduino] debug: data: "RF receive 292$ 22:35:17.510 [pimatic-homeduino] debug: received: [ 292, 1298$ 22:35:17.528 [pimatic-homeduino] debug: dimmer1: { id: 13371$ 22:35:17.540 [pimatic-hap] debug: changing dimlevel of Lamp B$ 22:35:17.548 [pimatic-homeduino] debug: Sending Protocol: dim$ 22:35:18.084 [pimatic-homeduino] debug: data: "ACK" 22:35:18.112 [pimatic-homeduino] debug: data: "RF receive 292$ 22:35:18.125 [pimatic-homeduino] debug: received: [ 292, 1297$ 22:35:18.143 [pimatic-homeduino] debug: dimmer1: { id: 13371$ 22:35:18.763 [pimatic-homeduino] debug: data: "ACK" 22:35:18.791 [pimatic-hap] debug: changing dimlevel of Lamp B$ 22:35:18.800 [pimatic-homeduino] debug: Sending Protocol: dim$ 22:35:18.849 [pimatic-homeduino] debug: data: "RF receive 292$ 22:35:18.860 [pimatic-homeduino] debug: received: [ 292, 1297$ 22:35:18.877 [pimatic-homeduino] debug: dimmer1: { id: 13371$ 22:35:18.887 [pimatic-hap] debug: changing dimlevel of Lamp B$ 22:35:18.895 [pimatic-homeduino] debug: Sending Protocol: dim$

michbeck100 commented 8 years ago

I'm missing a bit of the log statement that pimatic-hap produces when switching. Actually it should be something like

22:35:17.431 [pimatic-hap] debug: changing dimlevel of Lamp B$ to 34

So the value at the end of the log statement is missing.

Are you using the most current release version of pimatic hap and all other plugins?

thymian commented 8 years ago

i dont think its homeduino, because i just deactivated homeduino and dimmer is still sliding + shellswitch still executes twice. pimatic+homeduino are up to date. Update section only tells me "Found update for pimatic-hap: current version is 0.6.3, latest version is: 0.7.0" but i just downloaded the lastes hap with

git clone https://github.com/michbeck100/pimatic-hap.git --branch v0.9.x cd pimatic-hap npm install

michbeck100 commented 8 years ago

then please do this again because i just merged master into v0.9.x. And delete the pimatic-hap/node-modules before nam install, just to be sure.

When this happens, do you change the dim level via HomeKit or within pimatic in the first place?

rspaargaren commented 8 years ago

This afternoon I will post a more complete logfile. Now I can only acces via my phone and that is limited in copy paste. At the moment all my plugins are up to date. I already had this behaviour a couple of months ago as well. Then for a while I did not have but I was not running hap plugin. Since I reactivate the behaviour is there again. I suspect, it might have something to do with response time of the network / homeduino / hap. Or with rounding values.

michbeck100 commented 8 years ago

I might be able to get a better response time within the homekit framework by returning before anything was switched. This way i would get an immediate response in the homekit app, but the light is switching a little bit later or maybe not at all. But i think this is no problem since the RF switches from homeduino also work with "fire and forget".

rspaargaren commented 8 years ago

The RF device are indeed fire with automatic gun and forget the result. This time but I can not recollect for other cases the trigger was an input from my-sensor. I will try to find that part in the log file.

thymian commented 8 years ago

thanks for the very fast support!

now pimatic and every plugin is up to date but problem is still there. i even deleted database and reset HomeKit prefs.

debug still does only report about the color i want to set, not about the color which is triggered directly after i release the mouse/thumb:

16:02:28 [pimatic-hap]: [Pimatic HomeKit Bridge] Setting Characteristic "Hue" to value 20
16:02:28 debug [pimatic-hap]: [Pimatic HomeKit Bridge] Setting Characteristic "Saturation" to value 95
16:02:28 debug [pimatic-hap]: [Pimatic HomeKit Bridge] Processing characteristic set: [{"aid":5,"iid":17,"value":95},{"aid":5,"iid":16,"value":20}]
16:02:28 debug [pimatic-hap]: [fa:fe:db:e4:36:2c] HAP Request: PUT /characteristics

the hap plugin sets Hue and Saturation to 0 (but doesnt debug-log it) in most of the cases i press somewhere on the color picker -WebGui or HomeKit App- as one can see in my video linked in the first post.

rspaargaren commented 8 years ago

here is the full log file... lots of fluctuation in the values. In the end there is also some manual interference via the pimatic site trying to fix the value.

pimatic-daemon1.txt

rspaargaren commented 8 years ago

And this is a log file of just seconds ago. Starting at the moment I was setting the value for both a RF switch and RF dimmer. The dimmer started fluctuating and I have restarted pimatic. pimatic-daemon.txt

In the start something strange happens....

22:41:53.689 [pimatic-hap] debug: switching device Lamp Televisie to true 22:41:53.701 [pimatic-homeduino] debug: Sending Protocol: switch1 id:1337110 unit:1 all:false state:true Pin:4 Repeats:7 22:41:53.753 [pimatic-homeduino] debug: data: "RF receive 357 2580 222 1244 10180 0 0 0 010203020302030203020303020203030202030203020303020302020302030302030203020203020302030302020303020302020302030302020302030203030204" 22:41:53.764 [pimatic-homeduino] debug: received: [ 222, 357, 1244, 2580, 10180 ] 131012101210121012101212101012121010121012101212101210101210121210121012101012101210121210101212101210101210121210101210121012121014 22:41:53.780 [pimatic-homeduino] debug: switch1: { id: 1337110, all: false, state: true, unit: 1 } 22:41:53.791 [pimatic-homeduino] debug: pir5: { id: 1337110, all: false, presence: true, unit: 1 } 22:41:53.800 [pimatic-homeduino] debug: contact1: { id: 1337110, all: false, contact: false, unit: 1 } 22:41:54.341 [pimatic-homeduino] debug: data: "ACK" 22:41:54.368 [pimatic-hap] debug: value 63 equals current dimlevel of Lamp Bank. Not changing. 22:41:54.407 [pimatic-homeduino] debug: data: "RF receive 295 2676 1290 10448 0 0 0 0 0100020002000200020002020000020200000200020002020002000002000202000200020000020002000202000002020002000002000200000002000200020002020000020002020003" 22:41:54.419 [pimatic-homeduino] debug: received: [ 295, 1290, 2676, 10448 ] 0200010001000100010001010000010100000100010001010001000001000101000100010000010001000101000001010001000001000100000001000100010001010000010001010003 22:41:54.436 [pimatic-homeduino] debug: dimmer1: { id: 1337110, all: false, unit: 0, dimlevel: 9, state: undefined } 22:41:54.447 [pimatic-hap] debug: changing dimlevel of Lamp Bank to 60 I presume this has to do with dimlevel 9 ? 22:41:54.455 [pimatic-homeduino] debug: Sending Protocol: dimmer1 id:1337110 unit:0 all:false dimlevel:9 Pin:4 Repeats:1 22:41:55.020 [pimatic-homeduino] debug: data: "ACK" 22:41:55.046 [pimatic-hap] debug: changing dimlevel of Lamp Bank to 20 Where does this value of 20 come from?

rspaargaren commented 8 years ago

Ok one last one just happened again. Same way of initiation... After setting manually the value to 0 via pimatic the dimmer was even fluctuating between 3 values...?

michbeck100 commented 8 years ago

@thymian what type of led light are you using? I did use a DummyLedLight, and this works perfectly. Please try this in your config.

    {
      "id": "ledlight",
      "name": "Ledlight",
      "class": "DummyLedLight"
    },

If this light is working, the problem is probably within the implementation of the led light type.

michbeck100 commented 8 years ago

@rspaargaren I've noticed that the signal, when switching Lamp Televisie to true, has the id 1337110 (protocol switch1) and then afterwards pimatic receives a signal with the same id (1337110) but with a different protocol (dimmer1). I find that strange.

michbeck100 commented 8 years ago

Is the issue about sliding back dimmers fixed with https://github.com/pimatic/pimatic-homeduino/issues/63?

rspaargaren commented 8 years ago

My dimmers are not sliding back anymore with this fix. This was pure related to homeduino. However if I now use my hap plugin to switch off a light and dim a light in a "rule" in Vera ithe dimmer starts fluctuating. As logged in the post before. This behaviour is consistent.... :-( I have upgraded to 0.9. Both dimmer en switch are RF based. Same effect with contact switch and switch RF based. After contact is activated the switch is going on and off repeatedly...

scobby commented 8 years ago

i still have this issue to, like descripted in the issue here: https://github.com/pimatic/pimatic/issues/792

michbeck100 commented 8 years ago

@scobby Please post your config about the shellswitch again, i'll try to reproduce it.

michbeck100 commented 8 years ago

Just created a PR for a fix in pimatic-shell-execute, which could fix this issue.

michbeck100 commented 8 years ago

https://github.com/pimatic/pimatic-shell-execute/pull/14 was merged and released. Could you update pimatic-shell-execute and try if the error is gone?

scobby commented 8 years ago

I will Test that at the Weekend

Von meinem Smartphone gesendet

Am 13.07.2016 um 12:57 schrieb Michael Kotten notifications@github.com:

pimatic/pimatic-shell-execute#14 was merged and released. Could you update pimatic-shell-execute and try if the error is gone?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

scobby commented 8 years ago

yeah its working! one week with multiple shell-switches and no problem! thx! now i can remove 50 rules that only switched switches

michbeck100 commented 8 years ago

Can this issue be closed now? It was hard to catch up with the status so I'm not sure if there are any issues left here.

scobby commented 8 years ago

I think it's solved, any other opinions?

Von meinem Smartphone gesendet

Am 08.08.2016 um 20:04 schrieb Michael Kotten notifications@github.com:

Can this issue be closed now? It was hard to catch up with the status so I'm not sure if there are any issues left here.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

michbeck100 commented 8 years ago

Since there are no other opinions i'll close this issue.