Tesla Battery Gateway Plugin

Posted on
Tue May 12, 2020 2:12 am
GlennNZ offline
User avatar
Posts: 1565
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: Tesla Battery Gateway Plugin

Have you got a few lines before that - wasn't it sending 'backup'?
Pending that try 0.5.0

Posted on
Tue May 12, 2020 2:13 am
petematheson offline
Posts: 847
Joined: Sep 14, 2014
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

Action Group Tesla PW Backup
Tesla Battery Debug setOperational Mode Called as Action.
Tesla Battery Debug configured : True
delayAmount : 900
description : set operational mode
deviceId : 0
pluginId : com.GlennNZ.indigoplugin.TeslaBattery
pluginTypeId : setOperationMode
props : com.GlennNZ.indigoplugin.TeslaBattery : (dict)
mode : backup (string)
reserve : 20 (string)
replaceExisting : True
textToSpeak :
YCmyQAxxxxxxLUoy-hzA=='} and payload {'backup_reserve_percent': 20.0, 'mode': 'backup'}
Tesla Battery Error {"code":500,"error":"RealMode must be either backup, self_consumption, or autonomous","message":"Unable to set operational mode"}
Tesla Battery Error change Operation failed. Unsure why. Check error message.
Tesla Battery Error Restarting Sitemaster

Posted on
Tue May 12, 2020 2:15 am
petematheson offline
Posts: 847
Joined: Sep 14, 2014
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

With 0.5.0

Tesla Battery Debug configured : True
delayAmount : 900
description : set operational mode
deviceId : 0
pluginId : com.GlennNZ.indigoplugin.TeslaBattery
pluginTypeId : setOperationMode
props : com.GlennNZ.indigoplugin.TeslaBattery : (dict)
mode : backup (string)
reserve : 20 (string)
replaceExisting : True
textToSpeak :
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': 'xxxx', 'email': 'pete@xxxx'}
Tesla Battery Debug {"email":"pete@petematheson.co.uk","firstname":"Tesla","lastname":"Energy","roles":["Provider_Engineer"],"token":"RzXhA8UxxxxHJqI-HZw==","provider":"Basic","loginTime":"2020-05-12T09:14:36.288261834+01:00"}
Tesla Battery Debug RzXhA8xxxxxqI-HZw==
Tesla Battery Debug Change Operation called. Number of Active Threads:2
Tesla Battery Debug Reserve Percentage is :20.0 and prior 20
Tesla Battery Debug Calling https://192.168.0.161/api/operation with headers:{'Authorization': 'Bearer RzXhA8UxxxxxJqI-HZw=='} and payload {'backup_reserve_percent': 20.0, 'mode': 'backup'}
Tesla Battery Error {"code":500,"error":"invalid character 'b' looking for beginning of value","message":"Unable to set operational mode"}
Tesla Battery Error change Operation failed. Unsure why. Check error message.
Tesla Battery Error Restarting Sitemaster
Tesla Battery Debug setConfigCompleted called. Number of Active Threads:2
Tesla Battery Debug Calling https://192.168.0.161/api/sitemaster/run with headers:{'Authorization': 'Bearer RzXhAxxxxxxwHJqI-HZw=='}
Tesla Battery Debug

Posted on
Tue May 12, 2020 2:20 am
GlennNZ offline
User avatar
Posts: 1565
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: Tesla Battery Gateway Plugin

OK

Seems its a UK thing
https://github.com/vloschiavo/powerwall2/issues/11
Needs to be real_mode and can't set back to autonomous.... (if that is what is needed)
Although the error message you are getting may suggest can set it to all?

Have updated 0.5.1 to real_mode but may limit usefulness

Glenn

Posted on
Tue May 12, 2020 2:25 am
petematheson offline
Posts: 847
Joined: Sep 14, 2014
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

Ooooh!

OK, So it set the mode and set the Reserve to 100%, even though it says it failed, and I had it set to 20% for the reserve?
It also didn't change back to Self Powered


