SuperMemoAssistant icon indicating copy to clipboard operation
SuperMemoAssistant copied to clipboard

Method for Automatic SleepChart Data Input

Open rajlego opened this issue 5 years ago • 9 comments

Sleep chart is a bit of a pain because I have to manually input data into it. It would be nice if (maybe using IFTT) there were some way to have data automatically inputted into sleep chart.

rajlego avatar Feb 15 '20 00:02 rajlego

This feature requires additional reverse engineering of SuperMemo to unlock the required functionalities

alexis- avatar Feb 16 '20 06:02 alexis-

Hmm, I was thinking it could be done by directly editing the sleepchart file. I'm not sure if it would be worth it if it requires too much work, I'm not sure how many people would actually use it aside from me.

rajlego avatar Feb 16 '20 10:02 rajlego

I've never used sleep chart before. If there is a file, it might be easier.

alexis- avatar Feb 17 '20 16:02 alexis-

Supermemo Stores it in a binary file sleep.tim Here is what i managed to figure out

         Have to do with months
                |
      /---------------\
      |               |
00 18 C2 45    55 18 C2 45    FF FF 00 00
\----------/  \----------/    \----------/
       |            |              |
start timestamp    end timestamp    some padding bytes, they never changed over a recording period of a 6 months

if you can do a quick analysis i'll bundle it up into a plugin/service. I tried a lot of stuff but failed tbh.

ghost avatar Aug 23 '20 03:08 ghost

http://supermemopedia.com/wiki/Format_for_importing_sleep_data_into_SuperMemo_Sleep_Chart

Here's Woz's explanation of the format for CSV sleep data imports. May differ with the format of the .TIM file though.

bjsi avatar Aug 24 '20 14:08 bjsi

 0000 0000 0001 1000 1100 0010 0100 0101
   0   0    1    8     C    C    4    5

Assuming:
 Hr (5 bits)       Min(6 bits)
 0 - 24            0 - 60
 00000             000000       110001100001001000101

 00 18 C2 45  55 18 C2 45   FF FF 00 00 | 00:00 - 01:00 1 Jan 2017  6211 days
 00 80 CD 45  55 80 CD 45   FF FF 00 00 | 00:00 - 01:00 1 Jan 2018  6576 days
 00 E8 D8 45  55 E8 D8 45   FF FF 00 00 | 00:00 - 01:00 1 Jan 2019  6941 days
 00 50 E4 45  55 50 E4 45   FF FF 00 00 | 00:00 - 01:00 1 Jan 2020  7306 days

using this converter nothing makes sense honestly

ghost avatar Aug 25 '20 00:08 ghost

@AM429 If you're going down this path, you could try https://www.sweetscape.com/010editor/

You can define structures and apply them to files. Very handy for reverse engineering. That's what I used for SM files. I've attached examples below.

SuperMemoRE.zip

alexis- avatar Aug 25 '20 05:08 alexis-

image

bjsi avatar Oct 07 '20 14:10 bjsi

Can confirm the above is correct - I was able to read my sleep chart data from the sleep.tim file. I created a project here to start working on enabling writing to the file using data from sleep trackers.

bjsi avatar Oct 08 '20 11:10 bjsi