Пример #1
0
def make_report(client):
    


if __name__ == "__main__":
    
    settings, node_id_lst = readsettings('settings.yaml')
    host = settings['influxdb']['host']
    port = settings['influxdb']['port']
    username = settings['influxdb']['username']
    password = encrypt(settings['influxdb']['password'])
    mydb = settings['influxdb']['mydb']

    client = InfluxDBClient(host=host, port=port,
                            username=username, password=password)

    listdb = client.get_list_database()
    listdb = [i['name'] for i in listdb]
    print(listdb)
    if mydb not in listdb:
        print('В influxdb нет БД {}'.format(mydb))
    else:
        client.switch_database(mydb)
        make_report(client)
Пример #2
0
                "value": val,
                "quality": status
            }
        }]
        client_db.write_points(json_body)


#        print('Write point {} to db'.format(node.nodeid.to_string()))
#        print('________________________________\n')

#    def event_notification(self, event):
#        print("Python: New event", event)

if __name__ == "__main__":

    settings, nodes = readsettings('settings.yaml')
    # Set OPC UA server param
    url = settings['opcua_server']['url']
    ua_username = settings['opcua_server']['username']
    ua_password = encrypt(settings['opcua_server']['password'])
    ua_period = settings['opcua_server']['period_subsription']
    # Set inflaxdb param
    host = settings['influxdb']['host']
    port = settings['influxdb']['port']
    username = settings['influxdb']['username']
    password = encrypt(settings['influxdb']['password'])
    mydb = settings['influxdb']['mydb']
    #    username = settings['server_opcua']['username']
    #    psw = settings['server_opcua']['password'].encode()
    #    password = base64.b64decode(psw).decode()
Пример #3
0
# -*- coding: utf-8 -*-
from influxdb import InfluxDBClient
from datetime import datetime
from settings import readsettings, encrypt

settings, node_id_lst = readsettings('settings.yaml')
host = settings['influxdb']['host']
port = settings['influxdb']['port']
username = settings['influxdb']['username']
password = encrypt(settings['influxdb']['password'])
mydb = settings['influxdb']['mydb']

client = InfluxDBClient(host=host,
                        port=port,
                        username=username,
                        password=password)

listdb = client.get_list_database()
print(listdb)
if mydb not in listdb:
    client.create_database(mydb)
client.switch_database(mydb)
now = datetime.now()
now = now.strftime("%Y-%m-%dT%H:%M:%S.%f")

json_body = [{
    "measurement": "power",
    "tags": {
        "station": "ST01",
        "blok": "01"
    },
from gmusicapi import Mobileclient

import pafy

from random import shuffle

from settings import readsettings, writesettings
from db import (create_db_connection, close_db_connection,
                commit_db_connection, create_db_table, insert_db_table,
                drop_db_table, read_db_table)

from mpvplayer import mpvplayergetvolume, mpvplayer, mpvplayerstop, mpvplayercycle, mpvplayergetskip, mpvplayersetskip

#Read settings from gmusicplayer.json
googleuserid = readsettings('gmusicplayer', 'googleuserid')
googlepasswd = readsettings('gmusicplayer', 'googlepasswd')

#YouTube API Constants
DEVELOPER_KEY = readsettings('youtubeplayer', 'apikey')
YOUTUBE_API_SERVICE_NAME = 'youtube'
YOUTUBE_API_VERSION = 'v3'

#API settings
gmapi = Mobileclient()
logged_in = gmapi.login(googleuserid, googlepasswd,
                        Mobileclient.FROM_MAC_ADDRESS)

pafy.set_api_key(DEVELOPER_KEY)

global musicplaylisttype
Пример #5
0
def mpvplayergetvolume():
    mpvvolume = readsettings('mpvplayer', 'volume')
    return mpvvolume