-
Notifications
You must be signed in to change notification settings - Fork 37
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
Editing Cooker Profiles #15
Comments
|
@syssi Thanks a lot for you work on this integration. |
Take a look at this PR: rytilahti/python-miio#832 I assume it implements everything you are looking for. |
Thanks for the hint. Looks interesting. I wonder if the format of ihcooker profiles differs much from what we have here. |
To answer your first question: If I remember correctly most of the recipe is a time series of target temperatures. I don't know the resolution. |
Thanks for all the hints, I think I got the very basic profile editing (time and max time only) with a dumb python script. import sys
import crc16
class CookerProfile():
data = bytearray()
def __init__(self, prof : str):
self.load(prof)
def load(self, profile):
while len(profile):
self.data = self.data + int(profile[:2],16).to_bytes(1,sys.byteorder)
profile = profile[2:]
def fixcrc(self):
crc = crc16.crc16xmodem(bytes(self.data[0:-2]))
self.data[-1] = (crc & 0xff)
self.data[-2] = ((crc >> 8) & 0xff)
def duration(self, duration_minutes = None):
if duration_minutes != None:
self.data[3] = int(duration_minutes / 60)
self.data[4] = duration_minutes % 60
d = self.data[3] * 60 + self.data[4]
print(f"duration: {self.data[3]} hrs {self.data[4]} min ({d} min)")
def duration_max(self, duration_minutes = None):
if duration_minutes != None:
self.data[5] = int(duration_minutes / 60)
self.data[6] = duration_minutes % 60
d = self.data[5] * 60 + self.data[6]
print(f"max duration: {self.data[5]} hrs {self.data[6]} min ({d} min)")
def dump(self):
pr = ''.join('{:02x}'.format(x) for x in self.data)
print(pr)
pdata = "0003E2011E040000280080000190551C0601001E00000000000001B8551C0601002300000000000001E0561C0600002E000000000000FFFF571C0600003000000000000000280A0082001E914E730E01001E82FF736E0610FF756E02690A1E75826E0269100F75826E0269100069005A0000000000000000CB"
cook = CookerProfile(pdata)
cook.duration()
cook.duration(10)
cook.duration_max()
cook.fixcrc()
cook.dump() I wonder if it's possible to add profile selection + time adjustment to the integration itself. |
Hello,
do you know the format of profile property in cooker_profile.json? Is it possible to decode it and make my own custom cooking profile?
Thank you.
The text was updated successfully, but these errors were encountered: