openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.58k forks source link

[Netatmo] Thermostat UNINITIALIZED (HANDLER_INITIALIZING_ERROR) #3048

Closed Victory2018 closed 6 years ago

Victory2018 commented 6 years ago

Hi,

i am getting a error where the thermostat does not come online and i get UNINITIALIZED (HANDLER_INITIALIZING_ERROR)

both the API and Relay are both online and fine, any help would be most appreciated.

error is logs is


08:37:21.384 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.netatmo.internal.thermostat.NATherm1Handler@720f681a': null
java.lang.NullPointerException: null
        at org.openhab.binding.netatmo.internal.thermostat.NAPlugHandler.getLastBilan(NAPlugHandler.java:75) ~[?:?]
        at org.openhab.binding.netatmo.internal.thermostat.NAPlugHandler.getNAThingProperty(NAPlugHandler.java:64) ~[?:?]
        at org.openhab.binding.netatmo.handler.AbstractNetatmoThingHandler.lambda$3(AbstractNetatmoThingHandler.java:84) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source) ~[?:?]
        at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) ~[?:?]
        at java.util.Iterator.forEachRemaining(Unknown Source) ~[?:?]
        at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) ~[?:?]
        at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:?]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) ~[?:?]
        at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:?]
        at java.util.stream.ReferencePipeline.forEach(Unknown Source) ~[?:?]
        at org.openhab.binding.netatmo.handler.AbstractNetatmoThingHandler.updateChannels(AbstractNetatmoThingHandler.java:82) ~[?:?]
        at org.openhab.binding.netatmo.handler.NetatmoDeviceHandler.updateChannels(NetatmoDeviceHandler.java:122) ~[?:?]
        at org.openhab.binding.netatmo.handler.NetatmoModuleHandler.lambda$2(NetatmoModuleHandler.java:88) ~[?:?]
        at java.util.Optional.ifPresent(Unknown Source) [?:?]
        at org.openhab.binding.netatmo.handler.NetatmoModuleHandler.requestParentRefresh(NetatmoModuleHandler.java:88) [211:org.openhab.binding.netatmo:2.2.0]
        at org.openhab.binding.netatmo.handler.NetatmoModuleHandler.initialize(NetatmoModuleHandler.java:46) [211:org.openhab.binding.netatmo:2.2.0]
        at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [111:org.eclipse.smarthome.core:0.10.0.b1]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [111:org.eclipse.smarthome.core:0.10.0.b1]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
        at java.lang.Thread.run(Unknown Source) [?:?]
08:37:21.390 [ERROR] [home.core.thing.internal.ThingManager] - Exception occurred while initializing handler of thing 'netatmo:NATherm1:b85cb107:0400000dd660': null
java.lang.NullPointerException: null
        at org.openhab.binding.netatmo.internal.thermostat.NAPlugHandler.getLastBilan(NAPlugHandler.java:75) ~[?:?]
        at org.openhab.binding.netatmo.internal.thermostat.NAPlugHandler.getNAThingProperty(NAPlugHandler.java:64) ~[?:?]
        at org.openhab.binding.netatmo.handler.AbstractNetatmoThingHandler.lambda$3(AbstractNetatmoThingHandler.java:84) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source) ~[?:?]
        at java.util.stream.ReferencePipeline$2$1.accept(Unknown Source) ~[?:?]
        at java.util.Iterator.forEachRemaining(Unknown Source) ~[?:?]
        at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) ~[?:?]
        at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:?]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source) ~[?:?]
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source) ~[?:?]
        at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:?]
        at java.util.stream.ReferencePipeline.forEach(Unknown Source) ~[?:?]
        at org.openhab.binding.netatmo.handler.AbstractNetatmoThingHandler.updateChannels(AbstractNetatmoThingHandler.java:82) ~[?:?]
        at org.openhab.binding.netatmo.handler.NetatmoDeviceHandler.updateChannels(NetatmoDeviceHandler.java:122) ~[?:?]
        at org.openhab.binding.netatmo.handler.NetatmoModuleHandler.lambda$2(NetatmoModuleHandler.java:88) ~[?:?]
        at java.util.Optional.ifPresent(Unknown Source) [?:?]
        at org.openhab.binding.netatmo.handler.NetatmoModuleHandler.requestParentRefresh(NetatmoModuleHandler.java:88) [211:org.openhab.binding.netatmo:2.2.0]
        at org.openhab.binding.netatmo.handler.NetatmoModuleHandler.initialize(NetatmoModuleHandler.java:46) [211:org.openhab.binding.netatmo:2.2.0]
        at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [111:org.eclipse.smarthome.core:0.10.0.b1]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [111:org.eclipse.smarthome.core:0.10.0.b1]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
        at java.lang.Thread.run(Unknown Source) [?:?]
