Wrong time specification: UTC instead of local time

All of the Zigbee modules (from 4 different producers)
react in the same (unwanted) way:
Whether I request the module data of “lastseen” or “lastupdated”
via http://INTERNALADDRESS:8080/api/APIKEY/sensors
or using requests.get(…) in Python does not matter.
The data are transmitted as UTC time data, although
operating system, RTC as well as Phoscon are set to the same local time.

P.S.:
I am using
RaspBee II on
Raspberry Pi 5b (OS: Pi Bookworm)

RaspBee Conditions:
Gateway Version 2.28.1
Firmware 26720700
Timezone Europe/Berlin


For an ALARM system that contains ZigBee as well as
other sensors and external cameras, activity times
should be comparable (identical zime zone).
However, for ZigBee modules the deCONZ time information
related to the contents of “lastupdated”
(typical example = 2025-04-23T21:58:53.200)
is given in UTC instead of local time.

After I found the Changelog entry 1.2.2
“fix lastupdated UTC to locale time”
of the ioBroker/deConz Adapter
from year 2021 or earlier,
I assume this bug will not be removed
within a reasonable amount of time.

Thus, below you can find a short PYTHON
workaround for converting
UTC time strings into local-time strings
(without explicit programming of the Gregorian
calendar and Daylight Saving Time rules):

import time
import calendar



def Convert_UTC_to_local(timeStr):
UTC_Tuple = time.strptime(timeStr[0:18], “%Y-%m-%dT%H:%M:%S”) # yields UTC struct_time
milliSecs = timeStr[20:22] # extra Treatment of milliseconds
totalSeconds = calendar.timegm(UTC_Tuple) # converts to seconds since the epoch
local_Tuple = time.localtime(totalSeconds) # converts to local struct_time
result = time.strftime(“%Y-%m-%dT%H:%M:%S.”, local_Tuple) + milliSecs # conv. to local string
return(result)