Verisure login stopped working

@jannegpriv

I have been using your fine verisure binding for some time and suddenly it stopped working. This is the output from the logs when I restart the binding:

2020-08-19 21:18:40.584 [DEBUG] [ng.verisure.internal.VerisureSession] - Status code 200 and on MyPages!
2020-08-19 21:18:40.584 [DEBUG] [ng.verisure.internal.VerisureSession] - Attempting to get all installations
2020-08-19 21:18:40.670 [DEBUG] [ng.verisure.internal.VerisureSession] - postVerisureAPI URL: https://m-api01.verisure.com/auth/login Data:empty
2020-08-19 21:18:40.671 [DEBUG] [ng.verisure.internal.VerisureSession] - Setting cookie with username xyz@xyz.com and vid
2020-08-19 21:18:40.671 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP POST Request HttpRequest[POST /auth/login HTTP/1.1]@4ad64c00.
2020-08-19 21:18:40.684 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP Response (400)
2020-08-19 21:18:40.685 [DEBUG] [ng.verisure.internal.VerisureSession] - Failed to send POST, Http status code: 400
2020-08-19 21:18:40.685 [DEBUG] [ng.verisure.internal.VerisureSession] - postVerisureAPI URL: https://m-api01.verisure.com/auth/login Data:empty
2020-08-19 21:18:40.686 [DEBUG] [ng.verisure.internal.VerisureSession] - Setting cookie with username xyz@xyz.com and vid
2020-08-19 21:18:40.687 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP POST Request HttpRequest[POST /auth/login HTTP/1.1]@4411bb2a.
2020-08-19 21:18:40.700 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP Response (400)
2020-08-19 21:18:40.700 [DEBUG] [ng.verisure.internal.VerisureSession] - Failed to send POST, Http status code: 400
2020-08-19 21:18:40.701 [WARN ] [ng.verisure.internal.VerisureSession] - Failed to set session cookie and auth login, HTTP result code: 503
2020-08-19 21:18:40.701 [WARN ] [ternal.handler.VerisureBridgeHandler] - Failed to initialize bridge, please check your credentials! 

It tells me to check my credentials but I don’t think that is the real problem because my credentials have not changed. Do you have any ideas?

/Niclas

Hej Niclas!

Tack för din felrapport!

Jag har också sett samma fenomen på min produktionsmiljö, jag har ändrat på logiken som checkar ifall man är inloggad, vore kanon om du kunde testa denna jar-fil.

Den är baserad på kommande 2.5.8 så beroende på hur du har installerat den du kör nu kan du vara tvungen att ta bort en gammal jar-fil.

Dock löser den fixen inte orsaken till att bindingen slutade fungera skulle jag tro, något måste fått den att sluta fungera. Om du har kvar loggar skulle du kunna söka efter strängen “Exception” i både verisure och openhab-loggarna (om du har dom separerade).

Jag har hittat en bugg men den triggas bara om man har en Mice Detector och får konstigt svar på ett REST-anrop, har du en Mice Detector?

Mvh

/Janne

Hej Janne!

Ursäkta sent svar. Microsoft placerar alltid dessa mail i skräppost-mappen.

Tack för hjälpen! Jag ska försöka testa under dagen och återkomma. Ska även söka igenom loggarna. Har dem dock inte separerade tyvärr.

Har ingen mice detector så det borde inte vara det.

Tillägg:
Inser nu att du kanske misstolkade “restart the binding” som att den hade kraschat. Jag startade bara om den efter att jag hade slagit på debug-loggning, för att få felmeddelandet i loggen. Inte för att den hade kraschat.

Mvh,
Niclas

Skickat från min iPhone

English please, this is an international community.

Sorry about that!

I couldn’t access the jar-file. I just upgraded to OH2 2.5.7 and it seemed to fix the issue anyway. Don’t know why. When you have fixed the permissions on the jar-file I can try it anyway, but I won’t be able to tell if it fixes the problem since it is now working anyway :slight_smile:

Thanks!

BR
/Niclas

The link is now fixed!

It would be gr8 if you tested it!

BR,

/Janne

I’ve created an issue on the login problem, I will probably commit a fix tomorrow.

Link to new jar-file.

I’ve tested the jar now and it seems to work. Thanks!

BR
/Niclas

Hi,

I also have the problem with a login error, so my question is will the binding installed via Paper UI be updated automatically to correct this login error, or will I have to use your jar file?

BR
Ulrik

According to release notes my fix of #8315 is not yet released, so you have to take the jar-file.

Thanks - I do that.

@jannegpriv On the 15th my verisure binding lost connection again. However a simple restart of the binding solved the issue, so it’s probably not the same error? Unfortunately I did not have DEBUG-logging activated when it occurred. Here is the log:

