tobof / openhab-addons

The next-generation open Home Automation Bus (openHAB)
Eclipse Public License 2.0
39 stars 30 forks source link

Fixing mvn strange behaviour #36

Closed andreacioni closed 7 years ago

andreacioni commented 7 years ago

Hi Tim!

This should fix the mvn build error! Please wait to resolve issue until I've tested another time the new implementation.

tobof commented 7 years ago

Build looks good now! Thank you very much!

While testing I see that there are duplicates in the cache file: [DEBUG] [.b.m.i.f.MySensorsCacheFactory:83 ] - Cache (given_ids) content: [172, 999, 6, 101, 103, 104, 105, 107, 106, 108, 110, 107, 106, 105, 123, 123, 456, 111, 111, 173, 173]

What do you think about that?

andreacioni commented 7 years ago

Mmmm, I cannot replicate it. Could you provide a more detailed log?

tobof commented 7 years ago

I've deleted the mapdb and mysensors cache and startet a new try.

My *.things file: Bridge mysensors:bridge-ser:gateway [ serialPort="/dev/pts/19", sendDelay=200, skipStartupCheck=true ] { humidity hum01 [ nodeId="172", childId="0" ] temperature temp01 [ nodeId="172", childId="1" ] light light01 [ nodeId="172", childId="3" ] motion motion01 [ nodeId="172", childId="5" ] dimmer dimmer01 [ nodeId="172", childId="7" ] humidity hum02 [ nodeId="173", childId="0" ] mySensorsMessage mySMsg01 [ nodeId="999", childId="999" ] text v_text_test [ nodeId="123", childId="123" ] irSend ir_test_send [ nodeId="111", childId="112" ] irReceive ir_test_receive [ nodeId="111", childId="111" ] }

My *.items file: Number hum01 "Humidity01" { channel="mysensors:humidity:gateway:hum01:hum" } Number hum02 "Humidity02" { channel="mysensors:humidity:gateway:hum02:hum" } Number temp01 "Temperature" { channel="mysensors:temperature:gateway:temp01:temp" } Switch light01 "light01" { channel="mysensors:light:gateway:light01:status" } Contact motion01trip "Motion01" { channel="mysensors:motion:gateway:motion01trip:tripped" } Contact motion01armed "Motion01" { channel="mysensors:motion:gateway:motion01armed:armed" } String v_text_test "v text test" { channel="mysensors:text:gateway:v_text_test:text" } String ir_test_send "ir test send" { channel="mysensors:irSend:gateway:ir_test_send:irSend" } String ir_test_receive "ir test receive" { channel="mysensors:irReceive:gateway:ir_test_receive:irReceive" }

After clearing up the cache I've started OH2, run my testscript.sh and got:

[.b.m.i.f.MySensorsCacheFactory:83 ] - Cache (given_ids) content: [172, 173, 999, 123, 111, 173, 123, 111, 6]

Here's the log: OH2-duplicate-ID-log.txt

andreacioni commented 7 years ago

Thanks Tim, I'll take a look at it soon!

andreacioni commented 7 years ago

Ok, the problem is a little bit complex. A temporary fix should be done by adding a guard (!givenIds.contains(nodeId)) on line 185 and on line 289. Now I'm working to conclude the refactoring so I haven't too much time to fix it properly. I hope you could do this two fixes on your own. In the finished refactoring I'll replace that part with a more robust one.

tobof commented 7 years ago

I see no harm in leaving this unchanged for now. Thank you @andreacioni !