Samsung Fridge: Python Notify me when. Some questions about subscribing to events

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. :unamused:. 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,

I found a more efficient way to retrieve just the data I need from the specific device.

`    response = requests.get('https://api.smartthings.com/v1/devices/' + FRIDGE_ID + '/components/' + component + '/capabilities/' + capability + '/status',headers={'Authorization': 'Bearer ' + TOKEN, 'content-type': 'application/json'})`
    jsonString = json.loads(response.text)
    return (str(jsonString['temperature']['value']))

In the above example component may be cooler and capability may be temperatureMeasurement which would return just the temperature of the cooler. While this drastically reduces network traffic I still would prefer to routine to wait for an actual device event to occur

Tagging @nayelyz