08:37:21.390 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'netatmo:NATherm1:b85cb107:0400000dd660' changed from OFFLINE: Pending parent object initialization to UNINITIALIZED (HANDLER_INITIALIZING_ERROR)
08:37:21.404 [INFO ] [smarthome.event.ThingUpdatedEvent    ] - Thing 'netatmo:NATherm1:b85cb107:0400000dd660' has been updated.```
martinvw commented 6 years ago

@Victory2018 which version are you using?

Victory2018 commented 6 years ago

@martinvw i am using the latest snapshot, i first used the version on the public website but then tried the snapshot too with both same results.

martinvw commented 6 years ago

@clinique

berland commented 6 years ago

I had similar issues (bridge online, but all things uninitialized with HANDLER_CONFIGURATION_PENDING) after an upgrade from 2.1 to 2.2 through apt. The reason was an apparent change in .things-syntax. "equipmentId" had to be changed to "Id".

Victory2018 commented 6 years ago

Hi @berland im using the 2.3 snapshot and still not working, have tried a clean build, its very frustrating i hope someone knows how i can solve this problem.

This is what happens everytime i try to add them.

image

image

Victory2018 commented 6 years ago

An update for all, i have specified them in a things file directly and now the Thermostat is offline and says Pending parent object initialization, the relay and API are online. Anyone have a suggestion?

PaulGF commented 6 years ago

Hi, I have exactly the same issue with both, the lastest (2.3.0) and the 2.2.0 version. The firmware version from my Netatmo Rele is 160 and Netatmo Thermostate is 64.

clinique commented 6 years ago

Really sorry. It works fine on my side :( But I do see the origin of the error in the upper log. Let me see, I think I can correct this

PaulGF commented 6 years ago

Thanks, but I don't know how I try this patch..

Victory2018 commented 6 years ago

@clinique I can confirm it now is online and receiving data. I do have other issues though, i cannot set the manual setpoint everytime i do i get this error. I can change to frost guard, away and program, max and off all fine but it just wont change to manual.

09:08:30.136 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'netatmo_NATherm1_3e4f340e_0400000dd660_SetpointMode' received command off
09:08:30.138 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_3e4f340e_0400000dd660_SetpointMode changed from manual to off
09:08:30.563 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_3e4f340e_0400000dd660_SetpointMode changed from off to manual
09:08:41.179 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'netatmo_NATherm1_3e4f340e_0400000dd660_SetpointMode' received command max
09:08:41.180 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_3e4f340e_0400000dd660_SetpointMode changed from manual to max
09:08:41.623 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_3e4f340e_0400000dd660_SetpointMode changed from max to manual
09:09:15.701 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'netatmo_NATherm1_3e4f340e_0400000dd660_SetpointMode' received command manual
09:09:15.854 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'netatmo:NATherm1:3e4f340e:0400000dd660' changed from ONLINE to OFFLINE: 400 Bad Request

I also cannot set the temperature for setpoint it doesnt change on the thermostat.. am i doing something wrong?

09:10:59.102 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'netatmo_NATherm1_3e4f340e_0400000dd660_Sp_Temperature' received command 24
09:10:59.104 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_3e4f340e_0400000dd660_Sp_Temperature changed from 21.00 to 24
09:10:59.106 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'netatmo:NATherm1:3e4f340e:0400000dd660' changed from OFFLINE: 400 Bad Request to OFFLINE: java.math.BigDecimal cannot be cast to java.lang.Integer

Thanks

@PAulGF you need download the latest snapshot from https://openhab.ci.cloudbees.com/job/openHAB-Distribution/ grab the snapshot and the addons.

martinvw commented 6 years ago

@Victory2018 I don't know enough about the first problem, probably the binding sends an invalid value to netatmo, but I can resolve the second, will create a PR in a few minutes.

martinvw commented 6 years ago

@Victory2018 can you test my partial fix?

Victory2018 commented 6 years ago

@martinvw I can confirm that the has fixed the second issue i have. Thank you.

edit.. sorry seems to be jumping back to 20.5 everytime i try and change it now.. so partially fixed in that its sending the command but it seems to send the reverse straight after,, and sets it back

18:12:51.553 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_3e4f340e_0400000dd660_Sp_Temperature changed from 20.50 to 18
18:12:51.553 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_3e4f340e_0400000dd660_Sp_Temperature changed from 18 to 20.50
18:12:51.554 [INFO ] [smarthome.event.ItemStateChangedEvent] - broadlink_rm2_b4_43_0d_30_ca_ec_temperature changed from 21.200000762939453 to 21.100000381469727
18:13:10.687 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'netatmo_NATherm1_3e4f340e_0400000dd660_Sp_Temperature' received command 17
18:13:10.689 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_3e4f340e_0400000dd660_Sp_Temperature changed from 20.50 to 17
18:13:11.190 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_3e4f340e_0400000dd660_Sp_Temperature changed from 17 to 20.50
18:13:12.612 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'netatmo_NATherm1_3e4f340e_0400000dd660_Sp_Temperature' received command 20
18:13:12.613 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_3e4f340e_0400000dd660_Sp_Temperature changed from 20.50 to 20
18:13:13.104 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_3e4f340e_0400000dd660_Sp_Temperature changed from 20 to 20.50
18:13:14.965 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'netatmo_NATherm1_3e4f340e_0400000dd660_Sp_Temperature' received command 22
18:13:14.966 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_3e4f340e_0400000dd660_Sp_Temperature changed from 20.50 to 22
18:13:15.416 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_3e4f340e_0400000dd660_Sp_Temperature changed from 22 to 20.50
martinvw commented 6 years ago

@clinique are you able to act given this log data or do you need more alternately I can still revert the big refactoring PR but that feels like a bit too much 😉

@Victory2018 Do you get any debug/trace logging when you receive the '400 Bad Request', did you enable it via the karaf console and executing log:set TRACE org.openhab.binding.netatmo

Victory2018 commented 6 years ago

@martinvw here we go, something about it not passing the current setpoint_temp?

HTTP POST https://api.netatmo.net/api/setthermpoint?device_id=*************&module_id=04%3A00%3A00%3A0d%3Ad6%3A60&setpoint_mode=manual ---> END HTTP (no body) <--- HTTP 400 https://api.netatmo.net/api/setthermpoint?device_id=*************&module_id=04%3A00%3A00%3A0d%3Ad6%3A60&setpoint_mode=manual (1391ms) Server: nginx Date: Mon, 08 Jan 2018 19:28:05 GMT Content-Type: application/json; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Cache-Control: no-cache, must-revalidate Expires: 0 X-XSS-Protection: 1; mode=block Access-Control-Allow-Origin: * Strict-Transport-Security: max-age=10886400; includeSubDomains X-Powered-By: Netatmo OkHttp-Selected-Protocol: http/1.1 OkHttp-Sent-Millis: 1515439683260 OkHttp-Received-Millis: 1515439684650

{"error":{"code":10,"message":"setpoint_temp are mandatory in this mode"}} <--- END HTTP (74-byte body)

martinvw commented 6 years ago

@clinique is this something you can work with? If you can not pick this up then please mention ASAP maybe someone else can pick it up then? Maybe @lolodomo or @cweitkamp or ...?

jensihnow commented 6 years ago

Hi,

I've just downloaded the new version of the binding, uninstalled the old one and started with the new version ( followed https://community.openhab.org/t/frequently-asked-questions-faqs/17727?source_topic_id=33923#addons-1 ).

Still getting same error as before, please not :

...
2018-01-08 21:08:20.761 [home.event.InboxAddedEvent] - Discovery Result with UID 'netatmo:NAModule2:<removed>:<removed>' has been added.

==> openhab.log <==
2018-01-08 21:08:20.760 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'netatmo:NAModule2:<removed>:<removed>' to inbox.

==> events.log <==
2018-01-08 21:08:26.931 [me.event.InboxRemovedEvent] - Discovery Result with UID 'netatmo:NAModule2:<removed>:<removed>' has been removed.
2018-01-08 21:08:26.945 [hingStatusInfoChangedEvent] - 'netatmo:NAModule2:<removed>:<removed>' changed from UNINITIALIZED to INITIALIZING
2018-01-08 21:08:26.953 [hingStatusInfoChangedEvent] - 'netatmo:NAModule2:<removed>:<removed>' changed from INITIALIZING to OFFLINE: Pending parent object initialization
2018-01-08 21:08:27.326 [vent.ItemStateChangedEvent] - Netatmo_Indoor_CO2 changed from 373.00 to 374.00
2018-01-08 21:08:27.338 [vent.ItemStateChangedEvent] - Netatmo_Indoor_Temp changed from 23.60 to 23.70
2018-01-08 21:08:27.340 [vent.ItemStateChangedEvent] - Netatmo_Indoor_Noise changed from 34.00 to 38.00
2018-01-08 21:08:27.376 [vent.ItemStateChangedEvent] - Netatmo_Indoor_LastReading changed from 2018-01-08T20:45:36.000+0000 to 2018-01-08T21:05:50.000+0000

==> openhab.log <==
2018-01-08 21:08:27.393 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.netatmo.internal.station.NAModule2Handler@48d2b923': null
java.lang.NullPointerException: null
    at java.math.BigDecimal.<init>(BigDecimal.java:806) ~[?:?]
    at org.eclipse.smarthome.core.library.types.DecimalType.<init>(DecimalType.java:55) ~[?:?]
    at org.openhab.binding.netatmo.internal.station.NAMainHandler.getNAThingProperty(NAMainHandler.java:104) ~[?:?]
    at org.openhab.binding.netatmo.handler.AbstractNetatmoThingHandler.lambda$3(AbstractNetatmoThingHandler.java:86) ~[?:?]
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[?:?]
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:?]
    at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[?:?]
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:?]
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:?]
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:?]
    at org.openhab.binding.netatmo.handler.AbstractNetatmoThingHandler.updateChannels(AbstractNetatmoThingHandler.java:84) ~[?:?]
    at org.openhab.binding.netatmo.handler.NetatmoDeviceHandler.updateChannels(NetatmoDeviceHandler.java:124) ~[?:?]
    at java.util.Optional.ifPresent(Optional.java:159) [?:?]
    at org.openhab.binding.netatmo.handler.NetatmoModuleHandler.requestParentRefresh(NetatmoModuleHandler.java:88) [239:org.openhab.binding.netatmo:2.3.0.201801081516]
    at org.openhab.binding.netatmo.handler.NetatmoModuleHandler.initialize(NetatmoModuleHandler.java:46) [239:org.openhab.binding.netatmo:2.3.0.201801081516]
    at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
    at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
    at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
    at java.lang.Thread.run(Thread.java:748) [?:?]

==> events.log <==
2018-01-08 21:08:27.399 [vent.ItemStateChangedEvent] - Netatmo_Indoor_Humidex changed from 23.38 to 23.51
2018-01-08 21:08:27.572 [vent.ItemStateChangedEvent] - Netatmo_Indoor_Heatindex changed from 24.84 to 24.80

==> openhab.log <==
2018-01-08 21:08:27.571 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while initializing handler of thing 'netatmo:NAModule2:<removed>:<removed>': null
java.lang.NullPointerException: null
    at java.math.BigDecimal.<init>(BigDecimal.java:806) ~[?:?]
    at org.eclipse.smarthome.core.library.types.DecimalType.<init>(DecimalType.java:55) ~[?:?]
    at org.openhab.binding.netatmo.internal.station.NAMainHandler.getNAThingProperty(NAMainHandler.java:104) ~[?:?]
    at org.openhab.binding.netatmo.handler.AbstractNetatmoThingHandler.lambda$3(AbstractNetatmoThingHandler.java:86) ~[?:?]
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[?:?]
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) ~[?:?]
    at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[?:?]
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:?]
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:?]
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:?]
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:?]
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:?]
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:?]
    at org.openhab.binding.netatmo.handler.AbstractNetatmoThingHandler.updateChannels(AbstractNetatmoThingHandler.java:84) ~[?:?]
    at org.openhab.binding.netatmo.handler.NetatmoDeviceHandler.updateChannels(NetatmoDeviceHandler.java:124) ~[?:?]
    at java.util.Optional.ifPresent(Optional.java:159) [?:?]
    at org.openhab.binding.netatmo.handler.NetatmoModuleHandler.requestParentRefresh(NetatmoModuleHandler.java:88) [239:org.openhab.binding.netatmo:2.3.0.201801081516]
    at org.openhab.binding.netatmo.handler.NetatmoModuleHandler.initialize(NetatmoModuleHandler.java:46) [239:org.openhab.binding.netatmo:2.3.0.201801081516]
    at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
    at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
    at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
    at java.lang.Thread.run(Thread.java:748) [?:?]

I believe this one https://github.com/openhab/openhab2-addons/issues/3066 it not fixed, at least not for me.

I've actually added the windsensor recently same with any sensor.

Also, I never had the at org.openhab.binding.netatmo.internal.thermostat.NAPlugHandler.getLastBilan(NAPlugHandler.java:75) exception and still my issue got closed, see https://github.com/openhab/openhab2-addons/issues/3066

I'm not sure, but isn't the Exception hinting to https://github.com/openhab/openhab2-addons/blob/98ea4d30f9971614e91112f0969199961ee8b6c1/addons/binding/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/station/NAMainHandler.java#L104 which would be in relation to CHANNEL_PRESSURE_UNIT which is interesting since it configured as string and the BigDecimal doesn't make sense to me.

To further Debug I changed the configuration in the Netatmo app from mbar to mmHg. Right after another restart it started working and all modules became available!

Of course I changed back to mbar and restarted and it was still working!

Since I didn't captured the API responses before and after I can only referrer to the same issue documented earlier with full API response (see all https://github.com/openhab/openhab2-addons/issues/1499#issuecomment-278287576):

    "user": {
        "administrative": {
            "country": "DE",
            "feel_like_algo": 0,
            "lang": "de-DE",
            "reg_locale": "de-DE",
            "unit": 0,
            "windunit": 0
        },
        "mail": "*****@*****"
    }

and today:

image

I would call this an API error on Netatmo, since I'm a very early adaptor on Netamo this might be rare edge case. Still I believe it would be good to be protected against a missing API value.

What do you think @martinvw and @clinique ?

P.S. Happy I found it finally and it is now working as expected!

martinvw commented 6 years ago

@jensihnow thanks for informing us, I will update the code so that error you found in the netatmo api is now handled more gracefully.

martinvw commented 6 years ago

@Victory2018 a quick look at the code suggest that you might not have to set mode the manual (anymore?) but you can just pass a command to Sp_Temperature and then it will be set for the configured default duration. At what time is your setpointDefaultDuration configured it could explain why it is set back that quickly?

martinvw commented 6 years ago

@clinique Looking at

https://github.com/openhab/openhab2-addons/blob/98ea4d30f9971614e91112f0969199961ee8b6c1/addons/binding/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/thermostat/NATherm1Handler.java#L138-L139

you should not sent the mode if its manual or you should also send the setPoint in that case. For the later I prepared some code but I think it's a little bit ugly, so feel free to come with something else or use my code.

https://github.com/martinvw/openhab2-addons/commit/ed2b7838ac878923fb795e526bc8156d9b0db8c7

clinique commented 6 years ago

@martinvw : I'll have a look at it very soon.

martinvw commented 6 years ago

Great, thanks!

Victory2018 commented 6 years ago

@martinvw where would i check setpointDefaultDuration thanks.

If we need send a temp value to sp_temperature that is fine that solves that issue for me though it may be worth removing the option from Setpoint_mode as it creates confusion. "Applying a manually set temperature setpoint" or have that option pass a the current sp_temperature value and the default setpoint duration as part of its command.

image

also on further checking when i do set the temp in openhab it does successfully change the netatmo thermostat.. its not the actual netamo thermostat that jumps back to the old value it is just the display in openhab, as you can see the command is sent to set to 20, then the value is changed in openhab but then changes back.. a new command isnt sent to the api so we still get the desired change but obviously we want the openhab interface to reflect the correct sp_temperature status. hope that makes sense.

10:14:48.727 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'netatmo_NATherm1_514a1331_0400000dd660_Sp_Temperature' received command 20 10:14:48.730 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_514a1331_0400000dd660_Sp_Temperature changed from 19.00 to 20 10:14:50.385 [INFO ] [smarthome.event.ItemStateChangedEvent] - netatmo_NATherm1_514a1331_0400000dd660_Sp_Temperature changed from 20 to 19.00

martinvw commented 6 years ago

@martinvw where would i check setpointDefaultDuration thanks.

I assume that its a configuration value of thing, so edit the thing via the Paper UI and maybe click on advanced / show more if you do not see it.

Note that I do not own any Netatmo things so I just have to go by what I read in the code and know from other bindings.

Victory2018 commented 6 years ago

@martinvw yes found it, its set to 60 so i dont think thats the issue.

martinvw commented 6 years ago

Then it might be caused by the immediate refresh after setting it?

https://github.com/openhab/openhab2-addons/blob/98ea4d30f9971614e91112f0969199961ee8b6c1/addons/binding/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/thermostat/NATherm1Handler.java#L145-L153

clinique commented 6 years ago

@martinvw : yes. I'm on it. It's refreshing based on cached values, so coming back to previous data.

clinique commented 6 years ago

@Victory2018 : if you can try this PR targeted to solve Setpoint / Mode modification handling. Please, in the future, isolate issues so I can address them separately. Thanks for your followup.

Victory2018 commented 6 years ago

@clinique how do i test this, cant find build of it.

valefranch commented 6 years ago

Hello to everybody @clinique and @martinvw if someone give me the file .jar ( org.openhab.binding.netatmo-2.3.0-SNAPSHOT.jar ) I can test it soon thanks

clinique commented 6 years ago

@Victory2018 , @valefranch : link here

Victory2018 commented 6 years ago

@clinique thanks for that, upon testing there is no change, i am still getting the same issues. Sorry, let me know if anything else you need from me.

valefranch commented 6 years ago

@clinique I try! Now it works quite perfectly When you change the setpoint Temp the binding sent correctly the temperature to Netatmo server, But immediatly the setpoint Temp (that I change) return to the previous. After few second*** (I think that openHAB sincronize with the Netatmo server) everything is fine (the setpoint Temp is OK, the Setpoint_mode goes to "Manually" etc)!!

***: I change the Relè refreshPeriod from 3600000 to 5000 because the binding is more reactive 8to do this I manage the file \userdata\jsondb\org.eclipse.smarthome.core.thing.Thing.json in line 1332 image

clinique commented 6 years ago

@valefranch : yes, there is still something weird. The binding sends the update and requests a refresh, but from time to time (I still do not understand why), grabbed values are overdated. Still searching...but happy to see some progresses.

@Victory2018 : can you be more specific on the issue you still face ?

Victory2018 commented 6 years ago

@clinique Hi yes sorry written in haste.. same as @valefranch ,

Good news is i can confirm that now when setting the temp it changes back to manual from any of the other modes so that is great :-)

something strange though, when i launch openhab the values are reporting back as incorrect. My Temperature is currently 20.80 Sp_Temperature is currently 21

values coming back on startup are Temperature changed from UNDEF to 19.80 Sp_Temperature changed from UNDEF to 19.00

can say for sure its setting the manual temp properly just getting the same as @valefranch

also im not sure but is a refresh after setting the sp_Temperature actually needed, there seems be slight delay from when the command is sent to the api and the thermostat changing so if you omit the refresh or maybe you could possible introduce a slight delay on the binding asking for the update after the sptemp is set? it could possibly be getting old value back as its asking too quickly?

another possiblity is it is grabbing the set_temp from the program rather than whats set as manual.. as my program is set at 19 during the day and thats the value it always seems to go back too. Changing my program to 20 for example the value always goes back to 20 , something maybe caching but then if i set my manual temp to 21 and restart openhab process it still sets to the program value of 19 rather than the set_temp.

clinique commented 6 years ago

@Victory2018 : yes, this is what I'm trying to do, introducing a delay between changing setpoint temperature and refresh request. It seems that with 2 seconds it works. Will send you an updated binding soon.

valefranch commented 6 years ago

I make another test start situation: openHAB&Netatmo sincronize: openHAB sp_Temp=16°C openHAB sp_Mode=Following a weekly schedule

t1: change manually Netatmo_sp_Temp to 15°C by browser result openHAB_sp_Temp=16°C openHAB_sp_Mode=Following a weekly schedule Netatmo_sp_Temp=15°C Netatmo_sp_Mode=Manual

t2: (before system sincronize again) change openHAB_sp_Temp to 17°C openHAB_sp_Temp=15°C openHAB_sp_Mode=Manual Netatmo_sp_Temp=17°C Netatmo_sp_Mode=Manual

@Victory2018 I think you are right: after you set on openHAB the sp_Temp there is a too quick request of refresh and openHAB receve the value before Netatmo server upgrade

Victory2018 commented 6 years ago

"#***: I change the Relè refreshPeriod from 3600000 to 5000 because the binding is more reactive 8to do this I manage the file \userdata\jsondb\org.eclipse.smarthome.core.thing.Thing.json in line 1332"

@valefranch I just did the same thing and mine is much more repsonsive too. Heating Status updates quite quickly which is good.

clinique commented 6 years ago

You can test by downloading an updated jar on the same link. It introduces a 1.8 sec delay between update and refresh. Seems to be good on my side.

Victory2018 commented 6 years ago

@clinique are you sure thats the update jar.. sorry but still doing same thing on mine...

clinique commented 6 years ago

To be sure I did create another share : https://www.lhopital.org/nextcloud/s/TCgJHzNFjf0IyrI

Victory2018 commented 6 years ago

@clinique Perfect! working well now!!

Edit.. sorry after changing value quite few times it occasionally still does it, possible delay needs be slightly longer to account for fluctuation in internet traffic?

Edit.. Actually it may be ok, ill keep testing and let you know.. it did it couple of times

valefranch commented 6 years ago

@clinique Great!!! Now it works perfectly when you change manually the temperature I test all combinations of commands and Setpoint_Mode there is an other little issue: when I set the Setpoint_Mode in Frost-guard I obtain this result: openHAB_sp_Temp=20,5°C ??? openHAB_sp_Mode=Frost-guard Netatmo_sp_Temp=7°C -->correct Netatmo_sp_Mode=Frost-guard

This behavior is also if you set the Frost-guard mode on Netatmo server by browser after few second the result is the same above

the correct temperature of Frost-guard is 7°C as setted in Netatmo server I don't know where the system found that value (the sp_Temp for the other sp_Mode are all correct)

It seems that in Frost-guard (and only in this mode) mode openHAB doesn't refresh the sp_Temp (if in this mode I change the Frost-guard_Temp by browser openHAB doesn't refresh it, that remains 20,5°C)

derritter88 commented 6 years ago

Hi there,

just bought a Netatmo thermostat today and had the similar "not initialized" issue as mentioned above. @clinique With your last Nextcloud snapshot it seems to work so far! Not sure if it's necessary or not but I am using OH 2.2 stable.

derritter88 commented 6 years ago

I have created a button for controlling the setpoint temperature which is working fine so far. The only thing which seems strange to me is if I modify the temperature directly at Netatmo thermostat it is not changing the value within OpenHAB. it this an ordinary behaviour?

clinique commented 6 years ago

It should refresh upon next API call. Unfortunately there is not push mechanism for Thermostat API

derritter88 commented 6 years ago

Which is strange because my firewall shows connection attempts from f5.netatmo.net & f6.netatmo.net sourceport 443 to my external WAN address. Interessting fact...

clinique commented 6 years ago

Yes, Netatmo servers surely pushes information to the plug in order to update thermostat module but this is not documented.

derritter88 commented 6 years ago

Thanks for the information! How often is OpenHABs Netatmo binding getting updates via the API call? And would this value be changeable in a configuration setting?

derritter88 commented 6 years ago

Okay it seems there is a bug - I have enable the "last message" item at the thermostat and it shows that the last contact was arround noon - so 4 hours past from now.