We recently acquired/setup a Samsung fridge and through the use of the old reliable ST app Send Event to EventGhost (EG), any time a door opens or temperatures change I get an update. Works perfectly at leasts until EG is removed. . I looked at the automation options but for the fridge they are limited to Temperature settings.
I just started to work on a (so far simple) python script to retrieve fridge data from the ST cloud. So far I can get what I need from the code below
response = requests.get('https://api.smartthings.com/v1/devices/' + fridge + '/status',headers={'Authorization': 'Bearer ' + token, 'content-type': 'application/json'})
jsonString = json.loads(response.text)
#-----------------------------------------------------------------------------------------------------------------------------------
mainEnergy = float(jsonString['components']['main']['powerConsumptionReport']['powerConsumption']['value']['energy']/1000)
mainPower = int(jsonString['components']['main']['powerConsumptionReport']['powerConsumption']['value']['power'])
#-----------------------------------------------------------------------------------------------------------------------------------
coolerDoor = jsonString['components']['cooler']['contactSensor']['contact']['value']
coolerTemperature = int(jsonString['components']['cooler']['temperatureMeasurement']['temperature']['value'])
coolerTempSetPoint = int(jsonString['components']['cooler']['thermostatCoolingSetpoint']['coolingSetpoint']['value'])
#-----------------------------------------------------------------------------------------------------------------------------------
freezerDoor = jsonString['components']['freezer']['contactSensor']['contact']['value']
freezerTemperature = int(jsonString['components']['freezer']['temperatureMeasurement']['temperature']['value'])
freezerTempSetPoint = int(jsonString['components']['freezer']['thermostatCoolingSetpoint']['coolingSetpoint']['value'])
Of course this would hardly give “live” updates unless I put it inside a loop which would create a whole lot of unnecessary traffic. Ideally, if it were possible to set up this script that waits or listens to an event such as door opening. Is this at all possible? Any one have any examples?
Just started reading about rules but cant seem to find anything about how an event such as door opening would trigger an event that an external script could capture,