[python] Invalid syntax

This commit is contained in:
giuliof 2019-07-28 16:28:26 +02:00
parent 9541a079c6
commit 7cbd141540
1 changed files with 9 additions and 9 deletions

View File

@ -63,10 +63,10 @@ def setClimaStatus(status):
payload.append(0x00)
dgh.sendCommand('CMD_CLIMA', payload)
def plotData(data, labels, name):
def plotData(data, name):
# Plot HDD data
fig, ax = plt.subplots(nrows=1, ncols=1)
for i in labels:
for i in data:
ma = data[i].rolling(10).mean() # calculate moving average
ax.plot(data['datetime'], ma, linewidth=1.5, label=i)
ax.axvline('00:00', color='k', linestyle='--')
@ -79,19 +79,19 @@ def main():
if (len(sys.argv) != 3):
# Insert a new row in database
archive = ta.TA('temperatures.db')
tmp = getDiskTmp()
tmp += getCoreTmp()
tmp += getRoomTmp()
archive.put(tmp)
disk = getDiskTmp()
core = getCoreTmp()
amb = getRoomTmp()
archive.put({**disk, **core, **amb})
# Fetch last day history and plot
tmp = archive.get()
tmp['datetime'] = pd.to_datetime(tmp['datetime'])
tmp.set_index('datetime')
plotData(tmp, HDD_LABELS, 'plots/hdd.jpg')
plotData(tmp, CORE_LABELS, 'plots/core.jpg')
plotData(tmp, TMP_LABELS_AMB, 'plots/amb.jpg')
plotData(disk, 'plots/hdd.jpg')
plotData(core, 'plots/core.jpg')
plotData(amb, 'plots/amb.jpg')
else:
if (sys.argv[1] == 'clima'):