Tesla Battery Gateway Plugin

User avatar
GlennNZ
Posts: 1873
Joined: Sun Dec 07, 2014 3:33 pm
Location: Central Coast, Australia

Re: Tesla Battery Gateway Plugin

Post by GlennNZ »

Hi,

Sorry - with the API control that is used it (well at least used to) needs to turn off gateway forcibly, reload the changed settings and then restart gateway. Basically forces off and then restarts.

The Tesla control app wouldn’t have the same restrictions.

Hence my reluctance to forcibly close gateway to change settings (basically pressing the red button on the web interface). But will have a look and see whether anything changed.

Glenn


Sent from my iPad using Tapatalk
petematheson
Posts: 847
Joined: Sun Sep 14, 2014 9:51 am
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

Post by petematheson »

Ah I got ya now Ted.

Be good to know if that is 100% definitely the case, what a bugger if they have put that in their api!
petematheson
Posts: 847
Joined: Sun Sep 14, 2014 9:51 am
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

Post by petematheson »

GlennNZ wrote:Hi,

Sorry - with the API control that is used it (well at least used to) needs to turn off gateway forcibly, reload the changed settings and then restart gateway. Basically forces off and then restarts.

The Tesla control app wouldn’t have the same restrictions.

Hence my reluctance to forcibly close gateway to change settings (basically pressing the red button on the web interface). But will have a look and see whether anything changed.

Glenn


Sent from my iPad using Tapatalk
I just read a Facebook post that has suggested that after firmware 1.46 (what I’m on) it no longer needs a gateway reboot after making changes.
Which would explain why I’m not seeing any gateway reboots at the moment.

Image


Sent from my iPhone using Tapatalk
petematheson
Posts: 847
Joined: Sun Sep 14, 2014 9:51 am
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

Post by petematheson »

It seems that this is now 100% possible if we can get the ability to change modes into the plugin!

“Well, 1.46 has stopped the gateway restarts on mode change for me. After some zero Agile prices this morning and switching between Sled Powered and Backup there were no blank periods - so that bit is good”

Is it possible to get this included in the plugin, as this would be incredible to significantly drop the cost of charging the PW!


Sent from my iPhone using Tapatalk
User avatar
GlennNZ
Posts: 1873
Joined: Sun Dec 07, 2014 3:33 pm
Location: Central Coast, Australia

Re: Tesla Battery Gateway Plugin

Post by GlennNZ »

Hi

Not sure a facebook post counts as 100%!

But, have looked into and updated plugin, problem is can't get installer password for my powerwall (is on 1.46)
Can't reset it either (doesn't want to accept serial number)

Not sure whether they have changed installer password completely or just me.

Can login as user, with plugin and review backup/settings etc. but you need installer login to change the mode of the battery..

So currently stuck.

Check you own, login to battery and see if can login as installer?

Can try this version 0.4.0
https://github.com/Ghawken/TeslaBattery ... digoPlugin

Adds plugin config settings needed.
Need to be able to login as Installer (using Serial Number of Gateway). Can test on gateway webpage.
If you can login - there is an action group to change the operational mode of the battery
Currently untested - until I can sort out my login


Glenn
petematheson
Posts: 847
Joined: Sun Sep 14, 2014 9:51 am
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

Post by petematheson »

I'm in with the installer details :)

Upgraded to the new plugin but getting some errors on devices.

