history charts on mobile

stepankuklis
Posts: 17
Joined: Fri Nov 24, 2023 12:43 pm

Post

On self hosted docker instance I seldom get historical data for electricity load. both android and ios. In the web UI charts are ok, data are there. Do I need to allow some special protocol or port on fw? I have allowed 443tcp and most of the app works fine. Do we have some logs in the app or should I look to logcat? maybe something from server side? If you just point me to the right docs I would be very glad.
User avatar
pzygmunt
Posts: 19243
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków

Post

https://github.com/SUPLA/supla-docker/b ... default#L2

You must specify the IP address or domain of your private cloud in the configuration. iOS and Android will send requests for historical data via https to this address.
stepankuklis
Posts: 17
Joined: Fri Nov 24, 2023 12:43 pm

Post

you mean
CLOUD_DOMAIN?
I have set it up
=supla.avtg.cz
device can open it from the browser no problem
or another variable?

this is from running container
export
...
declare -x CLOUD_DOMAIN="supla.avtg.cz"
...

does it sync via http/s?

if I click for example "agg group in supla cloud" in groups tab, it opens right address and I can login

thank you
User avatar
pzygmunt
Posts: 19243
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków

Post

Devices download historical data over https.
stepankuklis
Posts: 17
Joined: Fri Nov 24, 2023 12:43 pm

Post

hello I did traffic capture (I can send it to you directly but I believe its not relevant in this case) and investigated this further.
Using Logcat on Android I see that app is not happy with my certificate (other data is fine in the app)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete: javax.net.ssl.SSLHandshakeException: Unacceptable certificate: CN=ISRG Root X1, O=Internet Security Research Group, C=US

I believe its the same issue on iOS since you are probably using similar tech stack..

I will get back to you here if this helped later.

full relevant log

Code: Select all

