If you installed version 1.0.0 or 1.0.1, the time sync was setting the wrong date (January 1st). Please update immediately.
The timestamp was being encoded in big-endian instead of little-endian, causing the device to misinterpret the time. This has been fixed in version 1.0.2.
# Navigate to your integration directory
cd /config/custom_components/switchbot_meter_time_sync
# Backup the old file (optional)
cp coordinator.py coordinator.py.backup
# Replace with new version
# (Upload the new coordinator.py from version 1.0.2)
# Restart Home Assistant
ha core restart# Remove old version
rm -rf /config/custom_components/switchbot_meter_time_sync
# Restart to clear cache
ha core restart
# Copy new version
cp -r /path/to/new/switchbot_meter_time_sync /config/custom_components/
# Restart again
ha core restartIf you're using the File Editor add-on:
- Navigate to
/config/custom_components/switchbot_meter_time_sync/coordinator.py - Find line 91 (around line 91):
command.extend(struct.pack('>I', timestamp))
- Change it to:
command.extend(struct.pack('<I', timestamp))
- Find line 83 comment and update it too:
# Format: 0x57 (magic) + 0x09 (time cmd) + 0x01 (subcmd) + timestamp (4 bytes, LITTLE endian) - Save the file
- Restart Home Assistant: Settings → System → Restart
After updating:
- Press the time sync button
- Check your SwitchBot Meter display
- The time should now show the current date and time
- No longer showing January 1st at 2:00 AM
Before (Wrong):
struct.pack('>I', timestamp) # Big-endianAfter (Correct):
struct.pack('<I', timestamp) # Little-endian (BLE GATT standard)The > means big-endian (most significant byte first)
The < means little-endian (least significant byte first)
BLE GATT protocol requires little-endian for multi-byte fields.
- Your device configuration stays the same
- Automations continue to work
- No need to re-add the device
Just update the file and restart!
See CHANGELOG.md for full technical details.