Tesla Battery Debug ReturnCode:0
Tesla Battery Debug SUCCESS Text :{u'timezone': u'Europe/London', u'max_system_energy_kWh': 0, u'site_name': u'Matheson Manor', u'max_system_power_kW': 0}
Tesla Battery Debug Json results:{u'timezone': u'Europe/London', u'max_system_energy_kWh': 0, u'site_name': u'Matheson Manor', u'max_system_power_kW': 0}
Tesla Battery Debug sendcommand r.json result:{u'timezone': u'Europe/London', u'max_system_energy_kWh': 0, u'site_name': u'Matheson Manor', u'max_system_power_kW': 0}
Tesla Battery Debug {u'timezone': u'Europe/London', u'max_system_energy_kWh': 0, u'site_name': u'Matheson Manor', u'max_system_power_kW': 0}
Tesla Battery Debug ThreadSendCOmmand called. Number of Active Threads:3
Tesla Battery Debug sendcommand called
Tesla Battery Debug HTTPS CURL result:
Tesla Battery Debug ReturnCode:0
Tesla Battery Debug SUCCESS Text :{u'nominal_system_power_kW': 5, u'site_name': u'Matheson Manor', u'state': u'*', u'country': u'United Kingdom', u'max_site_meter_power_kW': 1000000000, u'retailer': u'*', u'grid_code': u'50Hz_230V_1_G99_2018_UK', u'grid_voltage_setting': 230, u'grid_phase_setting': u'Single', u'min_site_meter_power_kW': -1000000000, u'grid_freq_setting': 50, u'max_system_power_kW': 0, u'timezone': u'Europe/London', u'distributor': u'Scottish and Southern Energy', u'nominal_system_energy_kWh': 13.5, u'max_system_energy_kWh': 0, u'region': u'G99:2018', u'utility': u'*'}
Tesla Battery Debug Json results:{u'nominal_system_power_kW': 5, u'site_name': u'Matheson Manor', u'state': u'*', u'country': u'United Kingdom', u'max_site_meter_power_kW': 1000000000, u'retailer': u'*', u'grid_code': u'50Hz_230V_1_G99_2018_UK', u'grid_voltage_setting': 230, u'grid_phase_setting': u'Single', u'min_site_meter_power_kW': -1000000000, u'grid_freq_setting': 50, u'max_system_power_kW': 0, u'timezone': u'Europe/London', u'distributor': u'Scottish and Southern Energy', u'nominal_system_energy_kWh': 13.5, u'max_system_energy_kWh': 0, u'region': u'G99:2018', u'utility': u'*'}
Tesla Battery Debug sendcommand r.json result:{u'nominal_system_power_kW': 5, u'site_name': u'Matheson Manor', u'state': u'*', u'country': u'United Kingdom', u'max_site_meter_power_kW': 1000000000, u'retailer': u'*', u'grid_code': u'50Hz_230V_1_G99_2018_UK', u'grid_voltage_setting': 230, u'grid_phase_setting': u'Single', u'min_site_meter_power_kW': -1000000000, u'grid_freq_setting': 50, u'max_system_power_kW': 0, u'timezone': u'Europe/London', u'distributor': u'Scottish and Southern Energy', u'nominal_system_energy_kWh': 13.5, u'max_system_energy_kWh': 0, u'region': u'G99:2018', u'utility': u'*'}
Tesla Battery Debug {u'nominal_system_power_kW': 5, u'site_name': u'Matheson Manor', u'state': u'*', u'country': u'United Kingdom', u'max_site_meter_power_kW': 1000000000, u'retailer': u'*', u'grid_code': u'50Hz_230V_1_G99_2018_UK', u'grid_voltage_setting': 230, u'grid_phase_setting': u'Single', u'min_site_meter_power_kW': -1000000000, u'grid_freq_setting': 50, u'max_system_power_kW': 0, u'timezone': u'Europe/London', u'distributor': u'Scottish and Southern Energy', u'nominal_system_energy_kWh': 13.5, u'max_system_energy_kWh': 0, u'region': u'G99:2018', u'utility': u'*'}
Tesla Battery Creating Tesla Site Info Device
Tesla Battery Debug fillsiteinfo called
Tesla Battery Debug data:{u'nominal_system_power_kW': 5, u'site_name': u'Matheson Manor', u'state': u'*', u'country': u'United Kingdom', u'max_site_meter_power_kW': 1000000000, u'retailer': u'*', u'grid_code': u'50Hz_230V_1_G99_2018_UK', u'grid_voltage_setting': 230, u'grid_phase_setting': u'Single', u'min_site_meter_power_kW': -1000000000, u'grid_freq_setting': 50, u'max_system_power_kW': 0, u'timezone': u'Europe/London', u'distributor': u'Scottish and Southern Energy', u'nominal_system_energy_kWh': 13.5, u'max_system_energy_kWh': 0, u'region': u'G99:2018', u'utility': u'*'}
Tesla Battery Debug ThreadSendCOmmand called. Number of Active Threads:2
Tesla Battery Debug sendcommand called
Tesla Battery Debug HTTPS CURL result:
Tesla Battery Debug ReturnCode:0
Tesla Battery Debug ReturnCode:0
Tesla Battery Debug Text :<closed file '<fdopen>', mode 'rb' at 0x1071be9c0>
Tesla Battery Debug Error Running command. ?Powerwall offline
Tesla Battery Debug Offline
Tesla Battery Debug ThreadSendCOmmand called. Number of Active Threads:3
Tesla Battery Debug sendcommand called
Tesla Battery Debug HTTPS CURL result:
Tesla Battery Debug ReturnCode:0
Tesla Battery Debug ReturnCode:0
Tesla Battery Debug Text :<closed file '<fdopen>', mode 'rb' at 0x1071beae0>
Tesla Battery Debug Error Running command. ?Powerwall offline
Tesla Battery Debug ThreadSendCOmmand called. Number of Active Threads:3
Tesla Battery Debug sendcommand called
Tesla Battery Debug HTTPS CURL result:
Tesla Battery Debug ReturnCode:0
Tesla Battery Debug ReturnCode:0
Tesla Battery Debug Text :<closed file '<fdopen>', mode 'rb' at 0x1071be930>
Tesla Battery Debug Error Running command. ?Powerwall offline
Tesla Battery Debug deviceStartComm() method called.
User avatar
GlennNZ
Posts: 1873
Joined: Sun Dec 07, 2014 3:33 pm
Location: Central Coast, Australia

