Exemple #1
0
    def on_message(self, msgid, content):
        logger.info(u"MQ: New pub message {0}".format(msgid))
        logger.info(u"MQ: {0}".format(content))

        if isinstance(content["stored_value"], list):
            content["stored_value"] = content["stored_value"][0]
            logger.error(u"MQ: PATCH for issue #1976")

        # If sensor stat, we update the sensor last value
        if msgid == 'device-stats':
            Sensor.update(content["sensor_id"], content["timestamp"], content["stored_value"])

        WSHandler.sendAllMessage([msgid, content])
Exemple #2
0
    def on_message(self, msgid, content):
        #logger.info(u"MQ: New pub message {0}".format(msgid))
        #logger.info(u"MQ: {0}".format(content))

        if isinstance(content["stored_value"], list):
            content["stored_value"] = content["stored_value"][0]
            logger.error(u"MQ: PATCH for issue #1976")

        # If sensor stat, we update the sensor last value
        if msgid == 'device-stats':
            Sensor.update(content["sensor_id"], content["timestamp"],
                          content["stored_value"])

        WSHandler.sendAllMessage([msgid, content])
Exemple #3
0
    def on_message(self, msgid, content):
        #logger.info(u"MQ: New pub message {0}".format(msgid))
        #logger.info(u"MQ: {0}".format(content))

        # If sensor stat, we update the sensor last value
        if msgid == 'device-stats':
            if isinstance(content["stored_value"], list):
                content["stored_value"] = content["stored_value"][0]
                logger.error(u"MQ: PATCH for issue #1976")

            Sensor.update(content["sensor_id"], content["timestamp"], content["stored_value"])
            WSHandler.sendAllMessage([msgid, content])

        elif msgid == 'device.update':
            logger.info("MQ: message 'device.update' catched! Reloading the devices list")
            mqDataLoader.loadDevices(options.develop)