ProudElm / packaging_solaredgeoptimizers

MIT License
3 stars 3 forks source link

Generalized getLifeTimeEnergy to _doPostRequest and implemented getAlerts #7

Closed gjdv closed 1 year ago

gjdv commented 1 year ago

Generalized getLifeTimeEnergy to _doPostRequest and implemented getAlerts. It returns info like the following:

'{"count":2,"totalAlertsCount":2,"alerts":
    [{"alertId":123456789,"siteId":1234567,"creationDate":1678076105000,"category":"ENVIRONMENTAL","impact":3,"componentType":"installation_name","alertType":"SNOW_ON_SITE_ALERT_TYPE","closeDate":1678119900000,"reporterId":1234567,"reporterSerialNumber":"","status":"CLOSED","serverStatus":"RESOLVED_BY_SYSTEM","muted":false,"lastTrigger":1678076105000,"open":false,"timeOffset":2,"description":"description","resolution":"resolution","isSupportAlert":false},
     {"alertId":123456789,"siteId":1234567,"creationDate":1678388038000,"category":"ENVIRONMENTAL","impact":3,"componentType":"installation_name","alertType":"SNOW_ON_SITE_ALERT_TYPE","closeDate":1678723200000,"reporterId":1234567,"status":"CLOSED","serverStatus":"RESOLVED_BY_SYSTEM","muted":false,"lastTrigger":1678616107000,"open":false,"timeOffset":2,"description":"description","resolution":"resolution","isSupportAlert":false}
    ]
}'

Note: this might require FULL_ACCESS rights in the SE portal, as opposed to DASHBOARD_AND_LAYOUT

ProudElm commented 1 year ago

Ah never thought off checking the alerts from the portal site. I will take a look.

gjdv commented 1 year ago

Just exploring to build some automated notification in case of problems :)

Maybe just to clarify the note: I do have FULL_ACCESS rights, but before I got those, I had the default DASHBOARD_AND_LAYOUT rights, which hides (amongst others) the alerts in the web-view. Not sure if it also blocks the api calls if you don't have FULL_ACCESS rights.

ProudElm commented 1 year ago

Yes i see, that could be a problem when with users who dont have those rights. I think i have them because i can see alerts on the main page. Now to find some free time to play arround :-)