11-12 08:55:37.760  4922  4922 D PhoneSwitcherNetworkRequstListener: got request NetworkRequest [ REQUEST id=14478, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VCN_MANAGED Uid: 10217 RequestorUid: 10217 RequestorPkg: org.supla.android UnderlyingNetworks: Null] ]
11-12 08:55:37.762  1751  4063 D UntrustedWifiNetworkFactory: got request NetworkRequest [ REQUEST id=14478, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VCN_MANAGED Uid: 10217 RequestorUid: 10217 RequestorPkg: org.supla.android UnderlyingNetworks: Null] ]
11-12 08:55:37.763  1751  4063 D OemPaidWifiNetworkFactory: got request NetworkRequest [ REQUEST id=14478, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VCN_MANAGED Uid: 10217 RequestorUid: 10217 RequestorPkg: org.supla.android UnderlyingNetworks: Null] ]
11-12 08:55:37.764  1751  4063 D MultiInternetWifiNetworkFactory: got request NetworkRequest [ REQUEST id=14478, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VCN_MANAGED Uid: 10217 RequestorUid: 10217 RequestorPkg: org.supla.android UnderlyingNetworks: Null] ]
11-12 08:55:37.764  1751  4086 D ConnectivityService: NetReassign [14478 : null → 143] [c 1] [a 2] [i 6]
11-12 08:55:37.781 21281 21324 I okhttp.OkHttpClient: <-- HTTP FAILED: javax.net.ssl.SSLHandshakeException: Unacceptable certificate: CN=ISRG Root X1, O=Internet Security Research Group, C=US
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete: Initial measurements load failed
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete: javax.net.ssl.SSLHandshakeException: Unacceptable certificate: CN=ISRG Root X1, O=Internet Security Research Group, C=US
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.SSLUtils.toSSLHandshakeException(SSLUtils.java:356)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.ConscryptEngine.convertException(ConscryptEngine.java:1134)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.ConscryptEngine.readPlaintextData(ConscryptEngine.java:1089)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:876)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:747)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.ConscryptEngine.unwrap(ConscryptEngine.java:712)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.processDataFromSocket(ConscryptEngineSocket.java:896)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.ConscryptEngineSocket$SSLInputStream.-$$Nest$mprocessDataFromSocket(Unknown Source:0)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.ConscryptEngineSocket.doHandshake(ConscryptEngineSocket.java:236)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.ConscryptEngineSocket.startHandshake(ConscryptEngineSocket.java:218)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.kt:379)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.kt:337)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:209)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.kt:221)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at org.supla.android.core.networking.suplacloud.AuthInterceptor.intercept(AuthInterceptor.kt:36)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at retrofit2.OkHttpCall.execute(OkHttpCall.java:207)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall.execute(DefaultCallAdapterFactory.java:108)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at org.supla.android.data.source.ElectricityMeterLogRepository.getInitialMeasurements(ElectricityMeterLogRepository.kt:43)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at org.supla.android.features.measurementsdownload.BaseDownloadLogUseCase.loadInitialMeasurements(BaseDownloadLogUseCase.kt:68)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at org.supla.android.features.measurementsdownload.BaseDownloadLogUseCase.loadMeasurements$lambda$2(BaseDownloadLogUseCase.kt:43)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at org.supla.android.features.measurementsdownload.BaseDownloadLogUseCase.$r8$lambda$zTfjUIy1zRrNMezlRFSStCb3_As(Unknown Source:0)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at org.supla.android.features.measurementsdownload.BaseDownloadLogUseCase$$ExternalSyntheticLambda0.subscribe(D8$$SyntheticClass:0)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at io.reactivex.rxjava3.internal.operators.observable.ObservableCreate.subscribeActual(ObservableCreate.java:41)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13262)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at io.reactivex.rxjava3.internal.operators.observable.ObservableDoOnLifecycle.subscribeActual(ObservableDoOnLifecycle.java:34)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13262)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at io.reactivex.rxjava3.internal.operators.observable.ObservableDoOnEach.subscribeActual(ObservableDoOnEach.java:42)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13262)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at io.reactivex.rxjava3.internal.operators.observable.ObservableBlockingSubscribe.subscribe(ObservableBlockingSubscribe.java:50)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at io.reactivex.rxjava3.internal.operators.observable.ObservableBlockingSubscribe.subscribe(ObservableBlockingSubscribe.java:105)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at io.reactivex.rxjava3.core.Observable.blockingSubscribe(Observable.java:5936)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at io.reactivex.rxjava3.kotlin.SubscribersKt.blockingSubscribeBy(subscribers.kt:98)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at io.reactivex.rxjava3.kotlin.SubscribersKt.blockingSubscribeBy$default(subscribers.kt:97)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at org.supla.android.features.measurementsdownload.workers.BaseDownloadLogWorker.doWork(BaseDownloadLogWorker.kt:75)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at androidx.work.Worker$1.run(Worker.java:82)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at java.lang.Thread.run(Thread.java:1012)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete: Caused by: java.security.cert.CertificateException: Unacceptable certificate: CN=ISRG Root X1, O=Internet Security Research Group, C=US
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:609)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:615)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.TrustManagerImpl.checkTrusted(TrustManagerImpl.java:505)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:334)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:113)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:87)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at android.security.net.config.RootTrustManager.checkServerTrusted(RootTrustManager.java:118)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at org.supla.android.core.networking.suplacloud.SuplaCloudConfigHolder$trustManagers$2.checkServerTrusted(SuplaCloudConfigHolder.kt:92)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.Platform.checkServerTrusted(Platform.java:264)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.ConscryptEngine.verifyCertificateChain(ConscryptEngine.java:1638)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.NativeCrypto.ENGINE_SSL_read_direct(Native Method)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.NativeSsl.readDirectByteBuffer(NativeSsl.java:568)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.ConscryptEngine.readPlaintextDataDirect(ConscryptEngine.java:1095)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.ConscryptEngine.readPlaintextData(ConscryptEngine.java:1079)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       ... 51 more
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete: Caused by: java.security.cert.CertificateExpiredException: Certificate expired at Mon Sep 30 20:14:03 GMT+02:00 2024 (compared to Tue Nov 12 08:55:37 GMT+01:00 2024)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.OpenSSLX509Certificate.checkValidity(OpenSSLX509Certificate.java:269)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.OpenSSLX509Certificate.checkValidity(OpenSSLX509Certificate.java:255)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       at com.android.org.conscrypt.TrustManagerImpl.checkTrustedRecursive(TrustManagerImpl.java:605)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMete:       ... 64 more
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas: Could not load initial measurements
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas: java.lang.IllegalStateException: Could not load initial measurements
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at org.supla.android.features.measurementsdownload.BaseDownloadLogUseCase.loadMeasurements$lambda$2(BaseDownloadLogUseCase.kt:44)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at org.supla.android.features.measurementsdownload.BaseDownloadLogUseCase.$r8$lambda$zTfjUIy1zRrNMezlRFSStCb3_As(Unknown Source:0)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at org.supla.android.features.measurementsdownload.BaseDownloadLogUseCase$$ExternalSyntheticLambda0.subscribe(D8$$SyntheticClass:0)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at io.reactivex.rxjava3.internal.operators.observable.ObservableCreate.subscribeActual(ObservableCreate.java:41)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13262)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at io.reactivex.rxjava3.internal.operators.observable.ObservableDoOnLifecycle.subscribeActual(ObservableDoOnLifecycle.java:34)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13262)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at io.reactivex.rxjava3.internal.operators.observable.ObservableDoOnEach.subscribeActual(ObservableDoOnEach.java:42)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13262)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at io.reactivex.rxjava3.internal.operators.observable.ObservableBlockingSubscribe.subscribe(ObservableBlockingSubscribe.java:50)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at io.reactivex.rxjava3.internal.operators.observable.ObservableBlockingSubscribe.subscribe(ObservableBlockingSubscribe.java:105)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at io.reactivex.rxjava3.core.Observable.blockingSubscribe(Observable.java:5936)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at io.reactivex.rxjava3.kotlin.SubscribersKt.blockingSubscribeBy(subscribers.kt:98)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at io.reactivex.rxjava3.kotlin.SubscribersKt.blockingSubscribeBy$default(subscribers.kt:97)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at org.supla.android.features.measurementsdownload.workers.BaseDownloadLogWorker.doWork(BaseDownloadLogWorker.kt:75)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at androidx.work.Worker$1.run(Worker.java:82)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
11-12 08:55:37.782 21281 21324 E DownloadElectricityMeas:       at java.lang.Thread.run(Thread.java:1012)
11-12 08:55:37.783 21281 21311 I WM-WorkerWrapper: Worker result FAILURE for Work [ id=2a4d84b6-e564-4966-bc32-21134ae71e33, tags={ org.supla.android.features.measurementsdownload.workers.DownloadElectricityMeasurementsWorker } ]
11-12 08:55:37.789  1111 21201 I sensors-hal: handle_sns_std_sensor_event:130, ambient_light: ts=389238227087463, lux = 116, raw_adc=549, data_cnt 358
11-12 08:55:37.811  4922  4922 W FeatureConnection: getRegistrationTech: ImsRegistration is null
User avatar
pzygmunt
Posts: 19243
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków

Post

For certificates for private instances, CAA verification is ignored. The rest must be correct.
stepankuklis
Posts: 17
Joined: Fri Nov 24, 2023 12:43 pm

Post

Helo, after refreshing the certificate charts work - could you please revisit your code and make it work as you say?
I can show it to you via wireguard or even portforward. expired cert - charts not working, renewed cert, charts are working.
User avatar
pzygmunt
Posts: 19243
Joined: Tue Jan 19, 2016 9:26 am
Location: Paczków

Post

As I wrote above, the application checks if the certificate is valid (start date and expiration date) and skips the CA check. That's how it works.

Return to “Help”