Surepetcare - HANDLER_INITIALIZING_ERROR (openHAB 4.0.4)

Hi all,

since a system restart yesterday I’m facing problems with the initialization of the surepetcare:bridge

HANDLER_INITIALIZING_ERROR
Text '2023-12-16T21:08:19.637892+00:00' could not be parsed at index 19
Exception
java.time.format.DateTimeParseException: Text '2023-12-16T21:08:19.637892+00:00' could not be parsed at index 19
	at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2052) ~[?:?]
	at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1954) ~[?:?]
	at org.openhab.binding.surepetcare.internal.utils.GsonZonedDateTimeTypeAdapter.deserialize(GsonZonedDateTimeTypeAdapter.java:79) ~[?:?]
	at org.openhab.binding.surepetcare.internal.utils.GsonZonedDateTimeTypeAdapter.deserialize(GsonZonedDateTimeTypeAdapter.java:1) ~[?:?]
	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) ~[?:?]
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:161) ~[?:?]
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:266) ~[?:?]
	at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41) ~[?:?]
	at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82) ~[?:?]
	at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61) ~[?:?]
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:161) ~[?:?]
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:266) ~[?:?]
	at com.google.gson.Gson.fromJson(Gson.java:1058) ~[?:?]
	at com.google.gson.Gson.fromJson(Gson.java:1129) ~[?:?]
	at com.google.gson.Gson.fromJson(Gson.java:1101) ~[?:?]
	at org.openhab.binding.surepetcare.internal.SurePetcareAPIHelper.updateTopologyCache(SurePetcareAPIHelper.java:140) ~[?:?]
	at org.openhab.binding.surepetcare.internal.handler.SurePetcareBridgeHandler.initialize(SurePetcareBridgeHandler.java:81) ~[?:?]
	at jdk.internal.reflect.GeneratedMethodAccessor48.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:147) ~[?:?]
	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]

The startup & login sequence looks ok as far as I can tell:

Binding Log
2023-12-17 14:06:33.400 [DEBUG] [iscovery.SurePetcareDiscoveryService] - Stopped Sure Petcare device background discovery
2023-12-17 14:06:37.005 [DEBUG] [e.internal.SurePetcareHandlerFactory] - createHandler - create handler for org.openhab.core.thing.internal.BridgeImpl@599f1d9f
2023-12-17 14:06:37.006 [DEBUG] [iscovery.SurePetcareDiscoveryService] - Starting Sure Petcare household discovery
2023-12-17 14:06:37.006 [DEBUG] [iscovery.SurePetcareDiscoveryService] - Scheduled topology-changed job every 12 hours
2023-12-17 14:06:37.009 [DEBUG] [nal.handler.SurePetcareBridgeHandler] - Initializing Sure Petcare bridge handler.
2023-12-17 14:06:37.009 [DEBUG] [nal.handler.SurePetcareBridgeHandler] - Login to SurePetcare API with username: patrik.gfeller@***
2023-12-17 14:06:37.010 [DEBUG] [etcare.internal.SurePetcareAPIHelper] - current MAC address: ***, device id: ***
2023-12-17 14:06:37.012 [DEBUG] [e.internal.SurePetcareHandlerFactory] - createHandler - create handler for org.openhab.core.thing.internal.ThingImpl@1c535532
2023-12-17 14:06:37.013 [DEBUG] [nal.handler.SurePetcareDeviceHandler] - Created device handler for type surepetcare:flapDevice
2023-12-17 14:06:37.013 [DEBUG] [e.internal.SurePetcareHandlerFactory] - createHandler - create handler for org.openhab.core.thing.internal.ThingImpl@8685da70
2023-12-17 14:06:37.014 [DEBUG] [e.internal.SurePetcareHandlerFactory] - createHandler - create handler for org.openhab.core.thing.internal.ThingImpl@8685da8b
2023-12-17 14:06:37.579 [DEBUG] [etcare.internal.SurePetcareAPIHelper] - Login successful
2023-12-17 14:06:37.580 [DEBUG] [nal.handler.SurePetcareBridgeHandler] - Login successful, updating topology cache
2023-12-17 14:06:37.825 [DEBUG] [etcare.internal.SurePetcareAPIHelper] - API execution successful, response: ***
2023-12-17 14:07:37.006 [DEBUG] [iscovery.SurePetcareDiscoveryService] - Starting Sure Petcare discovery scan

I wonder if the format of the timestamp in the API response did change - or if this is related to a local setting change I’m not aware of …

API Response (sanitized)
{
    "data": {
        "devices": [],
        "households": [
            {
                "id": 0,
                "name": "***",
                "share_code": "***",
                "created_user_id": 0,
                "timezone_id": 374,
                "version": "MTE=",
                "created_at": "2021-04-24T11:41:15+00:00",
                "updated_at": "2023-12-16T21:08:19.637892+00:00",
                "invites": [],
                "users": [],
                "timezone": {
                    "id": 374,
                    "name": "(UTC+02:00) Europe/Zurich",
                    "timezone": "Europe/Zurich",
                    "utc_offset": 7200,
                    "created_at": "2017-08-03T08:35:34+00:00",
                    "updated_at": "2017-08-03T08:37:15+00:00"
                }
            }
        ],
        "pets": [],
        "photos": [],
        "tags": [],
        "user": {}
    }
}

The problematic timestamp seems to be $.data.households[0].updated_at:

[
  "2023-12-16T21:08:19.637892+00:00"
]

It also has a different format to the other timestamps used in the json response. Can someone confirm this issue? Maybe it only happens if some setting was changed in the native app - I do not remember such a change tough.

If there’s no idea what I do wrong I will probably open an issue for the binding and have a look into the date/time parsing (e.g. if there are options to make it more tolerant for such changes).

any advice/response appreciated :slight_smile:,
Patrik

Environment
runtimeInfo:
  version: 4.0.4
  buildString: Release Build
locale: de-CH
systemInfo:
  configFolder: /openhab/conf
  userdataFolder: /openhab/userdata
  logFolder: /openhab/userdata/logs
  javaVersion: 17.0.7
  javaVendor: Debian
  osName: Linux
  osVersion: 6.2.0-39-generic
  osArchitecture: amd64
  availableProcessors: 4
  freeMemory: 525966832
  totalMemory: 1497366528
  startLevel: 100
addons:
  - automation-jsscripting
  - binding-androiddebugbridge
  - binding-astro
  - binding-chromecast
  - binding-comfoair
  - binding-exec
  - binding-feed
  - binding-harmonyhub
  - binding-hpprinter
  - binding-http
  - binding-icalendar
  - binding-jellyfin
  - binding-logreader
  - binding-mail
  - binding-mqtt
  - binding-network
  - binding-openweathermap
  - binding-samsungtv
  - binding-snmp
  - binding-sonos
  - binding-spotify
  - binding-surepetcare
  - binding-systeminfo
  - binding-unifi
  - binding-zwave
  - misc-openhabcloud
  - persistence-influxdb
  - persistence-mapdb
  - persistence-rrd4j
  - transformation-jinja
  - transformation-jsonpath
  - transformation-map
  - transformation-regex
  - voice-voicerss

surepetcare binding issue

Update:
I’ve created an issue after having a deeper look into this:

1 Like

I have the same parsing error here. I’m also on OH 4.0.4.

I have backported the fix from 4.1 now: org.openhab.binding.surepetcare-4.0.5-SNAPSHOT.jar

2 Likes