grahamwetzler / smart-meter-texas

Package to connect to and retrieve data from the unoffical Smart Meter Texas API
MIT License
14 stars 14 forks source link

Support 15min data for Surplus and Consume #142

Closed utdrmac closed 3 months ago

utdrmac commented 1 year ago

The current implementation of get15min only collects surplus generation. I would hazard a guess that most people don't generate surplus energy, and that most people are instead consumers.

This breaking change PR changes the returned object of get_15min from a simple [] array containing surplus data, to a dict {} containing two keys: surplus and consumed in which the values of each are arrays containing a datetime object and the surplus or consumed value.

Additionally, this PR modifies the yesterday datetime object to use more native features and only output a string for the API call.

grahamwetzler commented 1 year ago

Thanks again for the contribution. I'm getting an error though:

DEBUG:smart_meter_texas:Getting interval data for 2023-08-12
ERROR:smart_meter_texas:Error reading data: {'data': {'errorCode': '1', 'errorMessage': 'No Energy Data received from the respective TDSP'}}
DEBUG:smart_meter_texas:Getting interval data for 2023-08-11
Traceback (most recent call last):
  File "/Users/graham/Developer/smart_meter_texas/examples/get_15min.py", line 42, in <module>
    loop.run_until_complete(main())
  File "/Users/graham/.pyenv/versions/3.10.3/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/Users/graham/Developer/smart_meter_texas/examples/get_15min.py", line 36, in main
    await meter.get_15min(client)
  File "/Users/graham/Developer/smart_meter_texas/smart_meter_texas/__init__.py", line 171, in get_15min
    yesterday, datetime.time(hour, minute, 0)
ValueError: hour must be in 0..23