In the service example text it says reserve_percent so I was using that.
I guess that’s the problem. Thanks.
hi all, trying to implement the same fix. I’ve copied the code as suggested. on reload I get:
Error setting up entry Tesla Gateway for tesla_gateway
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 248, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
AttributeError: module 'custom_components.tesla_gateway' has no attribute 'async_setup_entry'
I haven’t done anything specific to enable the “teslapy” module that is referenced - I can’t figure out how to do that?
ian
The teslapy
module is downloaded automatically by homeassistant when its defined in the manifest.json
file. You should have an entry like this in custom_components/tesla_gateway/manifest.json
:
"requirements": ["teslapy==1.1.0"],
You should be getting some other during initialization before the error you posted. The error you posted seem to indicate that the python file was not able to load (could be because of the missing requirement to teslapy
).
Ive still not been able to get it working. I get…
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/setup.py”, line 242, in _async_setup_component
result = await task
File “/usr/local/lib/python3.8/asyncio/coroutines.py”, line 124, in coro
res = func(*args, **kw)
File “/config/custom_components/tesla_gateway/init.py”, line 30, in async_setup
domain_config = config[DOMAIN]
KeyError: ‘tesla_gateway’
@PeterP can you give me permissions on that repo? I am getting:
Pushing to https://github.com/carboncoop/tesla-gateway-ha-component.git
remote: Permission to carboncoop/tesla-gateway-ha-component.git denied to estebanpapp.
fatal: unable to access 'https://github.com/carboncoop/tesla-gateway-ha-component.git/': The requested URL returned error: 403
that looks like you dont have tesla_gateway
in your configuration.yaml
I got the message from github that you just updated - thank you. I updated the custom component in HACS and reloaded HA, but still getting the same error message
2021-05-05 16:34:55 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Tesla Gateway for tesla_gateway
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 248, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
AttributeError: module 'custom_components.tesla_gateway' has no attribute 'async_setup_entry'
there are no other error messages in the HA log.
tesla_gateway:
section in configuration.yaml is present, with my username and password present.
Yes, you’re right. I added this into configuration.yaml:
tesla_gateway:
username: !secret tesla_username
password: !secret tesla_password
… and put the username and password into secrets.yaml to fix the problem.
Interesting to note that the version from carboncoop on Github originally worked without these (before Tesla changed the api recently) With that version I was prompted for the username and password when adding the integration.
Anyway, it’s up and running now, thanks very much for your help.
ah, looks like I broke that…
@peteretep FYI seems you added config flow to the integration and I stomp on it, sorry! I will try to add it back
@estebanp / @peteretep, I’m trying to follow the steps to getting this working (still pretty new to HA as well). I’ve got the HACS integration setup, but when I try to add the Integration via Configuration>Integrations>Add Integration (where you are prompted to login) I receive an unknown error when trying to login. I’ve verified that I am using the same credentials I use to log into Tesla.com. Any ideas?
Just added this last night and wanted to give some pointers. So there is no need to add the integration, just the credentials into configuration.yaml.
Then after reboot you’ll find the service calls in dev tools that you can use.
All I have used to date is setting the mode to backup and self_consumption. What are the commands to set it to TOU balanced and TOU cost savings? I saw autonomous but not sure if that’s current.
I will be upgrading my PW1 to a PW2 in the next few weeks and am looking forward to using this integration - thank you for creating it!
I’d like to find out how frequently the sensor readings get udpated. From the HA integration page it looks like this is a local polling integration, so I assume HA gets the current value of the sensors from the PW whenever it polls?
Many thanks,
Andreas.
*** I’ve solved my issue, left this here as a lesson for noobs like me … indentation matters in YAML ***
Hi. I’ve been trying to get the Tesla Gateway custom component to work and unfortunately got stuck - hopefully somebody can help. I’ve installed HACS, and added the Tesla Gateway custom component (which I can see in HACS → Integrations). Unfortunately it doesn’t seem to allow me to ‘update information’ which I assume is where you would put in the username and password. So … instead I tried to add this information to the configuration.yaml in the following manner
tesla_gateway:
username: <my tesla username>
password: <my tesla password>
when I go to restart HA it gives me an error and prevents the restart with the following message
Component error: username - Integration ‘username’ not found. Component error: password - Integration ‘password’ not found. Invalid config for [tesla_gateway]: required key not provided @ data[‘tesla_gateway’][‘password’]. Got None required key not provided @ data[‘tesla_gateway’][‘username’]. Got None. (See ?, line ?).
I’m wary to restart manually (pull the plug) as it seems likely the experience won’t be fun. Any help would be much appreciated.
Are you all set now then? I love this control of the Powerwall, It is amazing! Kudos to estebanp for getting it working. I have a number of automations that I have now been able to configure.
Due to the unpredictable weather I currently have it set to charge to 100% on off peak and then put the reserve back down to 5% backup during the peak hours. Additionally I have also integrated the myEnergi Eddi to prioritise if the battery is over 70%.
Yes - thanks. I’m very appreciative that estebanp built the integration. Like a lot of others my automations maximise the usage of our solar generation while ensuring we don’t ever pay peak electricity rates.
My next level of optimisation requires a forecast of the solar generation, to decide if it is worth saving / charging the battery in the low rate period overnight. I’ve tried an integration with Solcast, but I haven’t been able to get the forecast to load correctly yet. Has anybody else got experience with Solcast, or a different integration that gives a forecast of solar production / irradiance?
My Solcast integration is working currently but the API is quite limited now and they have removed the upload ability. As of Thursday this week HA 2021.7 will have a built in integration for https://forecast.solar/
Thanks. forecast.solar looks like it will suit me, so will wait for 2021.7 and give it a go. How do you know that 2021.7 will come out around Thursday this week?
I seem to be getting these occasional errors when attempting to execute these service calls thru my automations.
Error executing service: <ServiceCall tesla_gateway.set_operation): real_mode=self_consumption>
~traceback error~
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='owner-api.teslamotors.com', port=443): Read timed out. (read timeout=10)
It’s odd that it doesn’t happen all the time… only occasionally. Any idea what might be causing this?