Tesla Battery Debug {"email":"pete@xxxxxx","firstname":"Tesla","lastname":"Energy","roles":["Provider_Engineer"],"token":"IjkWstm2GxxxxxedywucK9r-g==","provider":"Basic","loginTime":"2020-05-12T09:21:58.595629229+01:00"}
Tesla Battery Debug IjkWstm2GxxxxxxucK9r-g==
Tesla Battery Debug Change Operation called. Number of Active Threads:2
Tesla Battery Debug Reserve Percentage is :20.0 and prior 20
Tesla Battery Debug Calling https://192.168.0.161/api/operation with headers:{'Authorization': 'Bearer IjkWstm2GxxxxxxtFzJedywucK9r-g=='} and payload {'real_mode': 'backup', 'backup_reserve_percent': 20.0}
Tesla Battery Debug {"real_mode":"backup","backup_reserve_percent":100,"freq_shift_load_shed_soe":0,"freq_shift_load_shed_delta_f":0}
Tesla Battery change Operation failed. Unsure why. Check error message.
Tesla Battery Restarting Sitemaster.
Tesla Battery Debug setConfigCompleted called. Number of Active Threads:2
Tesla Battery Debug Calling https://192.168.0.161/api/sitemaster/run with headers:{'Authorization': 'Bearer IjkWstm2GxxxxdywucK9r-g=='}
Tesla Battery Debug
Tesla Battery Sitemaster now Running again,following command success
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



Changing back to self powered



a Battery Debug {"email":"pete@xxxxx","firstname":"Tesla","lastname":"Energy","roles":["Provider_Engineer"],"token":"Avk8GxxxxxCo2pzTDZg==","provider":"Basic","loginTime":"2020-05-12T09:23:30.272928252+01:00"}
Tesla Battery Debug Avk8G7zRxxxxxOCo2pzTDZg==
Tesla Battery Debug Change Operation called. Number of Active Threads:2
Tesla Battery Debug Reserve Percentage is :0.0 and prior 0
Tesla Battery Debug Calling https://192.168.0.161/api/operation with headers:{'Authorization': 'Bearer Avk8xxxxCo2pzTDZg=='} and payload {'real_mode': 'self_consumption', 'backup_reserve_percent': 0.0}
Tesla Battery Debug {"real_mode":"self_consumption","backup_reserve_percent":5,"freq_shift_load_shed_soe":0,"freq_shift_load_shed_delta_f":0}
Tesla Battery change Operation failed. Unsure why. Check error message.
Tesla Battery Restarting Sitemaster.
Tesla Battery Debug setConfigCompleted called. Number of Active Threads:2
Tesla Battery Debug Calling https://192.168.0.161/api/sitemaster/run with headers:{'Authorization': 'Bearer Avk8G7xxxxx2pzTDZg=='}
Tesla Battery Debug
Tesla Battery Sitemaster now Running again,following command success
Z-Wave received "Conservatory Luminance" sensor update to 1245 lux
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 SUCCESS Text :{u'grid_services_active': False, u'grid_status': u'SystemGridConnected'}
Tesla Battery Debug Json results:{u'grid_services_active': False, u'grid_status': u'SystemGridConnected'}
Tesla Battery Debug sendcommand r.json result:{u'grid_services_active': False, u'grid_status': u'SystemGridConnected'}
Tesla Battery Debug fill grid status info called
Z-Wave received "Conservatory Luminance" sensor update to 907 lux
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

Posted on
Tue May 12, 2020 2:30 am
GlennNZ offline
User avatar
Posts: 1565
Joined: Dec 07, 2014
Location: Central Coast, Australia

Tesla Battery Gateway Plugin

Ok
That is progress.

Fixed a few of the bugs (mainly around real_mode versus mode) - not sure why not following the battery_reserve_percentage - remove the decimal
and try
0.5.2

Reading your logs again - thought - backup mode off course will be 100% battery reserve. So would think that is expected. Tick.

The 2nd command also does seem to change - just plugin doesn’t correctly register it. (real_mode versus mode issue) fixed above in 0.5.1

But check Powerwall webpage as well to see what is being changed. Or app - it may be slower.

Looking at this may need to change battery_reserve back to 1 decimal....

But seems almost done...

Glenn

Posted on
Tue May 12, 2020 2:50 am
petematheson offline
Posts: 847
Joined: Sep 14, 2014
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

No dice this time.
Didn't change mode or set the reserve.


Tesla Battery Debug Calling https://192.168.0.161/api/login/Basic with payload:{'username': 'installer', 'force_sm_off': False, 'password': 'xxxx', 'email': 'pete@xxxxx'}
Tesla Battery Debug {"email":"pete@xxxxx","firstname":"Tesla","lastname":"Energy","roles":["Provider_Engineer"],"token":"0NLVxxxxUJSW-oAoSKxfLxijA==","provider":"Basic","loginTime":"2020-05-12T09:49:06.241776971+01:00"}
Tesla Battery Debug 0NLVEmphwxxxxxAoSKxfLxijA==
Tesla Battery Debug Change Operation called. Number of Active Threads:3
Tesla Battery Debug Reserve Percentage is :20 and prior 20
Tesla Battery Debug Calling https://192.168.0.161/api/operation with headers:{'Authorization': 'Bearer 0NLxxxxSKxfLxijA=='} and payload {'real_mode': 'backup', 'backup_reserve_percent': 20}
Tesla Battery Debug {"real_mode":"backup","backup_reserve_percent":100,"freq_shift_load_shed_soe":0,"freq_shift_load_shed_delta_f":0}
Tesla Battery Debug backup
Tesla Battery Debug setConfigCompleted called. Number of Active Threads:3
Tesla Battery Debug Calling https://192.168.0.161/api/config/completed with headers:{'Authorization': 'Bearer 0NLxxxxoSKxfLxijA=='}
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 0x1126d0a50>
Tesla Battery Debug Error Running command. ?Powerwall offline
Tesla Battery Error {"start_time":"2020-05-01 23:40:21 +0800","up_time_seconds":"250h8m45.771087845s","is_new":false,"version":"1.46.0","git_hash":"26a2d96c17d514867a6080ddd3dd7b2669b612a1","commission_count":4,"device_type":"teg","sync_type":"v2"}

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 SUCCESS Text :{u'battery': {u'i_a_current': 0, u'energy_imported': 0, u'i_b_current': 0, u'instant_power': 0, u'i_c_current': 0, u'instant_reactive_power': 0, u'frequency': 0, u'instant_total_current': 0, u'last_communication_time': u'0001-01-01T00:00:00Z', u'instant_apparent_power': 0, u'instant_average_voltage': 0, u'energy_exported': 0}, u'load': {u'i_a_current': 0, u'energy_imported': 0, u'i_b_current': 0, u'instant_power': 0, u'i_c_current': 0, u'instant_reactive_power': 0, u'frequency': 0, u'instant_total_current': 0, u'last_communication_time': u'0001-01-01T00:00:00Z', u'instant_apparent_power': 0, u'instant_average_voltage': 0, u'energy_exported': 0}, u'site': {u'i_a_current': 0, u'energy_imported': 0, u'i_b_current': 0, u'instant_power': 0, u'i_c_current': 0, u'instant_reactive_power': 0, u'frequency': 0, u'instant_total_current': 0, u'last_communication_time': u'0001-01-01T00:00:00Z', u'instant_apparent_power': 0, u'instant_average_voltage': 0, u'energy_exported': 0}, u'solar': {u'i_a_current': 0, u'energy_imported': 0, u'i_b_current': 0, u'instant_power': 0, u'i_c_current': 0, u'instant_reactive_power': 0, u'frequency': 0, u'instant_total_current': 0, u'last_communication_time': u'0001-01-01T00:00:00Z', u'instant_apparent_power': 0, u'instant_average_voltage': 0, u'energy_exported': 0}}
Tesla Battery Debug Json results:{u'battery': {u'i_a_current': 0, u'energy_imported': 0, u'i_b_current': 0, u'instant_power': 0, u'i_c_current': 0, u'instant_reactive_power': 0, u'frequency': 0, u'instant_total_current': 0, u'last_communication_time': u'0001-01-01T00:00:00Z', u'instant_apparent_power': 0, u'instant_average_voltage': 0, u'energy_exported': 0}, u'load': {u'i_a_current': 0, u'energy_imported': 0, u'i_b_current': 0, u'instant_power': 0, u'i_c_current': 0, u'instant_reactive_power': 0, u'frequency': 0, u'instant_total_current': 0, u'last_communication_time': u'0001-01-01T00:00:00Z', u'instant_apparent_power': 0, u'instant_average_voltage': 0, u'energy_exported': 0}, u'site': {u'i_a_current': 0, u'energy_imported': 0, u'i_b_current': 0, u'instant_power': 0, u'i_c_current': 0, u'instant_reactive_power': 0, u'frequency': 0, u'instant_total_current': 0, u'last_communication_time': u'0001-01-01T00:00:00Z', u'instant_apparent_power': 0, u'instant_average_voltage': 0, u'energy_exported': 0}, u'solar': {u'i_a_current': 0, u'energy_imported': 0, u'i_b_current': 0, u'instant_power': 0, u'i_c_current': 0, u'instant_reactive_power': 0, u'frequency': 0, u'instant_total_current': 0, u'last_communication_time': u'0001-01-01T00:00:00Z', u'instant_apparent_power': 0, u'instant_average_voltage': 0, u'energy_exported': 0}}
Tesla Battery Debug sendcommand r.json result:{u'battery': {u'i_a_current': 0, u'energy_imported': 0, u'i_b_current': 0, u'instant_power': 0, u'i_c_current': 0, u'instant_reactive_power': 0, u'frequency': 0, u'instant_total_current': 0, u'last_communication_time': u'0001-01-01T00:00:00Z', u'instant_apparent_power': 0, u'instant_average_voltage': 0, u'energy_exported': 0}, u'load': {u'i_a_current': 0, u'energy_imported': 0, u'i_b_current': 0, u'instant_power': 0, u'i_c_current': 0, u'instant_reactive_power': 0, u'frequency': 0, u'instant_total_current': 0, u'last_communication_time': u'0001-01-01T00:00:00Z', u'instant_apparent_power': 0, u'instant_average_voltage': 0, u'energy_exported': 0}, u'site': {u'i_a_current': 0, u'energy_imported': 0, u'i_b_current': 0, u'instant_power': 0, u'i_c_current': 0, u'instant_reactive_power': 0, u'frequency': 0, u'instant_total_current': 0, u'last_communication_time': u'0001-01-01T00:00:00Z', u'instant_apparent_power': 0, u'instant_average_voltage': 0, u'energy_exported': 0}, u'solar': {u'i_a_current': 0, u'energy_imported': 0, u'i_b_current': 0, u'instant_power': 0, u'i_c_current': 0, u'instant_reactive_power': 0, u'frequency': 0, u'instant_total_current': 0, u'last_communication_time': u'0001-01-01T00:00:00Z', u'instant_apparent_power': 0, u'instant_average_voltage': 0, u'energy_exported': 0}}
Tesla Battery Debug fillmetersinfo called
Tesla Battery Debug Calling https://192.168.0.161/api/login/Basic with payload:{'username': 'installer', 'force_sm_off': False, 'password': 'xxxx', 'email': 'pete@xxxxx'}
Tesla Battery Error {"code":401,"error":"Cannot stop system due to: ","message":"Login Error"}
Tesla Battery Debug setSiteMasterRun - 0.5.2 called. Number of Active Threads:2
Tesla Battery Debug Calling https://192.168.0.161/api/sitemaster/run with headers:{'Authorization': 'Bearer '}
Tesla Battery Error {"code":403,"error":"Unable to GET to resource","message":"User does not have adequate access rights"}

Posted on
Tue May 12, 2020 3:02 am
GlennNZ offline
User avatar
Posts: 1565
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: Tesla Battery Gateway Plugin

Ok

Running out of steam - but close.

Try 0.5.3

It does seem to change mode? - returns a yes/mode changed - check with webpage/app whether actually successful.

Posted on
Tue May 12, 2020 3:08 am
petematheson offline
Posts: 847
Joined: Sep 14, 2014
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

Back to setting the mode OK but Reserve back to 100%.


xtToSpeak :
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': 'xxxx', 'email': 'pete@xxxx}
Tesla Battery Debug {"email":"pete@xxxx","firstname":"Tesla","lastname":"Energy","roles":["Provider_Engineer"],"token":"OkVhWxxx1ODnpKLg==","provider":"Basic","loginTime":"2020-05-12T10:07:39.992872478+01:00"}
Tesla Battery Debug OkVhW6xxxxnpKLg==
Tesla Battery Debug Change Operation called. Number of Active Threads:2
Tesla Battery Debug Reserve Percentage is :20.0 and prior 20
Tesla Battery Debug Calling https://192.168.0.161/api/operation with headers:{'Authorization': 'Bearer OkVhxxxxnpKLg=='} and payload {'real_mode': 'backup', 'backup_reserve_percent': 20.0}
Tesla Battery Debug {"real_mode":"backup","backup_reserve_percent":100,"freq_shift_load_shed_soe":0,"freq_shift_load_shed_delta_f":0}
Tesla Battery Debug backup
Tesla Battery Debug setConfigCompleted called. Number of Active Threads:2
Tesla Battery Debug Calling https://192.168.0.161/api/config/completed with headers:{'Authorization': 'Bearer OkxxxxODnpKLg=='}
Tesla Battery Error Setconfig Error{"start_time":"2020-05-01 23:40:21 +0800","up_time_seconds":"250h27m19.433066722s","is_new":false,"version":"1.46.0","git_hash":"26a2d96c17d514867a6080ddd3dd7b2669b612a1","commission_count":5,"device_type":"teg","sync_type":"v2"}
return code:200
Tesla Battery Debug setSiteMasterRun - 0.5.2 called. Number of Active Threads:2
Tesla Battery Debug Calling https://192.168.0.161/api/sitemaster/run with headers:{'Authorization': 'Bearer OkVxxxxMlShV1ODnpKLg=='}
Tesla Battery Debug
Tesla Battery Sitemaster now Running again,following command success

Posted on
Tue May 12, 2020 3:11 am
GlennNZ offline
User avatar
Posts: 1565
Joined: Dec 07, 2014
Location: Central Coast, Australia

Tesla Battery Gateway Plugin

Backup will always be 100%?
The reserve percentage probably ignored

What happens with self_consumption battery percentage?

The setCobfig error message can be ignore and will fix - obviously the return code has changed from web documentation


Sent from my iPhone using Tapatalk

Posted on
Tue May 12, 2020 3:14 am
petematheson offline
Posts: 847
Joined: Sep 14, 2014
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

Ah a good point! :)

When I manually switch back to Self-powered in the Tesla app - it has the Reserve for power outages set to 100 so I have to manually dial it back down to 0%.

Posted on
Tue May 12, 2020 3:34 am
GlennNZ offline
User avatar
Posts: 1565
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: Tesla Battery Gateway Plugin

petematheson wrote:
Ah a good point! :)

When I manually switch back to Self-powered in the Tesla app - it has the Reserve for power outages set to 100 so I have to manually dial it back down to 0%.
What happens to self-consumption and reserve percentage when set with plugin action?

That will test whether plugin correctly sets reserve


Sent from my iPhone using Tapatalk

Posted on
Tue May 12, 2020 3:37 am
petematheson offline
Posts: 847
Joined: Sep 14, 2014
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

Looks OK from the web portal!


SITE NAME: Matheson Manor
BACKUP CAPABILITY: Backup Capable
MODE: Self Consumption
BACKUP RESERVE: 20%

Always getting this error in the log:
Tesla Battery Error Setconfig Error{"start_time":"2020-05-01 23:40:21 +0800","up_time_seconds":"250h56m4.072979856s","is_new":false,"version":"1.46.0","git_hash":"26a2d96c17d514867a6080ddd3dd7b2669b612a1","commission_count":10,"device_type":"teg","sync_type":"v2"}
return code:200

Posted on
Tue May 12, 2020 3:38 am
petematheson offline
Posts: 847
Joined: Sep 14, 2014
Location: Southampton, UK

Re: Tesla Battery Gateway Plugin

Although weirdly when I check the Tesla App it says Reserve is 16% !?

Posted on
Tue May 12, 2020 3:41 am
GlennNZ offline
User avatar
Posts: 1565
Joined: Dec 07, 2014
Location: Central Coast, Australia

Tesla Battery Gateway Plugin

Ignore the setConfig error will fix

The reserve percentage set by API doesn’t equate completely the app percentage

Tested values:

APP Setting API Setting
5% 10%
16% 20%
16% 20.6%
20% 24%
21% 24.6%
30% 33%
100% 100%

Page 4 of 9 1, 2, 3, 4, 5, 6, 7 ... 9

Who is online

Users browsing this forum: No registered users and 1 guest