Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webserver module #10

Closed
sanitariu opened this issue Feb 1, 2024 · 24 comments
Closed

Webserver module #10

sanitariu opened this issue Feb 1, 2024 · 24 comments

Comments

@sanitariu
Copy link

I noticed a bug that after sometime 24 hours the webserver is working but do not refresh values like SoC and other correctly. Actually they stay as they were previous day. App seems to work no crash. I stop and start it and everything is displayed normal updated. If you need more info you can email me for live access.

@ai-republic
Copy link
Owner

Thanks Todor, I will have a look into this. Do you have a log file of the bms-to-inverter-main application? Has the MQTT server stopped?

@sanitariu
Copy link
Author

I am sending the log files. It happened again. Can you check if it happens when UART crash ?
If i restart webserver only it will start working good.
logs.tar.gz

@ai-republic
Copy link
Owner

I can't find any errors in the logs. I suspect it could be a session timeout on the webserver. I will check that.
If possible you could send me a console log of the browser. If you press F12 you usually get the developer console (at least on FF or Edge).

@sanitariu
Copy link
Author

After 1 day it stops always. I tested second browser. Web console

[yoroi/prod] checking if should inject dapp-connector api inject.js:63:17
[yoroi/prod] injecting over 'nothing' inject.js:66:21
[yoroi/prod] dapp-connector is successfully injected into xx.xx.xx.xx

@sanitariu
Copy link
Author

Webserver even shows wrong data although i have restarted it.

@ai-republic
Copy link
Owner

[yoroi/prod] checking if should inject dapp-connector api inject.js:63:17
[yoroi/prod] injecting over 'nothing' inject.js:66:21
[yoroi/prod] dapp-connector is successfully injected into xx.xx.xx.xx

This is nothing from my application.
I suspect its a timeout in the webserver. I haven't had time to look into it yet.
Can you give me more detailed information on what wrong data it displays after restart?

@sanitariu
Copy link
Author

It is displaying old information from yesterday for example ...

@ai-republic
Copy link
Owner

Ok, that would mean that the BMS reading has stopped or the MQTT server. I believe I saw that the BMS reading was still running, so maybe its a timeout or validity of the MQTT topic on the MQTT server.
Thanks, that's a possibility to look into.

@sanitariu
Copy link
Author

For last hours seems like webserver is working. Lets see one more day and if it still refreshes it means problem is fixed.

@ai-republic
Copy link
Owner

yes. I've also been keeping an eye on it :)

@sanitariu
Copy link
Author

After testing 1 day ... seems like webserver is not stable and stops refreshing the information for some reason. No crashes or anything just stop. After restart it works again. Maybe timeout or something like that. When you have time look at it.

@ai-republic
Copy link
Owner

@sanitariu I think I fixed the webserver issue due to a MQTT producer disconnect. I now try to reconncect if the message could not be sent.

@sanitariu
Copy link
Author

Hi, I have downloaded latest release and this is what i have:

