Skip to content

Commit e9bcdfb

Browse files
authored
add production_telemetry to the API (#9)
1 parent adc41d9 commit e9bcdfb

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

utils/enlightenAPI_v4.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,19 @@ def inverter_summary(self):
8787
result = json.loads(response.text)
8888
return result
8989

90+
def production_telemetry(self):
91+
'''
92+
Run the enlighten API telemetry/production_micro route (https://developer-v4.enphase.com/docs.html).
93+
This route returns the telemetry for all the production micros of a system.
94+
It will return the default 'day' granularity i.e. start from midnight today in 5 minutes increments
95+
'''
96+
print(self.__log_time() + "Pulling EnlightenAPI inverter summary...")
97+
url = f'{self.config["api_url"]}api/v4/systems/{self.config["system_id"]}/telemetry/production_micro?key={self.config["app_api_key"]}'
98+
response = requests.get(url, headers={'Authorization': 'Bearer ' + self.config["access_token"]})
99+
self.__assert_success(response)
100+
result = json.loads(response.text)
101+
return result
102+
90103
def __init__(self, config):
91104
'''
92105
Initialize the englightAPI class

0 commit comments

Comments
 (0)