is there a known problem at logging out with energenie binding?
Today I encountered, that i can’t switch my LAN-PM with another client as my openhab-client PC or the openhab-sitemap-webbrowser.
If I call the LAN-PM IP-address in another browser, it says that “Impossible to login - there is an active session with this device at this moment.”. It is a little bit confusing, because the active session is not with the actual client, but with the openhab-server. If I open an browser on my openhab-Server PC, I’m already logged in. If I log me out manually, the openhab binding works, but is a little bit slow and delayed.
Also it seems that the energenie binding is not logging out at stopping openhab. After 10 min. (auto-logout) it is possible to login through another machine.
I’m not so firm with Java and the binding-source code but as I can see, in my opinion after every “sendOn” and “sendOff” function should the “sendLogOut”-function be called in a finally-block, to ensure that other clients can also connect to the energenie device.
Hi,
I will check if there is a problem with the log out.
Best
Hans-Jörg
Update: Just had a quick check at the code and can not see a problem there.
sendLogOut() when it should be. Could you please change your loglevel for energenie binding to “TRACE” and post the output here.
thank you for your response.
Here is the trace log:
2016-01-06 20:56:26.979 DEBUG o.o.b.e.i.EnergenieBinding[:167]- internalReceiveCommand() is called!
2016-01-06 20:56:27.038 TRACE o.o.b.e.i.EnergenieBinding[:200]- sendlogin to 192.168.178.39 with password 1
2016-01-06 20:56:27.039 TRACE o.o.b.e.i.EnergenieBinding[:201]- sending 'POST' request to URL : http://192.168.178.39/login.html
2016-01-06 20:56:27.200 TRACE o.o.b.e.i.EnergenieBinding[:217]- sending 'POST' request to URL : http://192.168.178.39
2016-01-06 20:56:27.201 TRACE o.o.b.e.i.EnergenieBinding[:218]- send command ON to socket 1 at host 192.168.178.39
2016-01-06 20:56:27.285 TRACE o.o.b.e.i.EnergenieBinding[:253]- logout from ip 192.168.178.39
2016-01-06 20:57:10.429 DEBUG o.o.b.e.i.EnergenieBinding[:93]- execute() method is called!
2016-01-06 20:57:10.502 TRACE o.o.b.e.i.EnergenieBinding[:118]- searchstring sockstates found at position 343
2016-01-06 20:57:10.505 TRACE o.o.b.e.i.EnergenieBinding[:122]- transformed state response = 1,0,0,0
2016-01-06 20:57:10.507 TRACE o.o.b.e.i.EnergenieBinding[:127]- Response for item Energenie_BlueRay = 0
2016-01-06 20:57:10.508 TRACE o.o.b.e.i.EnergenieBinding[:130]- transformed state for item Energenie_BlueRay = OFF
2016-01-06 20:57:10.604 TRACE o.o.b.e.i.EnergenieBinding[:253]- logout from ip 192.168.178.39
2016-01-06 20:57:10.665 TRACE o.o.b.e.i.EnergenieBinding[:118]- searchstring sockstates found at position 343
2016-01-06 20:57:10.667 TRACE o.o.b.e.i.EnergenieBinding[:122]- transformed state response = 1,0,0,0
2016-01-06 20:57:10.668 TRACE o.o.b.e.i.EnergenieBinding[:127]- Response for item Energenie_LED = 1
2016-01-06 20:57:10.668 TRACE o.o.b.e.i.EnergenieBinding[:135]- transformed state for item Energenie_LED = ON
2016-01-06 20:57:10.760 TRACE o.o.b.e.i.EnergenieBinding[:253]- logout from ip 192.168.178.39
2016-01-06 20:57:17.845 TRACE o.o.b.e.i.EnergenieBinding[:118]- searchstring sockstates found at position 343
2016-01-06 20:57:17.848 TRACE o.o.b.e.i.EnergenieBinding[:122]- transformed state response = 1,0,0,0
2016-01-06 20:57:17.849 TRACE o.o.b.e.i.EnergenieBinding[:127]- Response for item Energenie_FireTV = 0
2016-01-06 20:57:17.850 TRACE o.o.b.e.i.EnergenieBinding[:130]- transformed state for item Energenie_FireTV = OFF
2016-01-06 20:57:17.942 TRACE o.o.b.e.i.EnergenieBinding[:253]- logout from ip 192.168.178.39
As I can see the logout will be really called when it should, but maybe the “sendLogOut”-function is not correct implemented? I think the url should be in the format “String url = “http://”+pmsIp+"/login.html";” for propper log out.
And not like this way: String url = “http://”+pmsIp;
private void sendLogOut(String pmsId) {
String pmsIp = pmsIpConfig.get(pmsId);
String url = "http://"+pmsIp;
try {
HttpUtil.executeUrl("POST", url, timeout);
logger.trace("logout from ip {}", pmsIp);
} catch (Exception e) {
logger.error("failed to logout from ip {}", pmsIp);
}
}
now I’m on version 1.8 and I’m sorry about that, but I think there are still problems.
I noticed that because of some delay in switching on or off my energenie-power strip.
Sometimes there are a couple of seconds between the action to switch on or off and the real on or off at the power strip. Here is the trace log from one example:
2016-01-19 15:27:45.262 DEBUG o.o.b.e.i.EnergenieBinding[:149]- internalReceiveCommand() is called!
2016-01-19 15:27:45.324 TRACE o.o.b.e.i.EnergenieBinding[:182]- sendlogin to 192.168.178.39 with password 1
2016-01-19 15:27:45.325 TRACE o.o.b.e.i.EnergenieBinding[:183]- sending 'POST' request to URL : http://192.168.178.39/login.html
2016-01-19 15:27:45.491 TRACE o.o.b.e.i.EnergenieBinding[:199]- sending 'POST' request to URL : http://192.168.178.39
2016-01-19 15:27:45.492 TRACE o.o.b.e.i.EnergenieBinding[:200]- send command ON to socket 1 at host 192.168.178.39
2016-01-19 15:27:45.541 TRACE o.o.b.e.i.EnergenieBinding[:230]- logout from ip 192.168.178.39
2016-01-19 15:27:46.786 DEBUG o.o.b.e.i.EnergenieBinding[:149]- internalReceiveCommand() is called!
2016-01-19 15:27:46.848 TRACE o.o.b.e.i.EnergenieBinding[:182]- sendlogin to 192.168.178.39 with password 1
2016-01-19 15:27:46.850 TRACE o.o.b.e.i.EnergenieBinding[:183]- sending 'POST' request to URL : http://192.168.178.39/login.html
2016-01-19 15:27:47.016 TRACE o.o.b.e.i.EnergenieBinding[:217]- sending 'POST' request to URL : http://192.168.178.39
2016-01-19 15:27:47.017 TRACE o.o.b.e.i.EnergenieBinding[:218]- send command OFF to socket 1 at host 192.168.178.39
2016-01-19 15:27:47.056 TRACE o.o.b.e.i.EnergenieBinding[:230]- logout from ip 192.168.178.39
2016-01-19 15:27:47.944 DEBUG o.o.b.e.i.EnergenieBinding[:149]- internalReceiveCommand() is called!
2016-01-19 15:27:48.005 TRACE o.o.b.e.i.EnergenieBinding[:182]- sendlogin to 192.168.178.39 with password 1
2016-01-19 15:27:48.005 TRACE o.o.b.e.i.EnergenieBinding[:183]- sending 'POST' request to URL : http://192.168.178.39/login.html
2016-01-19 15:27:48.170 TRACE o.o.b.e.i.EnergenieBinding[:199]- sending 'POST' request to URL : http://192.168.178.39
2016-01-19 15:27:48.171 TRACE o.o.b.e.i.EnergenieBinding[:200]- send command ON to socket 1 at host 192.168.178.39
2016-01-19 15:27:48.208 TRACE o.o.b.e.i.EnergenieBinding[:230]- logout from ip 192.168.178.39
2016-01-19 15:27:49.178 DEBUG o.o.b.e.i.EnergenieBinding[:149]- internalReceiveCommand() is called!
2016-01-19 15:27:49.239 TRACE o.o.b.e.i.EnergenieBinding[:182]- sendlogin to 192.168.178.39 with password 1
2016-01-19 15:27:49.239 TRACE o.o.b.e.i.EnergenieBinding[:183]- sending 'POST' request to URL : http://192.168.178.39/login.html
2016-01-19 15:27:49.399 TRACE o.o.b.e.i.EnergenieBinding[:217]- sending 'POST' request to URL : http://192.168.178.39
2016-01-19 15:27:49.400 TRACE o.o.b.e.i.EnergenieBinding[:218]- send command OFF to socket 1 at host 192.168.178.39
2016-01-19 15:27:49.435 TRACE o.o.b.e.i.EnergenieBinding[:230]- logout from ip 192.168.178.39
2016-01-19 15:27:50.326 DEBUG o.o.b.e.i.EnergenieBinding[:149]- internalReceiveCommand() is called!
2016-01-19 15:27:57.403 TRACE o.o.b.e.i.EnergenieBinding[:182]- sendlogin to 192.168.178.39 with password 1
2016-01-19 15:27:57.404 TRACE o.o.b.e.i.EnergenieBinding[:183]- sending 'POST' request to URL : http://192.168.178.39/login.html
2016-01-19 15:27:58.567 TRACE o.o.b.e.i.EnergenieBinding[:199]- sending 'POST' request to URL : http://192.168.178.39
2016-01-19 15:27:58.569 TRACE o.o.b.e.i.EnergenieBinding[:200]- send command ON to socket 1 at host 192.168.178.39
2016-01-19 15:27:58.606 TRACE o.o.b.e.i.EnergenieBinding[:230]- logout from ip 192.168.178.39
As you can see, the last ON command was sent 7 seconds after the internalReceiveCommand() function was called.
do you or someone else know what the problem could be?
I mean for a openhab installation it is a relative powerful machine (Intel NUC “NUCPPYH”).
No other problems with openhab delays - only with energenie!