root@sol:~/bms # java -jar -DconfigFile=config/config.properties -Dlog4j2.configurationFile=file:config/log4j2.xml lib/bms-to-inverter-main-0.0.1-SNAPSHOT.jar
2024-03-21 10:08:13.145 | INFO | main | erter.core.util.Util:25 | Loading config.properties from: config/config.properties
2024-03-21 10:08:13.240 | INFO | main | ootstrap.WeldStartup:150 | WELD-000900: 5.1.1 (Final)
2024-03-21 10:08:13.810 | INFO | main | ionDiscoveryStrategy:52 | WELD-ENV-000014: Falling back to Java Reflection for bean-discovery-mode="annotated" discovery. Add org.jboss:jandex to the classpath to speed-up startup.
2024-03-21 10:08:13.867 | WARN | main | .environment.se.Weld:1015 | WELD-ENV-002008: Bean class module-info found in multiple bean archives - this may result in incorrect behavior:

  • WeldBeanDeploymentArchive [id=/root/bms/lib/email-api-1.0.5.jar],
  • WeldBeanDeploymentArchive [id=/root/bms/lib/email-javamail-1.0.5.jar]
    2024-03-21 10:08:14.088 | INFO | main | ootstrap.WeldStartup:228 | WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
    2024-03-21 10:08:15.344 | INFO | main | ent.se.WeldContainer:239 | WELD-ENV-002003: Weld SE container c38c6bd4-e4ec-4630-bf40-33dfa6aa3924 initialized
    2024-03-21 10:08:15.915 | INFO | main | eMQServerLogger_impl:45 | AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
    2024-03-21 10:08:15.933 | INFO | main | eMQServerLogger_impl:397 | AMQ221045: libaio is not available, switching the configuration into NIO
    2024-03-21 10:08:16.009 | INFO | main | eMQServerLogger_impl:493 | AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size (-Xmx). being defined as 129761280
    2024-03-21 10:08:16.084 | INFO | main | eMQServerLogger_impl:389 | AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
    2024-03-21 10:08:16.087 | INFO | main | eMQServerLogger_impl:389 | AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT
    2024-03-21 10:08:16.089 | INFO | main | eMQServerLogger_impl:389 | AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
    2024-03-21 10:08:16.228 | INFO | main | ogs.AuditLogger_impl:1139 | AMQ601138: User anonymous@unknown is getting notification info on target resource: null
    2024-03-21 10:08:16.231 | INFO | main | ogs.AuditLogger_impl:187 | AMQ601019: User anonymous@unknown is getting mbean info on target resource: org.apache.activemq.artemis.core.management.impl.ActiveMQServerControlImpl@972170
    2024-03-21 10:08:16.233 | INFO | main | ogs.AuditLogger_impl:1139 | AMQ601138: User anonymous@unknown is getting notification info on target resource: ActiveMQServerImpl::name=localhost
    2024-03-21 10:08:16.317 | INFO | main | ogs.AuditLogger_impl:187 | AMQ601019: User anonymous@unknown is getting mbean info on target resource: org.apache.activemq.artemis.core.management.impl.AddressControlImpl@1d8899
    2024-03-21 10:08:16.484 | INFO | main | ogs.AuditLogger_impl:187 | AMQ601019: User anonymous@unknown is getting mbean info on target resource: org.apache.activemq.artemis.core.management.impl.AcceptorControlImpl@191f50e
    2024-03-21 10:08:16.857 | INFO | main | eMQServerLogger_impl:205 | AMQ221020: Started NIO Acceptor at 127.0.0.1:61616 for protocols [CORE,MQTT,STOMP]
    2024-03-21 10:08:16.858 | INFO | main | eMQServerLogger_impl:101 | AMQ221007: Server is now live
    2024-03-21 10:08:16.859 | INFO | main | eMQServerLogger_impl:53 | AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.30.0 [localhost, nodeID=2b887578-e75a-11ee-be27-8eb748af779a]
    2024-03-21 10:08:17.193 | INFO | y-threads) | ogs.AuditLogger_impl:2843 | AMQ601767: CORE connection 66fccd0b for user [email protected]:36474 created
    2024-03-21 10:08:17.238 | INFO | 6@1eb5790) | ogs.AuditLogger_impl:2171 | AMQ601267: User [email protected]:36474 is creating a core session on target resource ActiveMQServerImpl::name=localhost with parameters: [2c58e4db-e75a-11ee-be27-8eb748af779a, null, ****, 102400, RemotingConnectionImpl [ID=66fccd0b, clientID=null, nodeID=2b887578-e75a-11ee-be27-8eb748af779a, transportConnection=org.apache.activemq.artemis.core.remoting.impl.netty.NettyServerConnection@d18eae[ID=66fccd0b, local= /127.0.0.1:61616, remote=/127.0.0.1:36474]], true, true, false, false, null, org.apache.activemq.artemis.core.protocol.core.impl.CoreSessionCallback@c9ee37, true, {}]
    2024-03-21 10:08:17.496 | INFO | 6@1eb5790) | ogs.AuditLogger_impl:555 | AMQ601065: User [email protected]:36474 is creating a queue on target resource: ServerSessionImpl() with parameters: [QueueConfiguration [id=null, name=energystorage, address=energystorage, routingType=null, filterString=null, durable=true, user=null, maxConsumers=-1, exclusive=null, groupRebalance=null, groupRebalancePauseDispatch=null, groupBuckets=null, groupFirstKey=null, lastValue=null, lastValueKey=null, nonDestructive=null, purgeOnNoConsumers=false, enabled=null, consumersBeforeDispatch=null, delayBeforeDispatch=null, consumerPriority=null, autoDelete=null, autoDeleteDelay=null, autoDeleteMessageCount=null, ringSize=1, configurationManaged=null, temporary=false, autoCreateAddress=null, internal=null, transient=null, autoCreated=false, fqqn=null]]
    2024-03-21 10:08:17.508 | INFO | 6@1eb5790) | ogs.AuditLogger_impl:187 | AMQ601019: User [email protected]:36474 is getting mbean info on target resource: org.apache.activemq.artemis.core.management.impl.AddressControlImpl@5932de
    2024-03-21 10:08:17.611 | WARN | 6@1eb5790) | eMQServerLogger_impl:1981 | AMQ222165: No Dead Letter Address configured for queue energystorage in AddressSettings
    2024-03-21 10:08:17.612 | WARN | 6@1eb5790) | eMQServerLogger_impl:1989 | AMQ222166: No Expiry Address configured for queue energystorage in AddressSettings
    2024-03-21 10:08:17.655 | INFO | 6@1eb5790) | ogs.AuditLogger_impl:187 | AMQ601019: User [email protected]:36474 is getting mbean info on target resource: org.apache.activemq.artemis.core.management.impl.QueueControlImpl@127e157
    2024-03-21 10:08:17.706 | INFO | -19718249) | ogs.AuditLogger_impl:2851 | AMQ601768: CORE connection 66fccd0b for user [email protected]:36474 destroyed
    2024-03-21 10:08:17.726 | INFO | y-threads) | ogs.AuditLogger_impl:2843 | AMQ601767: CORE connection 26ad4797 for user [email protected]:36482 created
    2024-03-21 10:08:17.739 | INFO | 6@1eb5790) | ogs.AuditLogger_impl:2171 | AMQ601267: User [email protected]:36482 is creating a core session on target resource ActiveMQServerImpl::name=localhost with parameters: [2ca8646f-e75a-11ee-be27-8eb748af779a, null, ****, 102400, RemotingConnectionImpl [ID=26ad4797, clientID=null, nodeID=2b887578-e75a-11ee-be27-8eb748af779a, transportConnection=org.apache.activemq.artemis.core.remoting.impl.netty.NettyServerConnection@a01804[ID=26ad4797, local= /127.0.0.1:61616, remote=/127.0.0.1:36482]], true, true, false, false, null, org.apache.activemq.artemis.core.protocol.core.impl.CoreSessionCallback@164e7bd, true, {}]
    2024-03-21 10:08:17.753 | INFO | main | .MQTTProducerService:40 | Connected MQTT producer at tcp://127.0.0.1:61616 to topic energystorage
    2024-03-21 10:08:17.891 | INFO | main | erter.core.util.Util:25 | Loading config.properties from: config/config.properties
    2024-03-21 10:08:17.892 | ERROR | main | core.BMSListProducer:58 | No config.properties found or no BMSes are configured!
    2024-03-21 10:08:17.895 | INFO | Thread-1 | verter.BmsToInverter:461 | Shutting down BMS and inverter threads...FAILED
    2024-03-21 10:08:17.910 | INFO | Thread-1 | .MQTTProducerService:89 | Shutting down MQTT producer on 'tcp://127.0.0.1:61616'...OK
    2024-03-21 10:08:17.911 | INFO | Thread-1 | verter.BmsToInverter:467 | Shutting down MQTT producer threads...OK
    2024-03-21 10:08:17.918 | INFO | Thread-1 | ogs.AuditLogger_impl:2851 | AMQ601768: CORE connection 26ad4797 for user [email protected]:36482 destroyed
    2024-03-21 10:08:17.918 | INFO | Thread-0 | ent.se.WeldContainer:318 | WELD-ENV-002001: Weld SE container c38c6bd4-e4ec-4630-bf40-33dfa6aa3924 shut down
    Weld SE container c38c6bd4-e4ec-4630-bf40-33dfa6aa3924 shut down by shutdown hook
    2024-03-21 10:08:17.925 | WARN | l-threads) | eMQClientLogger_impl:293 | AMQ212037: Connection failure to /127.0.0.1:61616 has been detected: AMQ219015: The connection was disconnected because of server shutdown [code=DISCONNECTED]
    2024-03-21 10:08:18.053 | INFO | Thread-1 | eMQServerLogger_impl:61 | AMQ221002: Apache ActiveMQ Artemis Message Broker version 2.30.0 [2b887578-e75a-11ee-be27-8eb748af779a] stopped, uptime 2.219 seconds
    2024-03-21 10:08:18.054 | INFO | Thread-1 | tt.MQTTBrokerService:98 | Shutting down MQTT broker on 'tcp://127.0.0.1:61616'...OK
    2024-03-21 10:08:18.055 | INFO | Thread-1 | verter.BmsToInverter:476 | Shutting down MQTT broker threads...OK
    2024-03-21 10:08:18.057 | INFO | Thread-1 | verter.BmsToInverter:484 | Shutting down ports...OK

