Giter VIP home page Giter VIP logo

Comments (2)

userx14 avatar userx14 commented on August 17, 2024

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

from omblepy.

userx14 avatar userx14 commented on August 17, 2024

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

from omblepy.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.