Skip to content

Commit

Permalink
Merge pull request #906 from alandtse/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse authored Mar 14, 2024
2 parents 52d782d + 9b09753 commit bb82118
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
74 changes: 74 additions & 0 deletions .github/ISSUE_TEMPLATE/issue_powerwall.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Powerwall Issue
description: Create a report to help us improve
title: "Powerwall Issue: "
labels: ["triage", "powerwall"]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Before you open a new issue, search through the existing open issues and closed issues to see if others have had the same problem.
options:
- label: I have searched both the existing open issues & recently closed issues and did not find a duplicate of this issue.
required: true
- type: markdown
attributes:
value: |
Issues not containing the minimum requirements will be closed:
- Issues without a description (using the header is not good enough) will be closed.
- Issues without debug logging will be closed.
- type: input
id: version_hacs
attributes:
label: Version of the Tesla component
description: You can find this under HACS -> Integrations -> Tesla. If you are not using the newest version, download and try that before opening an issue
placeholder: ex. v3.19.3
validations:
required: true
- type: input
id: version_tesla
attributes:
label: Version of the Powerwall Gateway software
description: Open the Tesla app -> Select powerwall -> Settings -> My Home Info -> Powerwall Gateway Version
placeholder: ex. 23.44.0 eb113390
validations:
required: true
- type: input
id: model_powerwall
attributes:
label: Model
description: The model of the Powerwall
placeholder: ex. 2
validations:
required: true
- type: textarea
attributes:
label: Current Behavior
description: A concise description of what you're experiencing.
validations:
required: true

- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: true

- type: textarea
attributes:
label: Debug logs
description: Enable the debug logs ([In Home Assistant](https://my.home-assistant.io/redirect/integration/?domain=tesla_custom) & click `Enable debug logging`)
render: true
placeholder: |
Your logs here
validations:
required: true

- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering
validations:
required: false
32 changes: 16 additions & 16 deletions custom_components/tesla_custom/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ def _async_schema(self, api_proxy_enable: bool):
}
)

api_proxy_cert = api_proxy_url = client_id = None
if api_proxy_enable:
# autofill fields if HTTP Proxy is running as addon
if "SUPERVISOR_TOKEN" in os.environ:
api_proxy_cert = "/share/tesla/selfsigned.pem"

_LOGGER.debug("Running in supervised environment")
# find out if addon is running from normal repo or local
req = httpx.get(
"http://supervisor/addons",
Expand All @@ -162,21 +162,21 @@ def _async_schema(self, api_proxy_enable: bool):
if addon["name"] == "Tesla HTTP Proxy":
addon_slug = addon["slug"]
break
if not addon_slug:
_LOGGER.warning("Unable to communicate with Tesla HTTP Proxy addon")

# read Client ID from addon
req = httpx.get(
f"http://supervisor/addons/{addon_slug}/info",
headers={
"Authorization": f"Bearer {os.environ['SUPERVISOR_TOKEN']}"
},
)
client_id = req.json()["data"]["options"]["client_id"]
api_proxy_url = "https://" + req.json()["data"]["hostname"]

else:
api_proxy_url = client_id = api_proxy_cert = None
try:
# read Client ID from addon
req = httpx.get(
f"http://supervisor/addons/{addon_slug}/info",
headers={
"Authorization": f"Bearer {os.environ['SUPERVISOR_TOKEN']}"
},
)
client_id = req.json()["data"]["options"]["client_id"]
api_proxy_url = "https://" + req.json()["data"]["hostname"]
api_proxy_cert = "/share/tesla/selfsigned.pem"
_LOGGER.debug("Found addon: %s", addon_slug)
except NameError:
_LOGGER.warning("Unable to communicate with Tesla HTTP Proxy addon")

schema = schema.extend(
{
Expand Down

0 comments on commit bb82118

Please sign in to comment.