Closed shred86 closed 2 years ago
I wouldn't wait for the rewrite. Just decide if this makes sense on it's own and do the breaking change then. Hopefully it includes some specific benefits on the solar side to encourage people to update.
Sounds good! Just made a PR and it won't introduce a breaking change.
Currently
self._site_name
in power.py is being set usingdata.get("site_name", f"{self._energy_site_id}")
. However, looking at the JSON response data,site_name
appears to be defined in thesite_info
endpoint (akaSITE_CONFIG
). It doesn't look like that endpoint is every being used, onlylive_status
(akaSITE_DATA
) andproducts
(akaPRODUCT_LIST
), meaning it will always be set to theself._energy_site_id
.I think the best solution might be to simply pull the JSON data from
site_info
when the integration initializes and append that to theenergysite
dictionary. The issue this introduces though is it would be a breaking change since right now we're setting_uniq_name
to beself._name
, so all the power sensors would be recreated and the old ones would become unavailable.I'm not sure if the major rewrite is still underway but perhaps we can just introduce all of these changes then so we just have one big change with breaking changes.
Of note, I noticed when I first looked at the JSON response of
site_info
, it did not have a key forsite_name
. I posted that response here. When I looked at it again today, I noticed it containedsite_name
as well as more values for my home address. I did try messing around with changing my site name in the Tesla app when I was working on this previously, and I ended up reverting the name back toMy Home
, so I'm wondering if once you set the name in the app, it shows up in the JSON response. Here's the full JSON response from today: