Skip to content

Commit

Permalink
use .values() in solarwatt
Browse files Browse the repository at this point in the history
  • Loading branch information
LKuemmel committed Dec 16, 2021
1 parent e24d661 commit e41b390
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/bezug_solarwatt/solarwatt.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def DebugLog(message):
bezugw = int(item["tagValues"]["PowerConsumedFromGrid"]["value"])

for item in sresponse["result"]["items"].values():
einspeisungw = int(sresponse["result"]["items"][item]["tagValues"]["PowerOut"]["value"])
einspeisungw = int(item["tagValues"]["PowerOut"]["value"])
bezugwatt = bezugw - einspeisungw
if solarwattmethod == 1: # Abruf über Gateway
sresponse = requests.get('http://'+speicher1_ip2+':8080/', timeout=3).json()
Expand Down
4 changes: 2 additions & 2 deletions modules/wr_solarwatt/solarwatt.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def DebugLog(message):

sresponse = requests.get('http://'+speicher1_ip+'/rest/kiwigrid/wizard/devices', timeout=3).json()

for item in sresponse["result"]["items"]:
for item in sresponse["result"]["items"].values():
try:
pvwatt = int(sresponse["result"]["items"][item]["tagValues"]["PowerProduced"]["value"])
pvwatt = int(item["tagValues"]["PowerProduced"]["value"])
break
except KeyError:
pass
Expand Down

0 comments on commit e41b390

Please sign in to comment.