Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recovering device's internal clock #4

Closed
vulcainman opened this issue Sep 28, 2022 · 2 comments
Closed

Recovering device's internal clock #4

vulcainman opened this issue Sep 28, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@vulcainman
Copy link

Thanks for your nice project, it gave me a lot of information about Omron devices' Bluetooth protocol. I would like to implement other features in relation with devices' internal clock (how to recover it, to reconfigure it, etc...) and I've several question :

  1. Do you have any information concerning devices' internal clock ?
  2. How did you get EEPROM address and data format for measurement information (official documentation reverse engineering, communication analysis, EEPROM diff analysis) ?

Thanks !

@userx14
Copy link
Owner

userx14 commented Sep 28, 2022

Hi @vulcainman,

on hem-7600 it should be a read around 0x276, and the first byte is the year+2000, the second byte the month and so on.
Deleted the comment to protect personal info, check your mail 😄, thanks for the info.

Best,
Benjamin

Repository owner deleted a comment from vulcainman Sep 28, 2022
@userx14 userx14 added the enhancement New feature or request label Sep 30, 2022
@userx14
Copy link
Owner

userx14 commented Oct 18, 2022

For future reference the clock sync is now included in the HEM-7322 driver in the current development branch

def deviceSpecific_syncWithSystemTime(self):
timeSyncSettingsCopy = self.cachedSettingsBytes[self.settingsTimeSyncBytesSlice]
#read current time from cached settings bytes
month, year, hour, day, second, minute = [int(byte) for byte in timeSyncSettingsCopy[2:8]]
logger.info(f"device is set to date: {datetime.datetime(year + 2000, month, day, hour, minute, second).strftime('%Y-%m-%d %H:%M:%S')}")
#write the current time into the cached settings which will be written later
currentTime = datetime.datetime.now()
setNewTimeDataBytes = timeSyncSettingsCopy[0:2]
setNewTimeDataBytes += bytes([currentTime.month, currentTime.year - 2000, currentTime.hour, currentTime.day, currentTime.second, currentTime.minute])
setNewTimeDataBytes += bytes([0x00, sum(setNewTimeDataBytes) & 0xff]) #first byte does not seem to matter, second byte is crc generated by sum over data and only using lower 8 bits
self.cachedSettingsBytes[self.settingsTimeSyncBytesSlice] = setNewTimeDataBytes
logger.info(f"settings updated to new date {currentTime.strftime('%Y-%m-%d %H:%M:%S')}")
return

@userx14 userx14 closed this as completed Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants