Beispiel #1
0
import csv
from networkconnection import internet_on
import json
from usim800 import sim800
from rename import rename
from uvid import getuvid
import requests
import time
import delete
uid = getuvid()
GSM = False


# if GSM:
#     gsm = sim800(baudrate=9600, path="/dev/ttys1")
#     gsm.requests.APN = "www"
def createfile(file_name):

    with open(file_name, mode='w') as csv_file:

        fieldnames = [
            'uvid', 'slave', 'pv1_voltage', 'pv2_voltage', 'pv3_voltage',
            'pv1_current', 'pv2_current', 'pv3_current', 'pv1_power',
            'pv2_power', 'pv3_power', 'rs_grid_voltage', 'st_grid_voltage',
            'tr_grid_voltage', 'grid_power', 'radiator_temperature',
            'module_temperature', 'total_energy', 'alarm_code',
            'annual_energy', 'daily_energy', 'apparent_power',
            'reactive_power', 'power_factor', "offline", 'recordedAt'
        ]
        writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
        writer.writeheader()
Beispiel #2
0
led1 = port.PA19
led2 = port.PA18

gpio.init()
gpio.setcfg(led, gpio.OUTPUT)
gpio.setcfg(led1, gpio.OUTPUT)
gpio.setcfg(led2, gpio.OUTPUT)
vers = 1
GSM = False

if GSM:
    gsm = sim800(baudrate=9600, path="/dev/ttys1")
    gsm.requests.APN = "www"
#slave_ids = find_slave_id()
slave_ids = [1,2]
uid = str(getuvid())
print(uid)
path = '/root/orangepizerodelta/'
path = ''
file_name = path + uid + '.csv'
temp_file = path + 'temp.csv'

file_name = path + uid + '.csv'
temp_file = path + 'temp.csv'
print(file_name)


if not os.path.exists(path + uid+".csv"):
    createfile(path + uid+".csv")
    print("file created")
Beispiel #3
0
import save
import uvid

uvid = uvid.getuvid()
file_name = str(uvid) + '.csv'

save.createfile(file_name)