@ai-republic
Copy link
Owner

The important lines are:
2024-03-21 10:08:17.891 | INFO | main | erter.core.util.Util:25 | Loading config.properties from: config/config.properties
2024-03-21 10:08:17.892 | ERROR | main | core.BMSListProducer:58 | No config.properties found or no BMSes are configured!

So there is no configuration file found in your installation folder under config/config.properties

@sanitariu
Copy link
Author

sanitariu commented Mar 21, 2024 via email

@sanitariu
Copy link
Author

sanitariu commented Mar 21, 2024

I think i found the problem. config.properties should be like that:

bms.1.type=DALY_RS485
bms.1.id=1
bms.1.portLocator=/dev/ttyAMA0
bms.1.delayAfterNoBytes=200

@sanitariu
Copy link
Author

I will run the webserver and we will know in some hours if it is ok.
Also i have noted the following:

2024-03-21 11:28:34.274 | INFO | Thread-5 | verter.BmsToInverter:190 | Sending to inverter NONE on /dev/can1...
2024-03-21 11:28:34.277 | DEBUG | Thread-5 | verter.core.Inverter:79 | Inverter received: Buffer (HEX): [null]

Maybe we should not send anything to inverter if type is NONE ?

@ai-republic
Copy link
Owner

Hi Todor,
yes, the numbering changed from starting from 0 to starting from 1.
Also the poll interval is now general for all BMS because it makes no sense to differ between multiple BMSes.

The DummyInverter (NONE) is not actually sending or receiving anything. It also doesn't open a port. I added that for the automatic discovery, but yes, I could take the NONE and just not have any inverter thread and processor running. Thanks for pointing it out :)

@sanitariu
Copy link
Author

I tested for 1 day and webserver stopped refreshing data. After restarting only the web module everything is okay. Strange that there is no errors or anything. I can not help you for debug

@sanitariu
Copy link
Author

Do you have any clues for fixing this ? Also why not add some graph charts per day/hour so we can see the history ?

@ai-republic
Copy link
Owner

I think its related the number of posts for the MQTT Server on the queue. I have not had time to look into that.

Yeah, the history would be a great thing. Good idea!
It'll need a database in the background and some new views. Let's see when I get around doing that :)

@sanitariu
Copy link
Author

Also i noted that Web server is showing Discharge with -18A while the other console is showing +30A Charging which is the correct one and i see the same on my Growatt display.
Maybe this is old data after it stucked ?!

@ai-republic
Copy link
Owner

Hi @sanitariu,
I changed the MQTT handling and hope that the webserver will not loose connection to the MQTT broker

@ai-republic
Copy link
Owner

I changed the webserver finally and its working without stopping. I will close this issue. If you encounter any issues please open another ticket ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants