Closed chschilling closed 2 months ago
Same her. When you restart the Thing -> your Items get a update with the right value ?
It seems that either the binding does not (1) request correctly for next data, or does not (2) read correctly the next data or the deye inverters (3) do not respond for consecutive requests.
I guess (2) is most probable cause. I have spotted some possible bug in the code for this - https://github.com/ptrbojko/openhab-lsw4inverter-binding/blob/8b77458685bef009037a129e0cfac9baac7fdbdb/src/main/java/org/openhab/binding/lswlogger/internal/connection/Channel.java#L64
Could you kindly check following version https://drive.google.com/file/d/1_jh84I7J4X_cY9aU1RZUHWJ6w2iapyEE/view?usp=drive_link
Hmm, unfortunatly, still no change.
here is a successfull request after disable / enable, but it took some minutes until I got this
2024-03-21 13:25:25.446 [DEBUG] [ernal.protocolv5.states.StateMachine] - Trying to schedule task in 15 SECONDS during state Receiving
2024-03-21 13:25:25.448 [DEBUG] [ernal.protocolv5.states.StateMachine] - Leaving Receiving
2024-03-21 13:25:25.449 [DEBUG] [ernal.protocolv5.states.StateMachine] - Waiting for state to process
2024-03-21 13:25:32.410 [DEBUG] [swlogger.internal.connection.Channel] - Received 282 bytes
2024-03-21 13:25:32.412 [DEBUG] [swlogger.internal.connection.Channel] - Listening for data, buffers 3 messages 1
2024-03-21 13:25:40.448 [DEBUG] [ernal.protocolv5.states.StateMachine] - Taken state Wrapper [Receiving ] to process
2024-03-21 13:25:40.449 [DEBUG] [ernal.protocolv5.states.StateMachine] - Entering Wrapper [Receiving ]
2024-03-21 13:25:40.451 [DEBUG] [swlogger.internal.connection.Channel] - Consuming messages, buffers 2 messages 1
2024-03-21 13:25:40.452 [DEBUG] [otocolv5.states.ReadingResponseState] - Trying to read a message
2024-03-21 13:25:40.454 [DEBUG] [otocolv5.AbstractDataResponseHandler] - Trying to extract message, length 282 bytes
2024-03-21 13:25:40.465 [DEBUG] [ternal.protocolv5.ResponseDispatcher] - Handler ByteBufferConsumer [headerSize=28, firstAddress=3, lastAddres=128, mrs=[org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@1db4bd3, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@4c2bec, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@fc1bf1, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@10c2d7b, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@26fda, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@1fc32bd, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@1b99aa0, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@11a1c99, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@5bd3df, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@106b33, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@11592cb, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@5aba64, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@1d405b, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@1a9fe18, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@91ac2c, org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition@16bb380]] matched response
2024-03-21 13:25:40.466 [DEBUG] [otocolv5.states.ReadingResponseState] - No message to read, trying to schedule next read or switching to next state
2024-03-21 13:25:40.467 [DEBUG] [ernal.protocolv5.states.StateMachine] - Leaving Wrapper [Receiving ]
It seems that from time to time, a new value is received
@chschilling could you elaborate more on this? Some more comprehensive logs, like covering some 5-10 minutes? Confirming that it more or less works let me publish changes and make new release.
The green line is from a HTTP URL Thing from the SUN600. the blue from the lswlogger beta thing
Mar 23 10:56:41 openhabian karaf[613763]: Exception in thread "Thread-121" java.lang.NullPointerException: Cannot invoke "java.nio.ByteBuffer.clear()" because "buffer" is null
Mar 23 10:56:41 openhabian karaf[613763]: #011at org.openhab.binding.lswlogger.internal.connection.Channel.listen(Channel.java:72)
Mar 23 10:56:41 openhabian karaf[613763]: #011at org.openhab.binding.lswlogger.internal.connection.Channel$2.completed(Channel.java:82)
Mar 23 10:56:41 openhabian karaf[613763]: #011at org.openhab.binding.lswlogger.internal.connection.Channel$2.completed(Channel.java:73)
Mar 23 10:56:41 openhabian karaf[613763]: #011at java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:129)
Mar 23 10:56:41 openhabian karaf[613763]: #011at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishRead(UnixAsynchronousSocketChannelImpl.java:447)
Mar 23 10:56:41 openhabian karaf[613763]: #011at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:195)
Mar 23 10:56:41 openhabian karaf[613763]: #011at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:217)
Mar 23 10:56:41 openhabian karaf[613763]: #011at java.base/sun.nio.ch.EPollPort$EventHandlerTask.run(EPollPort.java:306)
Mar 23 10:56:41 openhabian karaf[613763]: #011at java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:113)
Mar 23 10:56:41 openhabian karaf[613763]: #011at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
Mar 23 10:56:41 openhabian karaf[613763]: #011at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
Mar 23 10:56:41 openhabian karaf[613763]: #011at java.base/java.lang.Thread.run(Thread.java:840)
@Ichwersonsttttttttttttttttttttt could tell what is your refresh time in a thing config? If more than 10 seconds - could you lower it to 5-6 seconds?
I changed refresh time to 5 seconds.
it seems totaly random, if the thing gets new values and if not.
and at least on my side, it seems that it gets stuck after some few valuerefreshs
@Ichwersonsttttttttttttttttttttt could tell what is your refresh time in a thing config? If more than 10 seconds - could you lower it to 5-6 seconds?
i set it now to 5 sec
i thing: Mar 23 10:56:41 openhabian karaf[613763]: Exception in thread "Thread-121" java.lang.NullPointerException: Cannot invoke "java.nio.ByteBuffer.clear()" because "buffer" is null
thats the problem
I've made some adjustments, please check following version - https://drive.google.com/file/d/1_jh84I7J4X_cY9aU1RZUHWJ6w2iapyEE/view?usp=drive_link
Please set refresh time in thing config to at least 120 seconds (180?).
This is half baked version, only to check a theory on why buffers for messages are running out. Deye inverter is sending far more messages than other inverters...
2024-03-28 09:02:54.857 [DEBUG] [ernal.protocolv5.states.StateMachine] - Taken state Wrapper [Wrapper [Wrapper [Wrapper [Wrapper [Wrapper [Receiving ]]]]]] to process
2024-03-28 09:02:54.859 [DEBUG] [ernal.protocolv5.states.StateMachine] - Entering Wrapper [Wrapper [Wrapper [Wrapper [Wrapper [Wrapper [Receiving ]]]]]]
2024-03-28 09:02:54.860 [DEBUG] [swlogger.internal.connection.Channel] - Consuming messages, buffers 0 messages 4
2024-03-28 09:02:54.861 [DEBUG] [otocolv5.states.ReadingResponseState] - Trying to read a message
2024-03-28 09:02:54.864 [DEBUG] [otocolv5.states.ReadingResponseState] - Trying to read a message
2024-03-28 09:02:54.864 [DEBUG] [swlogger.internal.connection.Channel] - Received 279 bytes
2024-03-28 09:02:54.866 [DEBUG] [swlogger.internal.connection.Channel] - Listening for data, buffers 0 messages 3
2024-03-28 09:02:54.868 [DEBUG] [otocolv5.states.ReadingResponseState] - Trying to read a message
2024-03-28 09:02:54.871 [DEBUG] [otocolv5.states.ReadingResponseState] - Trying to read a message
2024-03-28 09:02:54.874 [DEBUG] [otocolv5.states.ReadingResponseState] - Trying to read a message
2024-03-28 09:02:54.877 [DEBUG] [otocolv5.AbstractDataResponseHandler] - Trying to extract message, length 279 bytes
2024-03-28 09:02:54.880 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:
java.lang.ArrayIndexOutOfBoundsException: Index 278 out of bounds for length 5
at org.openhab.binding.lswlogger.internal.bytebuffer.ExtractingBuilder$ShortExtractor.lambda$mappedTo$3(ExtractingBuilder.java:75) ~[?:?]
at java.util.function.Function.lambda$andThen$1(Function.java:88) ~[?:?]
at org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegisterDefinitionBuilder.lambda$add$0(ModbusRegisterDefinitionBuilder.java:37) ~[?:?]
at org.openhab.binding.lswlogger.internal.protocolv5.modbus.ModbusRegistryValueDefinition.accept(ModbusRegistryValueDefinition.java:41) ~[?:?]
at org.openhab.binding.lswlogger.internal.protocolv5.modbus.ByteBufferConsumer.lambda$accept$0(ByteBufferConsumer.java:35) ~[?:?]
at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
at org.openhab.binding.lswlogger.internal.protocolv5.modbus.ByteBufferConsumer.accept(ByteBufferConsumer.java:26) ~[?:?]
at org.openhab.binding.lswlogger.internal.protocolv5.AbstractDataResponseHandler.extract(AbstractDataResponseHandler.java:40) ~[?:?]
at org.openhab.binding.lswlogger.internal.protocolv5.AbstractDataResponseHandler.handle(AbstractDataResponseHandler.java:29) ~[?:?]
at org.openhab.binding.lswlogger.internal.protocolv5.ResponseDispatcher.accept(ResponseDispatcher.java:32) ~[?:?]
at org.openhab.binding.lswlogger.internal.protocolv5.states.ReadingResponseState$ReadingHandler.onRead(ReadingResponseState.java:69) ~[?:?]
at org.openhab.binding.lswlogger.internal.connection.Channel.read(Channel.java:131) ~[?:?]
at org.openhab.binding.lswlogger.internal.protocolv5.states.ReadingResponseState$ReadingHandler.run(ReadingResponseState.java:62) ~[?:?]
at org.openhab.binding.lswlogger.internal.protocolv5.states.StateMachine$MetaRunnableWrapper.handle(StateMachine.java:139) ~[?:?]
at org.openhab.binding.lswlogger.internal.protocolv5.states.StateMachine.run(StateMachine.java:84) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
at java.lang.Thread.run(Thread.java:840) [?:?]
2024-03-28 09:02:55.400 [DEBUG] [swlogger.internal.connection.Channel] - Received 8 bytes
2024-03-28 09:02:55.401 [DEBUG] [swlogger.internal.connection.Channel] - Listening for data, buffers 2 messages 1
2024-03-28 09:02:56.592 [DEBUG] [swlogger.internal.connection.Channel] - Received 43 bytes
2024-03-28 09:02:56.594 [DEBUG] [swlogger.internal.connection.Channel] - Listening for data, buffers 1 messages 2
2024-03-28 09:02:57.193 [DEBUG] [swlogger.internal.connection.Channel] - Received 15 bytes
2024-03-28 09:02:57.194 [DEBUG] [swlogger.internal.connection.Channel] - Listening for data, buffers 0 messages 3
the point of -2000 was the switch to the googeldrive packet
I assume that this green line is a reading from the binding?
I assume that this green line is a reading from the binding?
Yes , he get a update only when i start the addon / thing by hand new .
Can i help you , when i give you access to a Sun 600 inverter ?
I've rewrite a little handling states and scheduling tasks. It turns out that in some cases whole bunch of tasks were cancelling without reason.
Please test following version - https://drive.google.com/file/d/1_jh84I7J4X_cY9aU1RZUHWJ6w2iapyEE/view?usp=drive_link
Please set refresh time to 50 or less.
looks quite promising for now!
I've changed refresh time to 30s, in the logs, it seems to get an update every second, tries to update every 30 seconds but graf in openhab is quite raw - Update for some minutes...
But at least, we do have values be refreshed now! Thanks so far ;)
I would ask to not close directly :)
It seems that the thing is now refreshing every 5 minutes, nevertheless whats configured. Did you hardcode something for testing? Did you remove that part upstream so the new release is fine again?
Or do you implemented any other mechanism to set fixed updaterates?
I write into influx on change and it is quite exact 5 minutes between the changes, as said, configured for update is 30 seconds.
Greets and thanks!
Hey,
thanks for implementing the Deye Beta Support.
from initial testing, it seems to offer correct values so far.
But I have an issue, getting values refreshed...
I set refresh time to 15 seconds
When I disable/enable the thing, it sometimes gets actual values from Inverter and they seem to be correct so far. But after that, values are not changing anymore.
Just as information, I installed the Addon via jar file but the official addon was installed before, if that could be an issue anyhow.
I changed logging to trace:
openhab.log
events.log:
If I could offer any more information, let me know :)
Greets Christian