Пример #1
0
                if SENSOR_HUMID or SENSOR_TEMP:
                    MESSAGE = '{0}: Temp={1:0.1f}*  Humidity={2:0.1f}%'.format(
                        APP.now(), SENSOR_TEMP.value, SENSOR_HUMID.value)
                    APP.alert(MESSAGE)
            TEMPERATURE.lastrun = datetime.datetime.now()

        if HEARTBEAT.is_time_to_run():
            print("[{0}] sending heartbeat".format(APP.now()))
            MSG = 'At {0}'.format(APP.now())
            #get summary of known miners. name, hash or offline, pool
            if APP.configuration.is_enabled('temperature'):
                SENSOR_HUMID, SENSOR_TEMP = APP.readtemperature()
                if SENSOR_HUMID or SENSOR_TEMP:
                    MSG = MSG + 'Temp={0:0.1f}*  Humidity={1:0.1f}%'.format(
                        SENSOR_TEMP.value, SENSOR_HUMID.value)
            MSG = MSG + '\n{0}'.format(APP.minersummary())
            APP.alert(MSG)
            APP.sendqueueitem(QueueEntry(QueueName.Q_LOG, MSG, 'broadcast'))
            HEARTBEAT.lastrun = datetime.datetime.now()

        if UPDATEWEB.is_time_to_run():
            print("[{0}] check for web update".format(APP.now()))
            print('Pushing update web  command to {0}.'.format(
                QueueName.Q_UPDATEWEB))
            APP.send(QueueName.Q_UPDATEWEB, 'updateweb')
            UPDATEWEB.lastrun = datetime.datetime.now()

        time.sleep(SLEEP_SECONDS)

    except KeyboardInterrupt:
        APP.shutdown()
Пример #2
0
'''test miner summary'''

from backend.fcmapp import ApplicationService

FCM = ApplicationService('test')

print(FCM.minersummary())

FCM.shutdown()