comparison pw2log.py @ 4:8990981c60a0

Catch up with tesla_powerwall API changes.
author Daniel O'Connor <darius@dons.net.au>
date Mon, 04 Jul 2022 12:09:29 +0930
parents ec3c8b63d8e7
children
comparison
equal deleted inserted replaced
3:ec3c8b63d8e7 4:8990981c60a0
109 # | Negative | n/a | Feeding grid | Charging battery | n/a | 109 # | Negative | n/a | Feeding grid | Charging battery | n/a |
110 # 110 #
111 if not pw: 111 if not pw:
112 first = True 112 first = True
113 pw = Powerwall(pwip) 113 pw = Powerwall(pwip)
114 pw.login(username, password) 114 pw.login(password, username)
115 pw.detect_and_pin_version()
116 meters = pw.get_meters() 115 meters = pw.get_meters()
117 grid_volts = meters.site.avarage_voltage 116 grid_volts = meters.site.average_voltage
118 grid_freq = meters.site.frequency 117 grid_freq = meters.site.frequency
119 grid_power = meters.site.instant_power 118 grid_power = meters.site.instant_power
120 load_power = meters.load.instant_power 119 load_power = meters.load.instant_power
121 battery_power = meters.battery.instant_power 120 battery_power = meters.battery.instant_power
122 solar_power = meters.solar.instant_power 121 solar_power = meters.solar.instant_power
123 charge = pw.get_charge() 122 charge = pw.get_charge()
124 except APIError as e: 123 except Exception as e:
125 pw = None 124 pw = None
126 logger.error('Error communicating with Powerwall: ' + str(e)) 125 logger.error('Error communicating with Powerwall: ' + str(e))
127 time.sleep(300) 126 time.sleep(300)
128 continue 127 continue
129 try: 128 try: