alandtse / tesla

Tesla custom integration for Home Assistant. This requires a refresh token be generated by third-party apps to login.
Apache License 2.0
601 stars 99 forks source link

Expose 'permission to export' as an additional export setting of 'None' #1051

Open ChrisJ60 opened 1 month ago

ChrisJ60 commented 1 month ago

Is your feature request related to a problem? Please describe. I'd like to be able to disable all exporting for my Powerwall system. The excellent Net Zero app provides this capability, It does this by manipulating the Powerwall parameter 'permission to export'. It exposes this as a third export option (Everything, Solar, None) in its settings.

Describe the solution you'd like I would like the Tesla integration to test and manipulate the value of the 'permission to export' parameter. If it is set to No (or equivalent) then this should be exposed as an export setting of 'None'. Similarly if the user selects an export setting of None through the integration then this parameter should be set to 'No' (or equivalent). This parameter overrides the regular Solar/Ebverything settings so it needs to be manipulated correctly in conjunction with those (e.g. switching from None to Solar requires two parameter changes; set permission to export to Yes and set the export setting to Solar).

Describe alternatives you've considered Currently if I want to prevent any exporting I switch my system into off-grid mode. That achieves my ends but of course it has other ramifications which are not always desirable.

Additional context This would be very useful for many Powerwall owners I think.

skipishere commented 1 month ago

Looking at the official app, for me there is only an option of Solar or Everything and the permission to export isn't available from the UI Reading the docs it might be that this isn't available to most users, so depending on how the API is built this may not be available for everyone (I had to contact Tesla to get the permission to export enabled)

ChrisJ60 commented 1 month ago

Looking at the official app, for me there is only an option of Solar or Everything and the permission to export isn't available from the UI Reading the docs it might be that this isn't available to most users, so depending on how the API is built this may not be available for everyone (I had to contact Tesla to get the permission to export enabled)

Yes, the 'None' option doesn't show in the Tesla app but it seems to work reliably for all Powerwalls (according to the developer of Net Zero). I was sceptical but I tested it today with my Powerwall 2 system and its does indeed work.

The API docs here: https://developer.tesla.com/docs/fleet-api/endpoints/energy#grid-import-export seem to indicate there are 3 allowed values; battery_ok, pv_only, and never and they don't mention there any caveats or limitations. Be nice to enable the never option in the integration.