Hi Community,
On openHAB 2, Snapshot #693, I am using org.openhab.binding.mpower-1.9.0-SNAPSHOT.jar
(copied over to /usr/share/openhab2/addons/
) dated June 2016 as it was build by @chano (thanx by the way) and made available in this post:
It mainly works ok with my 4 units of Ubiquiti mfi mPower (EU) strips (2 units of 3 ports and 2 units of 6 ports).
In some first start cases (when I restart OH2 due to a snapshot upgrade or system reboot), the mPower Binding throws an exception (ConcurrentModificationException) and the binding gets shut down…
2017-01-04 20:13:24.273 [INFO ] [nternal.connector.MpowerSSHConnector] - connected to mP602 on host 172.16.13.2
2017-01-04 20:13:26.445 [INFO ] [nternal.connector.MpowerSSHConnector] - connected to mP304 on host 172.16.13.4
2017-01-04 20:13:28.824 [INFO ] [nternal.connector.MpowerSSHConnector] - connected to mP601 on host 172.16.13.1
2017-01-04 20:13:30.875 [INFO ] [nternal.connector.MpowerSSHConnector] - connected to mP303 on host 172.16.13.3
2017-01-04 20:13:30.876 [INFO ] [b.core.service.AbstractActiveService] - Ubiquiti mPower Binding has been started
2017-01-04 20:13:30.877 [INFO ] [nternal.connector.MpowerSSHConnector] - Session closed to 172.16.13.2
2017-01-04 20:13:30.880 [INFO ] [inding.mpower.internal.MpowerBinding] - Connector mP602 is down. Trying to restart
2017-01-04 20:13:30.881 [INFO ] [nternal.connector.MpowerSSHConnector] - Session closed to 172.16.13.4
2017-01-04 20:13:30.882 [INFO ] [nternal.connector.MpowerSSHConnector] - Session closed to 172.16.13.1
2017-01-04 20:13:30.882 [INFO ] [nternal.connector.MpowerSSHConnector] - Session closed to 172.16.13.3
2017-01-04 20:13:32.134 [INFO ] [nternal.connector.MpowerSSHConnector] - connected to mP602 on host 172.16.13.2
2017-01-04 20:13:32.135 [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread Ubiquiti mPower Binding
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1437)[:1.8.0_111]
at java.util.HashMap$ValueIterator.next(HashMap.java:1466)[:1.8.0_111]
at org.openhab.binding.mpower.internal.MpowerBinding.execute(MpowerBinding.java:293)[9:org.openhab.binding.mpower:1.9.0.201606081237]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:157)[176:org.openhab.core.compat1x:2.0.0.201701032212]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173)[176:org.openhab.core.compat1x:2.0.0.201701032212]
2017-01-04 20:14:32.136 [INFO ] [b.core.service.AbstractActiveService] - Ubiquiti mPower Binding has been shut down
To solve this, I edit the config file (/etc/openhab2/services/mpower.cfg
) and modify one of the refresh intervals, triggering a reconnection that usually succeeds and then the binding comes up and it works (and stays stable for days, reading the values from the devices).
Does anyone have any idea what could be the root cause of this (ConcurrentModificationException) problem?
My items config looks like (only 1 example is provided for 1 outlet of 1 mPower strip). There is a total of 72 items defined that use the mpower binding
Switch mP6_01_01 "LAN Switch 24" (gmPower) {mpower="mP601:1:switch"}
Number mP6_01_01_V "LAN Switch Voltage [%d V]" (gmPower,gInflux) {mpower="mP601:1:voltage"}
Number mP6_01_01_E "LAN Switch Energy [%d Wh]" (gmPower,gInflux) {mpower="mP601:1:energy"}
Number mP6_01_01_P "LAN Switch Power [%.1f W]" (gmPower,gInflux) {mpower="mP601:1:power"}
My /etc/openhab2/services/mpower.cfg
is:
refresh=60000
mP601.host=172.16.13.1
mP601.user=<username>
mP601.password=<password>
mP601.refresh=900000
mP602.host=172.16.13.2
mP602.user=<username>
mP602.password=<password>
mP602.refresh=900000
mP303.host=172.16.13.3
mP303.user=<username>
mP303.password=<password>
mP303.refresh=900000
mP304.host=172.16.13.4
mP304.user=<username>
mP304.password=<password>
mP304.refresh=900000
BR,
Dim
Ps: Any chance that any developer will pickup the existing work and produce a 2.x mPower Binding for OH2?