Re: Tesla Battery Gateway Plugin

Post by GlennNZ »

Hi

Okay - so some of the calls to the Powerwall don’t return - not sure why as haven’t updated any of this. Haven’t changed any of the non action group stuff at all -but can have a look a it.

Try the new action group set operational mode (having set the pluginconfig settings)


Sent from my iPad using Tapatalk
petematheson
Posts: 847
Joined: Sun Sep 14, 2014 9:51 am
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

Post by petematheson »

Logged in to check and strangely it's all reporting OK now, and all devices create OK. Weird.
It gives me a login error when trying to run an action to set it to backup.
Debug below:

Might be because it's trying to use a username of 'Installer' and a password of the serial number?
I can't manually set the password, it just generates a random new one when I reset mine.

Tesla Battery Debug logLevel = 10
Tesla Battery Debug User prefs saved.
Tesla Battery Debug Debugging on (Level: 10)
Action Group Tesla PW Backup
Tesla Battery Debug setFanSpeed Called as Action.
Tesla Battery Debug Thread Send Login Basic called. Number of Active Threads:2
Tesla Battery Debug Calling https://192.168.0.161/api/login/Basic with payload:{'username': 'installer', 'force_sm_off': False, 'password': u'TG119147001K79', 'email': u'pete@xxxxxxx}
Tesla Battery Error {"code":401,"error":"bad credentials","message":"Login Error"}
Tesla Battery Debug Change Operation called. Number of Active Threads:2
Tesla Battery Debug Calling https://192.168.0.161/api/operation with headers:{'Authorization': 'Bearer wontwork'} and payload {'backup_reserve_percent': 0.0, 'mode': u'backup'}
Tesla Battery Error Method Not Allowed

Tesla Battery Debug update Tesla Meters Called
Tesla Battery Debug ThreadSendCOmmand called. Number of Active Threads:2
Tesla Battery Debug sendcommand called
Tesla Battery Debug HTTPS CURL result:
Tesla Battery Debug ReturnCode:0
Tesla Battery Debug ReturnCode:0
Tesla Battery Debug Text :<closed file '<fdopen>', mode 'rb' at 0x1071bea50>
Tesla Battery Debug Error Running command. ?Powerwall offline
User avatar
GlennNZ
Posts: 1873
Joined: Sun Dec 07, 2014 3:33 pm
Location: Central Coast, Australia

Re: Tesla Battery Gateway Plugin

Post by GlennNZ »

Ok
Shouldn’t need to recreate devices with new plugin.

The serial number is the installer password that is used - with “installer” as you can see in debug log. Change the serial number to the installer password and try that

Glenn


Sent from my iPhone using Tapatalk
petematheson
Posts: 847
Joined: Sun Sep 14, 2014 9:51 am
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

Post by petematheson »

Ah that got further this time - but errored with:
Tesla Battery Error Method Not Allowed

Tesla Battery Debug setFanSpeed Called as Action.
Tesla Battery Debug Thread Send Login Basic called. Number of Active Threads:2
Tesla Battery Debug Calling https://192.168.0.161/api/login/Basic with payload:{'username': 'installer', 'force_sm_off': False, 'password': u'xxxxxxx', 'email': u'pete@xxx'}
Tesla Battery Debug {"email":"pete@xxxxxxxxx","firstname":"Tesla","lastname":"Energy","roles":["Provider_Engineer"],"token":"J2DiaPGiqt5cHvVMg4lxxxxxxxM6Kc0a-xhB-eVIxxxxxxx6W-wqpvqkQh3ddxxxxxxhveTJQ==","provider":"Basic","loginTime":"2020-05-11T23:12:06.009125434+01:00"}
Tesla Battery Debug J2Dxxxxxt5cHvVMxxxxxx6M6Kc0a-xhB-xxxxxxxhy19xx6W-wqpxxxxxxxz74y7rV_0hveTJQ==
Tesla Battery Debug Change Operation called. Number of Active Threads:2
Tesla Battery Debug Calling https://192.168.0.161/api/operation with headers:{'Authorization': 'Bearer wontwork'} and payload {'backup_reserve_percent': 0.0, 'mode': u'backup'}
Tesla Battery Error Method Not Allowed

