def logState(self, value, test=False): status_qualifier = 'Success' if test: status_qualifier = 'Test' jsn = makeEnvJson('State_Change', 'Lights', 'Top', 'State', value, 'Lights', status_qualifier) CouchDB.logEnvObsvJSON(jsn)
def getAirTopHumidityObsv(test=False): '''Create json structure for humidity''' humid = si.getHumidity() status_qualifier = 'Success' cmt = '' if humid == None: status_qualifier = 'Failure' cmt = 'Failure reading sensor' if test: status_qualifier = 'Test' return makeEnvJson(activity_type, 'Air', 'Left_Side', 'Humidity', '{:3.1f}'.format(humid), 'SI7021', status_qualifier, comment=cmt)
def getAirTopTempObsv(test=False): '''Create json structure for temp''' temp = si.getTempC() status_qualifier = 'Success' cmt = '' if temp == None: status_qualifier = 'Failure' cmt = 'Failure reading sensor' if test: status_qualifier = 'Test' return makeEnvJson(activity_type, 'Air', 'Left_Side', 'Temperature', '{:3.1f}'.format(temp), 'SI7021', status_qualifier, comment=cmt)
def logState(self, value, test=False): status_qualifier = 'Success' if test: status_qualifier = 'Test' jsn = makeEnvJson('Fan', 'Side', 'state', value, status_qualifier) CouchDB.logEnvObsv(jsn)