from datetime import datetime,timedelta import sys import sd_notify import os import logging import threading from orangepisensors import filetowrite, savetofile, date2matlab, readbit, checkval, blink, server, sendtosrv, checkntp, readconf, gethosint import socket cfg = readconf('/usr/local/etc/orangepy.yaml') stationid = socket.gethostname() datadir='/var/data/pms7003' filenm='pms7003' srv = server('http://mqtt.lio.edu.pl',8291,'msmt') format = "[%(asctime)s] %(message)s" logging.basicConfig(format=format, level=logging.INFO, datefmt="%Y-%m-%d %H:%M:%S") logging.root.setLevel(logging.WARNING) logging.warning("Starting PMS7003") checkntp() notify = sd_notify.Notifier() if notify.enabled(): notify.status("Initialising PMS7003 ...") def measurepms7003(port='/dev/ttyS1',timeavg=60,timeint=1): try:
import io, fcntl import time import os import sys import socket import sd_notify from datetime import datetime,timedelta import logging import threading from orangepisensors import filetowrite, savetofile, date2matlab, server, sendtosrv import uuid import requests datadir='/var/data/htu21' filenm='htu21' srv = server('http://mqtt.lio.edu.pl',8291,'pkin') format = "[%(asctime)s] %(message)s" logging.basicConfig(format=format, level=logging.INFO ,datefmt="%Y-%m-%d %H:%M:%S") logging.root.setLevel(logging.WARNING) logging.warning("Starting HTU21") notify = sd_notify.Notifier() if notify.enabled(): notify.status("Initialising HTU21 ...") class i2c(object): def __init__(self, device, bus): I2C_SLAVE=0x0703 self.fr = io.open("/dev/i2c-"+str(bus), "rb", buffering=0)