Processing encoded payload data

Posted on
Thu Nov 23, 2023 5:38 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Processing encoded payload data

I think what's going on is that creating the Df5Decoder object each time is taking too long. I updated the plugin to cache an actual Decoder object, rather than the Class. Install:

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.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Nov 23, 2023 5:42 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Processing encoded payload data

Also, your trigger is defined wrong. It should be:
Code: Select all
Match:   ruuvi
Any:


There's no value used for an "Any" term. I should probably throw a warning when someone tries to do that. As it is, your trigger is firing for any MQTT message with two components in the topic.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Nov 23, 2023 10:53 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Processing encoded payload data

Upgraded to shims v 2023.0.1, changed the Decoder, and revised the trigger config. Still get queueing messages after around a minute.
However, I have also added a Scheduled action to only enable the trigger for 3 seconds and one minute in interval, and that seems to have resolved the queue problem. I have also been in contact with Ruuvi and they say they will be implementing a throttle on message publishing frequency.

So, for my needs, this is now "working" for my needs. However, if you want further testing, I'd be glad to help.
Last edited by berkinet on Mon Nov 27, 2023 3:11 pm, edited 2 times in total.

Posted on
Thu Nov 23, 2023 11:06 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Processing encoded payload data

Hmm. It must really be flooding messages. I really don't think the processing of each message takes that long.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Nov 23, 2023 11:12 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Processing encoded payload data

Enjoy your holiday. I, for one, am very thankful for your help and support.

Who is online

Users browsing this forum: No registered users and 2 guests