(self, state, prefix=None)
decode json data dict, and publish as individual topics to
        brokerFeedback/topic the keys are concatenated with _ to make one unique
        topic name strings are expressly converted to strings to avoid unicode
        representations
decode json data dict, and publish as individual topics to
        brokerFeedback/topic the keys are concatenated with _ to make one unique
        topic name strings are expressly converted to strings to avoid unicode
        representations
decode json data dict and publish as individual topics to brokerFeedback / topic the keys are concatenated with _ to make one unique topic name strings are expressly converted to strings to avoid unicode representations
def decode_topics(self, state, prefix=None):
        '''
        decode json data dict, and publish as individual topics to
        brokerFeedback/topic the keys are concatenated with _ to make one unique
        topic name strings are expressly converted to strings to avoid unicode
        representations
        '''
        for k, v in state.items():
            if isinstance(v, dict):
                if prefix is None:
                    self.decode_topics(v, k)
                else:
                    self.decode_topics(v, prefix+"_"+k)
            else:
                if isinstance(v, list):
                    newlist = []
                    for i in v:
                        if isinstance(i, dict):
                            for ki, vi in i.items():
                                newlist.append((str(ki), vi))
                        else:
                            if not isinstance(i, str):
                                i = str(i)
                            newlist.append(i)
                    v = newlist
                if prefix is not None:
                    k = prefix+"_"+k
                # all data starts with this, so it's redundant
                k = k.replace("state_reported_","")
                    
                self.publish(k, str(v))

        if prefix is None:
            self.update_state_machine()
def decode_topics ( self , state , prefix = None ) : for k , v in state . items ( ) : if isinstance ( v , dict ) : if prefix is None : self . decode_topics ( v , k ) else : self . decode_topics ( v , prefix + "_" + k ) else : if isinstance ( v , list ) : newlist = [ ] for i in v : if isinstance ( i , dict ) : for ki , vi in i . items ( ) : newlist . append ( ( str ( ki ) , vi ) ) else : if not isinstance ( i , str ) : i = str ( i ) newlist . append ( i ) v = newlist if prefix is not None : k = prefix + "_" + k # all data starts with this, so it's redundant k = k . replace ( "state_reported_" , "" ) self . publish ( k , str ( v ) ) if prefix is None : self . update_state_machine ( )