-
Notifications
You must be signed in to change notification settings - Fork 14
/
buildJSON.py
58 lines (51 loc) · 2.4 KB
/
buildJSON.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#build state JSON
import config
import state
import json
from datetime import datetime
def getStateJSON():
now = datetime.now()
data = {}
data['SkyWeather2Version'] = config.SWVERSION
data['SampleDateTime'] = now.strftime("%m/%d/%y, %H:%M:%S %Z%z")
data['UTCTime'] = datetime.utcnow().isoformat()
data['lastMainReading'] = state.lastMainReading
data['lastIndoorReading'] = state.lastIndoorReading
data['mainID'] = state.mainID
data['insideID'] = state.insideID
data['OutdoorTemperature'] = state.OutdoorTemperature
data['OutdoorHumidity'] = state.OutdoorHumidity
data['IndoorTemperature'] = state.IndoorTemperature
data['IndoorHumidity'] = state.IndoorHumidity
data['Rain60Minutes'] = state.Rain60Minutes
data['SunlightVisible'] = state.SunlightVisible
data['SunlightUVIndex'] = state.SunlightUVIndex
data['WindSpeed'] = state.WindSpeed
data['WindGust'] = state.WindGust
data['WindDirection'] = state.WindDirection
data['TotalRain'] = state.TotalRain
data['BarometricTemperature'] = state.BarometricTemperature
data['BarometricPressure'] = state.BarometricPressure
data['Altitude'] = state.Altitude
data['BarometricPressureSeaLevel'] = state.BarometricPressureSeaLevel
data['barometricTrend'] = state.barometricTrend
data['pastBarometricReading'] = state.pastBarometricReading
data['AQI'] = state.AQI
data['Hour24_AQI'] = state.Hour24_AQI
data['Last_Event'] = state.Last_Event
data['English_Metric'] = config.English_Metric
data['batteryVoltage'] = state.batteryVoltage
data['batteryCurrent'] = state.batteryCurrent
data['solarVoltage'] = state.solarVoltage
data['solarCurrent'] = state.solarCurrent
data['loadVoltage'] = state.loadVoltage
data['loadCurrent'] = state.loadCurrent
data['batteryPower'] = state.batteryPower
data['solarPower'] = state.solarPower
data['loadPower'] = state.loadPower
data['batteryCharge'] = state.batteryCharge
data['SolarMAXLastReceived'] = state.SolarMAXLastReceived
data['SolarMaxInsideTemperature'] = state.SolarMaxInsideTemperature
data['SolarMaxInsideHumidity'] = state.SolarMaxInsideHumidity
data['fanState'] = state.fanState
return json.dumps(data)