Processing encoded payload data

User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Processing encoded payload data

Post by FlyingDiver »

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
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Processing encoded payload data

Post by FlyingDiver »

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
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: Processing encoded payload data

Post by berkinet »

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.
User avatar
FlyingDiver
Posts: 7830
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Processing encoded payload data

Post by FlyingDiver »

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
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: Processing encoded payload data

Post by berkinet »

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

Return to “MQTT”