2020-09-15 12:51:27.817 [WARN ] [ng.verisure.internal.VerisureSession] - Failed to send a POST to the API java.io.EOFException: HttpConnectionOverHTTP@6d23c333::DecryptedEndPoint@349847a5{m-api01.verisure.com/195.170.189.34:443<->/192.168.1.27:56994,OPEN,fill=-,flush=-,to=24102/0}
2020-09-15 12:57:24.306 [WARN ] [ng.verisure.internal.VerisureSession] - Failed to send a POST to the API java.net.SocketTimeoutException: Connect Timeout
2020-09-15 13:09:33.592 [WARN ] [ng.verisure.internal.VerisureSession] - Failed to send a POST to the API java.net.SocketTimeoutException: Connect Timeout
2020-09-15 13:09:48.594 [WARN ] [ng.verisure.internal.VerisureSession] - Failed to send a POST to the API java.net.SocketTimeoutException: Connect Timeout
2020-09-15 13:15:32.136 [WARN ] [ng.verisure.internal.VerisureSession] - Failed to send a POST to the API java.io.EOFException: HttpConnectionOverHTTP@63e24fa3::DecryptedEndPoint@5aafa55e{m-api01.verisure.com/195.170.189.34:443<->/192.168.1.27:57020,OPEN,fill=-,flush=-,to=38470/0}
2020-09-15 13:33:07.825 [WARN ] [ng.verisure.internal.VerisureSession] - Failed to send a POST to the API java.net.SocketTimeoutException: Connect Timeout
2020-09-15 13:33:19.579 [WARN ] [ng.verisure.internal.VerisureSession] - Failed to send a POST to the API java.io.EOFException: HttpConnectionOverHTTP@445c78e::DecryptedEndPoint@4b3a919c{m-api01.verisure.com/195.170.189.34:443<->/192.168.1.27:57042,OPEN,fill=-,flush=-,to=11353/0}
2020-09-15 13:38:53.307 [WARN ] [ng.verisure.internal.VerisureSession] - Failed to send a POST to the API java.io.EOFException: HttpConnectionOverHTTP@650172aa::DecryptedEndPoint@5d69b236{m-api01.verisure.com/195.170.189.34:443<->/192.168.1.27:57048,OPEN,fill=-,flush=-,to=12802/0}
2020-09-15 13:44:18.636 [WARN ] [ng.verisure.internal.VerisureSession] - Failed to send a POST to the API java.net.SocketTimeoutException: Connect Timeout
2020-09-15 13:50:12.895 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.NullPointerException: null
	at org.openhab.binding.verisure.internal.dto.VerisureBaseThingDTO$Installation.equals(VerisureBaseThingDTO.java:376) ~[?:?]
	at org.openhab.binding.verisure.internal.dto.VerisureBaseThingDTO$Data.equals(VerisureBaseThingDTO.java:231) ~[?:?]
	at org.openhab.binding.verisure.internal.dto.VerisureBaseThingDTO.equals(VerisureBaseThingDTO.java:150) ~[?:?]
	at org.openhab.binding.verisure.internal.VerisureSession.notifyListenersIfChanged(VerisureSession.java:509) ~[?:?]
	at org.openhab.binding.verisure.internal.VerisureSession.updateEventLogStatus(VerisureSession.java:878) ~[?:?]
	at org.openhab.binding.verisure.internal.VerisureSession.lambda$2(VerisureSession.java:532) ~[?:?]
	at java.util.concurrent.ConcurrentHashMap.forEach(ConcurrentHashMap.java:1597) ~[?:1.8.0_262]
	at org.openhab.binding.verisure.internal.VerisureSession.updateStatus(VerisureSession.java:519) ~[?:?]
	at org.openhab.binding.verisure.internal.VerisureSession.refresh(VerisureSession.java:119) ~[?:?]
	at org.openhab.binding.verisure.internal.handler.VerisureBridgeHandler.refreshAndUpdateStatus(VerisureBridgeHandler.java:181) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_262]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) ~[?:1.8.0_262]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_262]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) ~[?:1.8.0_262]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_262]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_262]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262]

Edit:
And another thing I just noticed is that I can’t manage to get the output from the verisure binding to its own log file as described in the openhab documentation. It works for other bindings. This is the entries in org.ops4j.pax.logging.cfg:

# Verisure Logger
log4j2.logger.verisure.name = org.openhab.binding.verisure
log4j2.logger.verisure.level = DEBUG
log4j2.logger.verisure.additivity = false
log4j2.logger.verisure.appenderRefs = verisure
log4j2.logger.verisure.appenderRef.verisure.ref = VERISURE

# Verisure File Appender - verisure.log
log4j2.appender.verisure.name = VERISURE
log4j2.appender.verisure.type = RollingRandomAccessFile
log4j2.appender.verisure.fileName = ${openhab.logdir}/verisure.log
log4j2.appender.verisure.filePattern = ${openhab.logdir}/verisure.log.%i
log4j2.appender.verisure.immediateFlush = true
log4j2.appender.verisure.append = true
log4j2.appender.verisure.layout.type = PatternLayout
log4j2.appender.verisure.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n
log4j2.appender.verisure.policies.type = Policies
log4j2.appender.verisure.policies.size.type = SizeBasedTriggeringPolicy
log4j2.appender.verisure.policies.size.size = 3MB
log4j2.appender.verisure.strategy.type = DefaultRolloverStrategy
log4j2.appender.verisure.strategy.max = 10

