• Slight tweak needed

    You mean changing parseInt(...,16) to parseInt(...,32)? If so that's definitely not what you want :) The 16 refers to hexadecimal, not to it being Uint16 :)

    There are 8 characters, so 8 chars*4 bits in hexadecimal = 32 for the Uint32.

    Would it be possible for you to explain...

    You mean the history usage specifically?

    So every time there's a pulse of light counter.inc gets fired, which updates the history.

    It's got two parts - there's a rolling history which is just an array. Every time inc is called the last element is incremented - however if an hour has passed then it shifts the array up one and moves on to the next hour. That sounds like what you actually want for firebase - not the array, but just store a count and upload that every hour.

    The second part is just a super simple historical graph. There's an array for each month of the year, one for day of the week, etc - and they're just incremented for the current day each time inc is called. In means after a few weeks you should start to see some decent patterns (like the difference between weekday and weekend, or the time of day).


Avatar for Gordon @Gordon started