Tesla Battery Debug update Tesla Grid Status Called
Tesla Battery Debug ThreadSendCOmmand called. Number of Active Threads:2
Tesla Battery Debug sendcommand called
Tesla Battery Debug HTTPS CURL result:
Tesla Battery Debug ReturnCode:0
Tesla Battery Debug ReturnCode:0
Tesla Battery Debug Text :<closed file '<fdopen>', mode 'rb' at 0x1071bea50>
User avatar
GlennNZ
Posts: 1873
Joined: Sun Dec 07, 2014 3:33 pm
Location: Central Coast, Australia

Re: Tesla Battery Gateway Plugin

Post by GlennNZ »

Oops
That’s my mistake - left the authorisation off the second request so could test that far
Will have to update code


Sent from my iPhone using Tapatalk
User avatar
GlennNZ
Posts: 1873
Joined: Sun Dec 07, 2014 3:33 pm
Location: Central Coast, Australia

Re: Tesla Battery Gateway Plugin

Post by GlennNZ »

Okay
Managed to VPN to machine through work proxy and have updated/uploaded 0.4.1

Give that a go

Make sure turn on the debug check boxes in pluginconfig. Don’t need to recreate devices etc - I haven’t recreated mine for years probably.

Try the change operational mode again?

Glenn


Sent from my iPhone using Tapatalk
petematheson
Posts: 847
Joined: Sun Sep 14, 2014 9:51 am
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

Post by petematheson »

Tesla Battery Debug setFanSpeed Called as Action.
Tesla Battery Debug Thread Send Login Basic called. Number of Active Threads:2
Tesla Battery Debug update Tesla Meters Called
Tesla Battery Debug ThreadSendCOmmand called. Number of Active Threads:2
Tesla Battery Debug sendcommand called
Tesla Battery Debug HTTPS CURL result:
Tesla Battery Debug ReturnCode:0
Tesla Battery Debug ReturnCode:0
Tesla Battery Debug Text :<closed file '<fdopen>', mode 'rb' at 0x109a816f0>
Tesla Battery Debug Error Running command. ?Powerwall offline
Tesla Battery Debug Calling https://192.168.0.161/api/login/Basic with payload:{'username': 'installer', 'force_sm_off': False, 'password': xxxxxxxxx', 'email': u'pete@xxxxxxxxx'}
Tesla Battery Debug {"email":"pete@xxxxxx","firstname":"Tesla","lastname":"Energy","roles":["Provider_Engineer"],"token":"OOB9QJluwHxxxKt2WDBAA==","provider":"Basic","loginTime":"2020-05-12T07:57:48.997847557+01:00"}
Tesla Battery Debug OOB9QJluwHHSYTQNbscxxxxxxxxxxP2PK4wgiIlEhKt2WDBAA==
Tesla Battery Debug Change Operation called. Number of Active Threads:2
Tesla Battery Error Error setting Operation : TypeError("cannot concatenate 'str' and 'NoneType' objects",)
Traceback (most recent call last):
File "plugin.py", line 549, in changeOperation
headers = {'Authorization':'Bearer '+self.pairingToken }
TypeError: cannot concatenate 'str' and 'NoneType' objects
Tesla Battery Debug Error setting Operationcannot concatenate 'str' and 'NoneType' objects
User avatar
GlennNZ
Posts: 1873
Joined: Sun Dec 07, 2014 3:33 pm
Location: Central Coast, Australia

Re: Tesla Battery Gateway Plugin

Post by GlennNZ »

Ok
Did you add anything for reserve battery percentage?


Sent from my iPhone using Tapatalk
petematheson
Posts: 847
Joined: Sun Sep 14, 2014 9:51 am
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

Post by petematheson »

Yeah set to 0. Also got the same error changing it to self consumption.

Also it seems to knock my PW out so I have to login to the web interface and hit ‘start system’ ?


Sent from my iPhone using Tapatalk
Post Reply

Return to “Tesla Battery”