log4j2.logger.org_openhab_binding_verisure.level = DEBUG
log4j2.logger.org_openhab_binding_verisure.name = org.openhab.binding.verisure

The last two entries are what is created by default from openhab when running log:set DEBUG org.openhab.binding.verisure. That works, the debug output is coming to the openhab.log, but not to verisure.log.

Thank’s for the exception stack trace, it is the Eventlog that is null on that row. I’ve seen some similar problems with API queries for Eventlog that fails and then the code fails to handle the fact that the Eventlog is null. I will add more null checks for that in a future fix.

2020-09-10 07:05:41.553 [TRACE] [ng.verisure.internal.VerisureSession] - Response body: {"errors":[{"message":"socket hang up","locations":[{"line":3,"column":2}],"path":["installation","eventLog"],"data"
:{"logTraceId":"45e9b8fd-b80b-4d35-adef-b60b0790c1f2"}}],"data":{"installation":{"eventLog":null,"__typename":"Installation"}}}

Regarding your problem with not logging to a separate file I have no clue what causes that. I have almost identical config as you have and it works for me.

@jannegpriv
Sounds good! Thanks! Maybe I can get the time to contribute to this fine binding some day. But my java is a little rusty at best :wink:

Ok. I will post a thread about the logging issue in some other section of this forum then!

New binding jar with better handling of Eventlog queries that fails.

Hi @jannegpriv
I recently reinstalled OH for reasons, and with (latest) version 3.1.0 I am seeing the issues that OP did:

2021-09-24 20:21:53.065 [DEBUG] [ng.verisure.internal.VerisureSession] - Checking if we are logged in
2021-09-24 20:21:53.385 [DEBUG] [ng.verisure.internal.VerisureSession] - We need to login again!
2021-09-24 20:21:53.387 [DEBUG] [ng.verisure.internal.VerisureSession] - Attempting to log in to mypages.verisure.com
2021-09-24 20:21:53.389 [DEBUG] [ng.verisure.internal.VerisureSession] - Login URL: https://mypages.verisure.com/j_spring_security_check?locale=en_GB
2021-09-24 20:21:53.390 [DEBUG] [ng.verisure.internal.VerisureSession] - postVerisureAPI URL: https://mypages.verisure.com/j_spring_security_check?locale=en_GB Data:j_username=mail@robin.com &j_password=aa&spring-security-redirect=/uk/start.html
2021-09-24 20:21:53.392 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP POST Request HttpRequest[POST /j_spring_security_check HTTP/1.1]@8893de.
2021-09-24 20:21:53.412 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP Response (200)
2021-09-24 20:21:53.477 [DEBUG] [ng.verisure.internal.VerisureSession] - postVerisureAPI URL: https://m-api01.verisure.com/auth/login Data:empty
2021-09-24 20:21:53.479 [DEBUG] [ng.verisure.internal.VerisureSession] - Setting cookie with username mail@robin.com and vid 
2021-09-24 20:21:53.480 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP POST Request HttpRequest[POST /auth/login HTTP/1.1]@167f744.
2021-09-24 20:21:53.702 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP Response (400)
2021-09-24 20:21:53.704 [DEBUG] [ng.verisure.internal.VerisureSession] - Failed to send POST, Http status code: 400
2021-09-24 20:21:53.706 [DEBUG] [ng.verisure.internal.VerisureSession] - postVerisureAPI URL: https://m-api01.verisure.com/auth/login Data:empty
2021-09-24 20:21:53.708 [DEBUG] [ng.verisure.internal.VerisureSession] - Setting cookie with username  mail@robin.com and vid 
2021-09-24 20:21:53.709 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP POST Request HttpRequest[POST /auth/login HTTP/1.1]@12afe2d.
2021-09-24 20:21:53.733 [DEBUG] [ng.verisure.internal.VerisureSession] - HTTP Response (400)
2021-09-24 20:21:53.734 [DEBUG] [ng.verisure.internal.VerisureSession] - Failed to send POST, Http status code: 400
2021-09-24 20:21:53.736 [WARN ] [ng.verisure.internal.VerisureSession] - Failed to set session cookie and auth login, HTTP result code: 503
2021-09-24 20:21:53.738 [WARN ] [ternal.handler.VerisureBridgeHandler] - Failed to initialize bridge, please check your credentials!

I am assuming the fix should be applied since it was a year since it was made. Do you have any insights into this?

Hi @RobinS !

Verisure has changed the authentication process a couple of weeks ago so the official binding in 3.1.0 does not work anymore. Please see the official binding thread!