openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.59k forks source link

[paradoxalarm] Paradox EVOHD zone parsing fail #10572

Closed sebglon closed 1 year ago

sebglon commented 3 years ago

Expected Behavior

Zone state is read and reported on openhab

Current Behavior

The zone value is still NULL on logs, i can find this error:

2021-04-24 12:41:23.160 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.NullPointerException: null
    at org.openhab.binding.paradoxalarm.internal.parsers.EvoParser.calculateZoneState(EvoParser.java:78) ~[?:?]
    at org.openhab.binding.paradoxalarm.internal.model.ParadoxPanel.updateEntitiesStates(ParadoxPanel.java:100) ~[?:?]
    at org.openhab.binding.paradoxalarm.internal.model.ParadoxPanel.update(ParadoxPanel.java:148) ~[?:?]
    at java.util.Arrays$ArrayList.forEach(Arrays.java:4390) ~[?:?]
    at org.openhab.binding.paradoxalarm.internal.communication.GenericCommunicator.updateListeners(GenericCommunicator.java:110) ~[?:?]
    at org.openhab.binding.paradoxalarm.internal.communication.EvoCommunicator.receiveRamResponse(EvoCommunicator.java:97) ~[?:?]
    at org.openhab.binding.paradoxalarm.internal.communication.GenericCommunicator.receiveResponse(GenericCommunicator.java:131) ~[?:?]
    at org.openhab.binding.paradoxalarm.internal.communication.AbstractCommunicator.receivePacket(AbstractCommunicator.java:152) ~[?:?]
    at org.openhab.binding.paradoxalarm.internal.communication.AbstractCommunicator.communicateToParadox(AbstractCommunicator.java:103) ~[?:?]
    at org.openhab.binding.paradoxalarm.internal.communication.AbstractCommunicator.communicateToParadox(AbstractCommunicator.java:110) ~[?:?]
    at org.openhab.binding.paradoxalarm.internal.communication.AbstractCommunicator.submitRequest(AbstractCommunicator.java:96) ~[?:?]
    at org.openhab.binding.paradoxalarm.internal.communication.EvoCommunicator.submitRamRequest(EvoCommunicator.java:246) ~[?:?]
    at org.openhab.binding.paradoxalarm.internal.communication.EvoCommunicator.refreshMemoryMap(EvoCommunicator.java:235) ~[?:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
    at java.lang.Thread.run(Thread.java:829) [?:?]

Possible Solution

Steps to Reproduce (for Bugs)

  1. start openhab
  2. add the thing for paradox; all is good on partition and panel state
  3. add new item on the paradox zone and it fail to grab data with NPE

Context

Your Environment

openhab-bot commented 3 years ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/paradox-evo-binding/58026/565

lsiepel commented 1 year ago

The issue is probably because the zonesLowBattery is not set/available/send as the stacktrace leads to this line:

https://github.com/openhab/openhab-addons/blob/297640aa774556cfbf70044321ff90bd3b21e8d1/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/parsers/EvoParser.java#L78

Maybe adding some null check and set hasLowBattery to fasle would be enough. WDYT @theater ?

theater commented 1 year ago

I'll have a look when i get home tomorrow.

Cheers, K.

On Fri, Aug 11, 2023, 11:48 PM lsiepel @.***> wrote:

The issue is probably because the zonesLowBattery is not set/available/send as the stacfktrace leqads to this line:

https://github.com/openhab/openhab-addons/blob/297640aa774556cfbf70044321ff90bd3b21e8d1/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/parsers/EvoParser.java#L78

Maybe adding some null check and set hasLowBattery to fasle would be enough. WDYT @theater https://github.com/theater ?

— Reply to this email directly, view it on GitHub https://github.com/openhab/openhab-addons/issues/10572#issuecomment-1675388107, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB7Q3LVOSCQ6J37SBITKYADXU2LCJANCNFSM43QBA7AQ . You are receiving this because you were mentioned.Message ID: @.***>

theater commented 1 year ago

The issue is probably because the zonesLowBattery is not set/available/send as the stacktrace leads to this line:

https://github.com/openhab/openhab-addons/blob/297640aa774556cfbf70044321ff90bd3b21e8d1/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/parsers/EvoParser.java#L78

Maybe adding some null check and set hasLowBattery to fasle would be enough. WDYT @theater ?

I believe the issue is that he's using old code from 3.0.x (not that the bug is fixed in the new one but the lines have different values). I think the code where this happens in 3.0.x is this. boolean hasLowBattery = ParadoxUtil.isBitSet(zonesLowBattery[index], bitNumber); I guess a null check can be made as a workaround but the root cause is that it seems that a certain zone flags are not found in the expected place of the RAM memory on EVO HD. (I initially used the mappings for Evo192 and it seems most stuff is identical)

theater commented 1 year ago

Oh... I've found the bug. It's in the communicator... :)