Skip to content

typo in Class Unknown? #8

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

Open
pete-os opened this issue Jun 12, 2022 · 6 comments
Open

typo in Class Unknown? #8

pete-os opened this issue Jun 12, 2022 · 6 comments

Comments

@pete-os
Copy link

pete-os commented Jun 12, 2022

Hi

I think there may be a typo in line 38 of glowmarkt.py:-

    return "%s" % self.valu

missing a terminal 'e'?

doesn't really break anything, just generates additional error message.

BTW - thanks for pyglowmarkt - very useful!

Rgds

Pete

@cybermaggedon
Copy link
Owner

Thanks for the report @pete-os appreciated, and fixed. Glad you like the package.

@cybermaggedon
Copy link
Owner

Fixed in v0.5.4.

@pete-os
Copy link
Author

pete-os commented Jun 27, 2022

Thanks for the report @pete-os appreciated, and fixed. Glad you like the package.

No problem.

I’ve been messing around with this since and I've worked out a few things that you might find interesting:-

1. How to get a full history

I've used the following approach..

Calculate dt_to(now) # end of last complete month, week, day, half hour relative to “now”
Calculate dt_from # dt_to minus 10 days, 31 days , 31 days, 6 weeks, 12 months, 12 months

Determine dt_start_of data # use Bright app, or detect when readings are all zero.

While dt_to > dt_start_of_data

get_readings (dt_from, dt_to, period)
(do something with readings)
    
Recalculate (dt_from, dt_to).         # set dt_to = dt_from, recalc dt_from 

2. Getting data to agree with data from Bright App.

I managed to get the history to agree exactly (ignoring recurring fractions) with the data from Bright for all periods by:

  • forcing the use of UTC with no DST throughout
  • using an offset of -60 as per your code / API docs.
  • making sure dt_from is aligned to the start of month / week / day ... as appropriate

3. Self-consistent data across different periods.

It seems that the timestamp for a given reading refers to the start time for the given period. For example:-

|--------PT30M-----------------|   |--------PT1H-----------------|
|--Time----|--Reading-----------|   |--Reading---------|----Time--|

 23:30           0.239                                    -                              -
 23:00           0.239                                   0.478                    23:00

 22:30           0.284                                    -                              -
 22:00           0.679                                   0.963                    22:00

This works for all periods

Any other alignment (timestamp == end of period, timestamp == middle of period) will result in data not being conistent across periods (PT30M vs PT1H etc)

4. A couple of potential issues in your existing code

Depending on your intentions, line 207 of glowdata.py might not be correct. The current code is:

elif period == "PT30M":
    when = when.replace(minute=int(when.minute / 30),

Did you mean to round to the end of the last complete 30 mins?

  .. when = when.replace(minute=int(when.minute / 30) *30,

The other potential issue (depending on your intention) is weekly and monthly data should start on a Monday or 1st of the month respectively according to the API doc.

Cheers

@cybermaggedon cybermaggedon reopened this Jun 27, 2022
@cybermaggedon
Copy link
Owner

@pete-os much thanks for the write-up, much appreciated. I've been playing with getting some of this in as improvements. Current snag is my meter stopped being Smart, so I don't have test data currently.

@pete-os
Copy link
Author

pete-os commented Jul 29, 2022

No problem. I've also started looking at the new Glow Local MQTT data for instant power . The new feed is a lot easier to handle than their public MQTT data.

@cybermaggedon
Copy link
Owner

Interesting! I have a local glow device (which is also not working due to meter problems), very interested to hear how you get on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants