Input Processing Question

In a separate post, @TrystanLea has described the EmonHubTeslaPowerWallInterfacer for capturing the % Charge of a PowerWall battery every 10 secs:

My question - what should be the Input Processing steps for using this data to calculate the change in Charge (+ or -) since the previous 10 sec reading?

Could this be extended to the change in Charge over the previous 1 min or 10 mins, for example.

I always use PHPTimeSeries.

I realise that this only relates to % Charge but multiplying by Nominal Battery capacity should give a good approximation to charge/discharge power.

Thanks

It would probably be better to work out how we can extract the charge discharge power. Looks like most of what we need is here tesla-powerwall · PyPI

power_wall.is_drawing_from(MeterType.SOLAR)
#=> True
power_wall.is_sending_to(MeterType.LOAD)
#=> True
power_wall.is_active(MeterType.BATTERY)
#=> False
power_wall.get_power(MeterType.SOLAR)
#=> 2.8 (in kWh)

Would you be able to test that library to see if you can get the data from your power wall?

@TrystanLea

The PowerWalls were installed 11 days ago but are not yet operational due to a fault. It’s been very difficult to get Tesla service but an engineer is due on site tomorrow.

Once up and running, I’m happy to be a ‘test bed’ on this.

My first intention is to try to modify the PowerWallInterfacer.

I’ve previously seen the link you’ve provided but frankly find it difficult to understand. This link might also be helpful …

In anticipation I already have a dedicated RPi on site running emoncms. Of course I don’t yet have a URL for PowerWall to put into the PowerWallInterfacer which explains why I’m getting the following output when I restart emonhub. As an aside - watchman is another RPi on site which collects data from 4 x EmonTx/RPi’s - inverter generation meter, grid meter, pool and EV charger.

2020-06-29 15:15:16,176 INFO     MainThread Opening hub...
2020-06-29 15:15:16,177 INFO     MainThread Logging level set to DEBUG
2020-06-29 15:15:16,177 INFO     MainThread Creating EmonHubJeeInterfacer 'RFM2Pi' 
2020-06-29 15:15:16,179 DEBUG    MainThread Opening serial port: /dev/ttyAMA0 @ 38400 bits/s
2020-06-29 15:15:18,182 WARNING  MainThread Device communication error - check settings
2020-06-29 15:15:18,183 INFO     MainThread Setting RFM2Pi baseid: 5 (5i)
2020-06-29 15:15:19,185 INFO     MainThread Setting RFM2Pi frequency: 433 (4b)
2020-06-29 15:15:20,187 INFO     MainThread Setting RFM2Pi group: 210 (210g)
2020-06-29 15:15:21,190 INFO     MainThread Setting RFM2Pi quiet: 1 (1q)
2020-06-29 15:15:22,192 INFO     MainThread Setting RFM2Pi calibration: 230V (1p)
2020-06-29 15:15:23,194 DEBUG    MainThread Setting RFM2Pi pubchannels: ['ToEmonCMS']
2020-06-29 15:15:23,195 DEBUG    MainThread Setting RFM2Pi subchannels: ['ToRFM12']
2020-06-29 15:15:23,198 INFO     MainThread Creating EmonHubMqttInterfacer 'MQTT' 
2020-06-29 15:15:23,201 DEBUG    MainThread Setting MQTT pubchannels: ['ToRFM12']
2020-06-29 15:15:23,202 DEBUG    MainThread Setting MQTT subchannels: ['ToEmonCMS']
2020-06-29 15:15:23,203 INFO     MainThread Setting MQTT node_format_enable: 1
2020-06-29 15:15:23,203 INFO     MainThread Setting MQTT nodevar_format_enable: 1
2020-06-29 15:15:23,204 INFO     MainThread Setting MQTT nodevar_format_basetopic: emon/
2020-06-29 15:15:23,205 INFO     MainThread Creating EmonHubTeslaPowerWallInterfacer 'PowerWall' 
2020-06-29 15:15:23,206 INFO     MainThread Setting PowerWall name: powerwall
2020-06-29 15:15:23,207 INFO     MainThread Setting PowerWall url: http://POWERWALL-IP/api/system_status/soe
2020-06-29 15:15:23,208 INFO     MainThread Setting PowerWall readinterval: 10
2020-06-29 15:15:23,208 DEBUG    MainThread Setting PowerWall pubchannels: ['ToEmonCMS']
2020-06-29 15:15:23,215 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'To_watchman' 
2020-06-29 15:15:23,217 DEBUG    MainThread Setting To_watchman pubchannels: ['ToRFM12']
2020-06-29 15:15:23,218 DEBUG    MainThread Setting To_watchman subchannels: ['ToEmonCMS']
2020-06-29 15:15:23,219 INFO     MainThread Setting To_watchman apikey: set
2020-06-29 15:15:23,220 INFO     MainThread Setting To_watchman url: http://192.168.1.10/emoncms
2020-06-29 15:15:23,220 INFO     MainThread Setting To_watchman senddata: 1
2020-06-29 15:15:23,221 INFO     MainThread Setting To_watchman sendstatus: 0
2020-06-29 15:15:33,292 WARNING  PowerWall  PowerWall couldn't send to server: HTTPConnectionPool(host='powerwall-ip', port=80): Max retries exceeded with url: /api/system_status/soe (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x75580790>: Failed to establish a new connection: [Errno -2] Name or service not known'))
2020-06-29 15:15:33,296 WARNING  PowerWall  Exception caught in PowerWall thread. Traceback (most recent call last):
  File "/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py", line 32, in wrapper
    return f(*args)
  File "/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py", line 99, in run
    rxc = self.read()
  File "/opt/openenergymonitor/emonhub/src/interfacers/EmonHubTeslaPowerWallInterfacer.py", line 49, in read
    jsonstr = reply.text.rstrip()
UnboundLocalError: local variable 'reply' referenced before assignment

2020-06-29 15:15:33,437 WARNING  MainThread PowerWall thread is dead.
2020-06-29 15:15:33,437 WARNING  MainThread Attempting to restart thread PowerWall (thread has been restarted 0 times...
2020-06-29 15:15:33,440 INFO     MainThread Creating EmonHubTeslaPowerWallInterfacer 'PowerWall' 
2020-06-29 15:15:33,441 INFO     MainThread Setting PowerWall name: powerwall
2020-06-29 15:15:33,442 INFO     MainThread Setting PowerWall url: http://POWERWALL-IP/api/system_status/soe
2020-06-29 15:15:33,442 INFO     MainThread Setting PowerWall readinterval: 10
2020-06-29 15:15:33,443 DEBUG    MainThread Setting PowerWall pubchannels: ['ToEmonCMS']
2020-06-29 15:15:43,499 WARNING  PowerWall  PowerWall couldn't send to server: HTTPConnectionPool(host='powerwall-ip', port=80): Max retries exceeded with url: /api/system_status/soe (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x74b62350>: Failed to establish a new connection: [Errno -2] Name or service not known'))
2020-06-29 15:15:43,500 WARNING  PowerWall  Exception caught in PowerWall thread. Traceback (most recent call last):
  File "/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py", line 32, in wrapper
    return f(*args)
  File "/opt/openenergymonitor/emonhub/src/emonhub_interfacer.py", line 99, in run
    rxc = self.read()
  File "/opt/openenergymonitor/emonhub/src/interfacers/EmonHubTeslaPowerWallInterfacer.py", line 49, in read
    jsonstr = reply.text.rstrip()
UnboundLocalError: local variable 'reply' referenced before assignment

I’ll keep you posted and will be asking for help without a doubt.