diff --git a/bin/collector_loadtest.py b/bin/collector_loadtest.py --- a/bin/collector_loadtest.py +++ b/bin/collector_loadtest.py @@ -1,11 +1,16 @@ -import sys -sys.path.append('bin') -from run_local import log +#!bin/python +import logging +import time +from typing import cast + +import twisted.internet.reactor from light9.collector.collector_client import sendToCollector -from light9.namespaces import L9, DEV -from twisted.internet import reactor -import time -import logging +from light9.effect.settings import DeviceSettings +from light9.namespaces import DEV, L9 +from light9.run_local import log +from twisted.internet.interfaces import IReactorCore + +reactor = cast(IReactorCore, twisted.internet.reactor) log.setLevel(logging.DEBUG) @@ -20,17 +25,23 @@ def loadTest(): def send(i): if i % 100 == 0: log.info('sendToCollector %s', i) - d = sendToCollector("http://localhost:999999/", session, - [[DEV["backlight1"], L9["color"], "#ffffff"], - [DEV["backlight2"], L9["color"], "#ffffff"], - [DEV["backlight3"], L9["color"], "#ffffff"], - [DEV["backlight4"], L9["color"], "#ffffff"], - [DEV["backlight5"], L9["color"], "#ffffff"], - [DEV["down2"], L9["color"], "#ffffff"], - [DEV["down3"], L9["color"], "#ffffff"], - [DEV["down4"], L9["color"], "#ffffff"], - [DEV["houseSide"], L9["level"], .8], - [DEV["backlight5"], L9["uv"], 0.011]]) + d = sendToCollector( + "http://localhost:8202/", + session, + DeviceSettings( + graph=None, + settingsList=[ + [DEV["backlight1"], L9["color"], "#ffffff"], # + [DEV["backlight2"], L9["color"], "#ffffff"], + [DEV["backlight3"], L9["color"], "#ffffff"], + [DEV["backlight4"], L9["color"], "#ffffff"], + [DEV["backlight5"], L9["color"], "#ffffff"], + [DEV["down2"], L9["color"], "#ffffff"], + [DEV["down3"], L9["color"], "#ffffff"], + [DEV["down4"], L9["color"], "#ffffff"], + [DEV["houseSide"], L9["level"], .8], + [DEV["backlight5"], L9["uv"], 0.011] + ])) def ontime(dt, i=i): times[i] = dt