Java Runtime Environment: which java platform is used and what version
openHAB version:
Issue of the topic: please be detailed explaining your issue
Please post configurations (if applicable):
Items configuration related to the issue
Sitemap configuration related to the issue
Rules code related to the issue
Services configuration related to the issue
If logs where generated please post these here using code fences:
Hi es wäre toll wenn es einen Button geben würde wo man alte sitzungen mit einem Klick beenden könnte. Bei mir sind über 100 stk. drinne und jede einzeln zu löschen ist sehr anstrengend
My English ist not so good. I hope this is correttly
Hi, it would be great if there was a button where you could end old sessions with one click. I have over 100 pieces. inside and deleting each one individually is very tiring
If you now have disabled the cookies deletion, all you have to do is delete the old sessions. I cant’t help you with doing them all in one go however, sorry.
open the ‘hamburger’ menu on the top left on your screen, that will give you the OpenHab menu. Now go to the lowest entry in the menu with the shield and the little lock symbol and unlock administration. When you’re logged in it wil give you the logged-in username. Now click on that and you’ll get an overview of active sessions.
var jsonpath = sendHttpGetRequest ("http://user:password@192.168.0.9:8080/rest/auth/sessions") //your openhab login and IP
var length = transform("JSONPATH", "$.length()", jsonpath)
var ilength = Integer::parseInt(length)
ilength = ilength - 5 //How much sessions left over
val type = "application/x-www-form-urlencoded"
var i = 0
while (i < ilength) {
var sessionidpath = "$.[" + i + "].sessionId"
var sessionid = transform("JSONPATH", sessionidpath, jsonpath)
var data = "id="+sessionid.toString
sendHttpPostRequest("http://user:password@192.168.0.9:8080/rest/auth/logout",type,data,5000) //your openhab login and IP
i=i+1
}
start this rule once per month with a cron timer and i think its ok.. Or put in scratchpad and run.
if you want you can put some Loginfo into it to see whats going on there..
val type = "application/x-www-form-urlencoded"
// val headers = newHashMap("Authorization" -> "Basic tokenvalbase64enc ?? ") //either
val headers = newHashMap("X-OPENHAB-TOKEN" -> "oh.scope.tokenval") //or
var jsonpath = sendHttpGetRequest ("http://yourip:8080/rest/auth/sessions",headers,5000) //your openhab IP
var length = transform("JSONPATH", "$.length()", jsonpath)
var ilength = Integer::parseInt(length)
ilength = ilength - 5 //How much sessions left over
var i = 0
while (i < ilength) {
var sessionidpath = "$.[" + i + "].sessionId"
var sessionid = transform("JSONPATH", sessionidpath, jsonpath)
var data = "id="+sessionid.toString
sendHttpPostRequest("http://yourip:8080/rest/auth/logout",type,data,headers,5000) //your openhab IP
i=i+1
}
Here is the code with with Blockly. @Thommy2012 Perhaps you can translate the topic into English so that others can find it? Maybe: How do I delete all sessions on the profile page?