https://github.com/FlyingDiver/Indigo-S ... g/2023.0.1
Then, change your decoder to this:
- Code: Select all
from ruuvi_decoders import Df5Decoder
class Ruuvi(object):
def __init__(self, name):
self.name = name
self.decoder = Df5Decoder()
def decode(self, payload):
new_states = {}
ruuvi_data = payload['data']
ruuvi_data = ruuvi_data.split("FF9904")[1]
new_states = self.decoder.decode_data(ruuvi_data)
if len(new_states):
return new_states
else:
return None
This caches the Df5Decoder object when the Decoder is loaded, rather than each time through.