def createDevice(dataJson):
    td = TestDevice()
    # create a test device
    try:
        params = td.get_params(client_id, dataJson["device_type"])
        # fill in the params
        params["device_type"] = dataJson["device_type"]
        params["name"] = dataJson['name']
        params["reference"] = "reference"
        params["description"] = "description"
        # global params
        for the_param in params['global']:
            for p in dataJson["parameters"]:
                if the_param["key"] == p["key"]:
                    the_param["value"] = p["value"]
                    break
        print params['global']
        # xpl params
        pass  # there are no xpl params for this plugin
        # create
        return td.create_device(params)['id'], td
    except:
        Printc.err(u"Error while creating the test devices {0} : {1}".format(
            device, traceback.format_exc()))
        return False, td
Beispiel #2
0
def create_device():
    ### create the device, and if ok, get its id in device_id
    client_id  = "plugin-{0}.{1}".format(plugin, get_sanitized_hostname())
    print("Creating the irtrans device...")
    td = TestDevice()
    params = td.get_params(client_id, "irtrans.irtrans_lan")
        # fill in the params
    params["device_type"] = "irtrans.irtrans_lan"
    params["name"] = "test_IRTrans_LAN"
    params["reference"] = "IRTrans Lan client"
    params["description"] = "Handle IRTrans modul"
    for idx, val in enumerate(params['global']):
        if params['global'][idx]['key'] == 'ir_coder' :  params['global'][idx]['value'] = ENCODER
        if params['global'][idx]['key'] == 'server_path' :  params['global'][idx]['value'] = DEVICE_PATH
        if params['global'][idx]['key'] == 'ip_server' :  params['global'][idx]['value'] = DEVICE_IP_SERVER
        if params['global'][idx]['key'] == 'irtrans_ip' :  params['global'][idx]['value'] = DEVICE_IP_IRTRANS

    for idx, val in enumerate(params['xpl']):
        params['xpl'][idx]['value'] = DEVICE_NAME

    # go and create
    td.create_device(params)
    print "Device IRTrans Lan {0} configured".format(DEVICE_NAME) 
    
    print("Creating the irwsserver device...")
    td = TestDevice()
    params = td.get_params(client_id, "irtrans.irwsserver")
        # fill in the params
    params["device_type"] = "irtrans.irwsserver"
    params["name"] = "test_IRTrans_WS"
    params["reference"] = "IR WebSockect client"
    params["description"] = "Handle IR WebSockect modul"
    for idx, val in enumerate(params['global']):
        if params['global'][idx]['key'] == 'ir_coder' :  params['global'][idx]['value'] = ENCODER
        elif params['global'][idx]['key'] == 'ip_server' :  params['global'][idx]['value'] = DEVICE2_IP_SERVER
        elif params['global'][idx]['key'] == 'port_server' :  params['global'][idx]['value'] = DEVICE2_PORT_SERVER
        elif params['global'][idx]['key'] == 'ssl_activate' :  params['global'][idx]['value'] = DEVICE2_SSL
        elif params['global'][idx]['key'] == 'ssl_certificate' :  params['global'][idx]['value'] = DEVICE2_CERTIFICATE
        elif params['global'][idx]['key'] == 'ssl_key' :  params['global'][idx]['value'] = DEVICE2_KEY
        elif params['global'][idx]['key'] == 'ir_repeat' :  params['global'][idx]['value'] = 3
        elif params['global'][idx]['key'] == 'ir_tolerance' :  params['global'][idx]['value'] = 150
        elif params['global'][idx]['key'] == 'ir_large_tolerance' :  params['global'][idx]['value'] = 300
        elif params['global'][idx]['key'] == 'ir_max_out' :  params['global'][idx]['value'] = 10

    for idx, val in enumerate(params['xpl']):
        params['xpl'][idx]['value'] = DEVICE2_NAME

    # go and create
    td.create_device(params)
    print "Device irwsserver {0} configured".format(DEVICE2_NAME) 
def create_device():
    ### create the device, and if ok, get its id in device_id
    client_id = "plugin-{0}.{1}".format(plugin, get_sanitized_hostname())
    print "Creating the SMS  device..."
    td = TestDevice()
    params = td.get_params(client_id, "notify.smsweb")
    # fill in the params
    params["device_type"] = "notify.smsweb"
    params["name"] = DEVICE_NAME
    params["reference"] = "reference"
    params["description"] = "description"
    for idx, val in enumerate(params['global']):
        if params['global'][idx]['key'] == 'operator':
            params['global'][idx]['value'] = OPERATOR
        if params['global'][idx]['key'] == 'login':
            params['global'][idx]['value'] = OP_LOGIN
        if params['global'][idx]['key'] == 'pwd':
            params['global'][idx]['value'] = OP_PWD

    for idx, val in enumerate(params['xpl']):
        params['xpl'][idx]['value'] = PHONE_TEL

    # go and create
    td.create_device(params)
    print "Device SMS {0} configured".format(DEVICE_NAME_NOTIFRY)

    print("Creating the Newtifry  device...")
    td = TestDevice()
    params = td.get_params(client_id, "notify.newtifry")
    # fill in the params
    params["device_type"] = "notify.newtifry"
    params["name"] = DEVICE_NAME_NOTIFRY
    params["reference"] = "reference"
    params["description"] = "description"
    for idx, val in enumerate(params['global']):
        if params['global'][idx]['key'] == 'sourcekey':
            params['global'][idx]['value'] = SOURCE_KEY
        if params['global'][idx]['key'] == 'defaulttitle':
            params['global'][idx]['value'] = 'Test message'
        if params['global'][idx]['key'] == 'backend':
            params['global'][idx]['value'] = BACKEND

    for idx, val in enumerate(params['xpl']):
        params['xpl'][idx]['value'] = TO

    # go and create
    td.create_device(params)

    print "Device Newtifry {0} configured".format(DEVICE_NAME_NOTIFRY)
def create_device():
    ### create the device, and if ok, get its id in device_id
    client_id = "plugin-{0}.{1}".format(plugin, get_sanitized_hostname())
    print "Creating the PLCBUS  device..."
    td = TestDevice()
    params = td.get_params(client_id, "plcbus.switch")
    # fill in the params
    params["name"] = DEVICE_NAME
    params["reference"] = "reference"
    params["description"] = "description"

    for idx, val in enumerate(params["xpl"]):
        params["xpl"][idx]["value"] = ADDRESS

    # go and create
    td.create_device(params)
    print "Device PLCBUS {0} configured".format(DEVICE_NAME_PLCBUS)
Beispiel #5
0
def create_device():
    ### create the device, and if ok, get its id in device_id
    client_id = "plugin-{0}.{1}".format(plugin, get_sanitized_hostname())
    print "Creating the knx device..."
    td = TestDevice()
    params = td.get_params(client_id, "mirror")
    # fill in the params
    params["device_type"] = "switch"
    params["name"] = DEVICE_NAME_MIRROR
    params["Cmd_Datapoint"] = "1.001"
    params["Stat_Datapoint"] = "1.001"
    params["address_cmd"] = "1/1/1"
    params["address_stat"] = "1/0/1"

    # go and create
    td.create_device(params)
    print "Device KNX {0} configured".format(DEVICE_NAME_KAROTZ)
Beispiel #6
0
def create_device():
    ### create the device, and if ok, get its id in device_id
    client_id = "plugin-{0}.{1}".format(plugin, get_sanitized_hostname())
    print "Creating the Hue device..."
    td = TestDevice()
    params = td.get_params(client_id, "hue")
    # fill in the params
    params["device_type"] = "hue"
    params["name"] = DEVICE_NAME_MIRROR
    params["address"] = ADDRESS
    for idx, val in enumerate(params['global']):
        if params['global'][idx]['key'] == 'name':
            params['global'][idx]['value'] = NAME
        if params['global'][idx]['key'] == 'address':
            params['global'][idx]['value'] = ADDRESS

    # go and create
    td.create_device(params)
    print "Device Hue {0} configured".format(DEVICE_NAME_KAROTZ)
def create_device():
    ### create the device, and if ok, get its id in device_id
    client_id  = "plugin-{0}.{1}".format(plugin, get_sanitized_hostname())
    print("Creating the primary controller device...")
    td = TestDevice()
    params = td.get_params(client_id, "primary.controller")
    # fill in the params
    params["device_type"] = "primary.controller"
    params["name"] = "test_ozw_crtl"
    params["reference"] = "Z-Stick2"
    params["description"] = "Z-Stick2 USB"
    for idx, val in enumerate(params['global']):
#        if params['global'][idx]['key'] == 'network_id' :  params['global'][idx]['value'] = NETWORK_ID
        if params['global'][idx]['key'] == 'driver' :  params['global'][idx]['value'] = DRIVER
    for idx, val in enumerate(params['xpl']):
        params['xpl'][idx]['value'] = NETWORK_ID
    # go and create
    td.create_device(params)
    print "Device primary controller configured"
def create_device():
    ### create the device, and if ok, get its id in device_id
    client_id  = "plugin-{0}.{1}".format(plugin, get_sanitized_hostname())
    print("Creating the UPS device...")
    td = TestDevice()
    params = td.get_params(client_id, "ups.device")
        # fill in the params
    params["device_type"] = "ups.device"
    params["name"] = "test_UPS_Monitor"
    params["reference"] = "NUT Sockect client"
    params["description"] = "Monitor UPS"
    for idx, val in enumerate(params['global']):
        if params['global'][idx]['key'] == 'timer_poll' :  params['global'][idx]['value'] = TIMER_POLL

    for idx, val in enumerate(params['xpl']):
        params['xpl'][idx]['value'] = DEVICE_NAME

    # go and create
    td.create_device(params)
    print "Device UPS {0} configured".format(DEVICE_NAME) 
def create_device():
    ### create the device, and if ok, get its id in device_id
    client_id  = "plugin-{0}.{1}".format(plugin, get_sanitized_hostname())
    print("Creating the Remote device...")
    td = TestDevice()
    params = td.get_params(client_id, "daikcode.remotearc")
        # fill in the params
    params["device_type"] = "daikcode.remotearc"
    params["name"] = "test_daikcode.remotearc"
    params["reference"] = "ARC Remote"
    params["description"] = "Connected to {0}".format(DEVICE_IR)
    for idx, val in enumerate(params['global']):
        if params['global'][idx]['key'] == 'irdevice' :  params['global'][idx]['value'] = DEVICE_IR
        if params['global'][idx]['key'] == 'datatype' :  params['global'][idx]['value'] = DEVICE_DATATYPE

    for idx, val in enumerate(params['xpl']):
        params['xpl'][idx]['value'] = DEVICE_NAME

    # go and create
    td.create_device(params)
    print "Device Remote {0} configured".format(DEVICE_NAME) 
def create_device():
    ### create the device, and if ok, get its id in device_id
    client_id = "plugin-{0}.{1}".format(plugin, get_sanitized_hostname())
    print("Creating the Remote device...")
    td = TestDevice()
    params = td.get_params(client_id, "daikcode.remotearc")
    # fill in the params
    params["device_type"] = "daikcode.remotearc"
    params["name"] = "test_daikcode.remotearc"
    params["reference"] = "ARC Remote"
    params["description"] = "Connected to {0}".format(DEVICE_IR)
    for idx, val in enumerate(params['global']):
        if params['global'][idx]['key'] == 'irdevice':
            params['global'][idx]['value'] = DEVICE_IR
        if params['global'][idx]['key'] == 'datatype':
            params['global'][idx]['value'] = DEVICE_DATATYPE

    for idx, val in enumerate(params['xpl']):
        params['xpl'][idx]['value'] = DEVICE_NAME

    # go and create
    td.create_device(params)
    print "Device Remote {0} configured".format(DEVICE_NAME)
def create_device():
    ### create the device, and if ok, get its id in device_id
    print(u"Creating the vigilocation device...")
    td = TestDevice()
    td.create_device("plugin", plugin, get_sanitized_hostname(), "test_vigilocation", "vigilightning.vigilocation")
    td.configure_global_parameters({"latitude " : "46.739868", "longitude" : "2.328084",
                "criticalradius" : 1, "nearbyradius" : 3, "approachradius" : 5,
                "releasetimes" : 3})
    print "Device vigilocation configured"
def create_device():
    ### create the device, and if ok, get its id in device_id
    client_id  = "plugin-{0}.{1}".format(plugin, get_sanitized_hostname())
    print "Creating the SMS  device..."
    td = TestDevice()
    params = td.get_params(client_id, "notify.smsweb")
        # fill in the params
    params["device_type"] = "notify.smsweb"
    params["name"] = DEVICE_NAME
    params["reference"] = "reference"
    params["description"] = "description"
    for idx, val in enumerate(params['global']):
        if params['global'][idx]['key'] == 'operator' :  params['global'][idx]['value'] = OPERATOR
        if params['global'][idx]['key'] == 'login' :  params['global'][idx]['value'] = OP_LOGIN
        if params['global'][idx]['key'] == 'pwd' :  params['global'][idx]['value'] = OP_PWD

    for idx, val in enumerate(params['xpl']):
        params['xpl'][idx]['value'] = PHONE_TEL

    # go and create
    td.create_device(params)
    print "Device SMS {0} configured".format(DEVICE_NAME_NOTIFRY)

    print("Creating the Newtifry  device...")
    td = TestDevice()
    params = td.get_params(client_id, "notify.newtifry")
        # fill in the params
    params["device_type"] = "notify.newtifry"
    params["name"] = DEVICE_NAME_NOTIFRY
    params["reference"] = "reference"
    params["description"] = "description"
    for idx, val in enumerate(params['global']):
        if params['global'][idx]['key'] == 'sourcekey' :  params['global'][idx]['value'] = SOURCE_KEY
        if params['global'][idx]['key'] == 'defaulttitle' :  params['global'][idx]['value'] = 'Test message'
        if params['global'][idx]['key'] == 'backend' :  params['global'][idx]['value'] = BACKEND

    for idx, val in enumerate(params['xpl']):
        params['xpl'][idx]['value'] = TO

    # go and create
    td.create_device(params)

    print "Device Newtifry {0} configured".format(DEVICE_NAME_NOTIFRY)
Beispiel #13
0
                           parser=None,
                           nohub=True,
                           test=True)

    # set up the plugin name
    name = "ping"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = {'configured': True}

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print(
            u"Error while deleting all the test device for the client id '{0}' : {1}"
            .format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        params = td.get_params(client_id, "ping.ping")
    # set up the plugin name
    name = "rfplayer"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = {'configured': True, 'auto_startup': 'N'}

    # specific configuration for test mdode (handled by the manager for plugin startup)
    cfg['test_mode'] = True
    cfg['test_option'] = "{0}/x10_protocol_data.json".format(test_folder)

    ### start tests
    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        Printc.err(
            u"Error while deleting all the test device for the client id '{0}' : {1}"
            .format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        #device_id = td.create_device(client_id, "test_device_RFPlayer", "RFPlayer.electric_meter")
    # set test plugin ready for manager
    th = threading.Thread(None, xpl_plugin.ready, "plugin_test_ready") 
    th.start()

    # set up the plugin name
    name = "irtrans"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = {'configured' : True }

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        device_id = td.create_device(client_id, "test_IRTrans_Lan", "irtrans.irtrans_lan")
        params = {"device" : DEVICE_NAME, "server_path" : DEVICE_PATH, "ip_server": DEVICE_IP_SERVER, "irtrans_ip": DEVICE_IP_IRTRANS}
        print (u"configure_global_parameters : {0}".format(params))
        td.configure_global_parameters(params)
    name = "rfxcom"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = { 'configured' : True,
            'device' : '/dev/rfxcom' }
    # specific configuration for test mdode (handled by the manager for plugin startup)
    cfg['test_mode'] = True 
    cfg['test_option'] = "{0}/type_11_sensor_data.json".format(test_folder)
   

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except: 
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        params = td.get_params(client_id, "rfxcom.open_close")
   
        for dev in devices:
            # fill in the params
    # set up the plugin name
    name = "rfxcom"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = {"configured": True, "device": "/dev/rfxcom"}
    # specific configuration for test mdode (handled by the manager for plugin startup)
    cfg["test_mode"] = True
    cfg["test_option"] = "{0}/type_20_data.json".format(test_folder)

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print (
            u"Error while deleting all the test device for the client id '{0}' : {1}".format(
                client_id, traceback.format_exc()
            )
        )
        sys.exit(1)

    # create a test device
    try:
Beispiel #18
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from domogik.tests.common.testdevice import TestDevice
from domogik.common.utils import get_sanitized_hostname
import traceback
import sys

if __name__ == "__main__":

    # set up the plugin name
    name = "daikcode"

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print(
            u"Error while deleting all the test device for the client id '{0}' : {1}"
            .format(client_id, traceback.format_exc()))
        sys.exit(1)
    name = "rfxcom"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = { 'configured' : True,
            'device' : '/dev/rfxcom' }
    # specific configuration for test mdode (handled by the manager for plugin startup)
    cfg['test_mode'] = True 
    cfg['test_option'] = "{0}/352_data.json".format(test_folder)
   

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except: 
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create the test devices
    for dev in devices:
        try:
            device_id = td.create_device(client_id, "test_device_rfxcom_type52_{0}".format(dev), "rfxcom.temperature_humidity")
            td.configure_global_parameters({"device" : dev})
            devices[dev] = device_id
                           nohub = True,
                           test  = True)

    # set up the plugin name
    name = "script"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = { 'configured' : True}
   

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except: 
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        params = td.get_params(client_id, "script.info_binary")
   
        for dev in devices:
            # fill in the params
    # set up the plugin name
    name = "rfxcom"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = {'configured': True, 'device': '/dev/rfxcom'}
    # specific configuration for test mdode (handled by the manager for plugin startup)
    cfg['test_mode'] = True
    cfg['test_option'] = "{0}/type_11_sensor_data.json".format(test_folder)

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print(
            u"Error while deleting all the test device for the client id '{0}' : {1}"
            .format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        params = td.get_params(client_id, "rfxcom.open_close")
Beispiel #22
0
                           nohub = True,
                           test  = True)

    # set up the plugin name
    name = "wol"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = { 'configured' : True}
   

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except: 
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        params = td.get_params(client_id, "wol.wol")
   
        for dev in devices:
            # fill in the params
    # set up the plugin name
    name = "rfxcom"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = {'configured': True, 'device': '/dev/rfxcom'}
    # specific configuration for test mdode (handled by the manager for plugin startup)
    cfg['test_mode'] = True
    cfg['test_option'] = "{0}/type_20_data.json".format(test_folder)

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print(
            u"Error while deleting all the test device for the client id '{0}' : {1}"
            .format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        params = td.get_params(client_id, "rfxcom.smoke_sensor")
    name = "rfxcom"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = { 'configured' : True,
            'device' : '/dev/rfxcom' }
    # specific configuration for test mdode (handled by the manager for plugin startup)
    cfg['test_mode'] = True 
    cfg['test_option'] = "{0}/type_52_data.json".format(test_folder)
   

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except: 
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        params = td.get_params(client_id, "rfxcom.temperature_humidity")
   
        for dev in devices:
            # fill in the params
    # set test plugin ready for manager
    th = threading.Thread(None, xpl_plugin.ready, "plugin_test_ready") 
    th.start()

    # set up the plugin name
    name = "daikcode"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = {'configured' : True }

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        device_id = td.create_device(client_id, "test_daikcode_remotearc", "daikcode.remotearc")
        params = {"device" : DEVICE_NAME, "irdevice": DEVICE_IR, "datatype": DEVICE_DATATYPE}
        print (u"configure_global_parameters : {0}".format(params))
        td.configure_global_parameters(params)
    name = "rfxcom"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = { 'configured' : True,
            'device' : '/dev/rfxcom' }
    # specific configuration for test mdode (handled by the manager for plugin startup)
    cfg['test_mode'] = True 
    cfg['test_option'] = "{0}/type_11_command_data.json".format(test_folder)
   

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except: 
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        params = td.get_params(client_id, "rfxcom.switch_lighting2")
   
        for dev in devices:
            # fill in the params
Beispiel #27
0
    # set test plugin ready for manager
    th = threading.Thread(None, xpl_plugin.ready, "plugin_test_ready")
    th.start()

    # set up the plugin name
    name = "irtrans"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = {'configured': True}

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print(
            u"Error while deleting all the test device for the client id '{0}' : {1}"
            .format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        device_id = td.create_device(client_id, "test_IRTrans_Lan",
                                     "irtrans.irtrans_lan")
    # set up the xpl features
    xpl_plugin = XplPlugin(name="test", daemonize=False, parser=None, nohub=True, test=True)

    # set up the plugin name
    name = "script"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = {"configured": True}

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print (
            u"Error while deleting all the test device for the client id '{0}' : {1}".format(
                client_id, traceback.format_exc()
            )
        )
        sys.exit(1)

    # create a test device
    try:
#!/usr/bin/python
# -*- coding: utf-8 -*-

from domogik.tests.common.testdevice import TestDevice
from domogik.common.utils import get_sanitized_hostname
import traceback
import sys

if __name__ == "__main__":

    # set up the plugin name
    name = "daikcode"

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)
    # set up the plugin name
    name = "geoloc"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = { 'configured' : True,
            'host' : '0.0.0.0',
            'port' : '40445' }
   

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except: 
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        params = td.get_params(client_id, "geoloc.position_degrees")

        # fill in the params
        params["device_type"] = "geoloc.position_degrees"
Beispiel #31
0
    # set up the xpl features
    xpl_plugin = XplPlugin(name="test", daemonize=False, parser=None, nohub=True, test=True)

    # set up the plugin name
    name = "ping"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = {"configured": True}

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print(
            u"Error while deleting all the test device for the client id '{0}' : {1}".format(
                client_id, traceback.format_exc()
            )
        )
        sys.exit(1)

    # create a test device
    try:
#!/usr/bin/python
# -*- coding: utf-8 -*-


from domogik.tests.common.testdevice import TestDevice
from domogik.common.utils import get_sanitized_hostname


if __name__ == "__main__":

    td = TestDevice()
    td.create_device("plugin", "rfxcom", get_sanitized_hostname(), "test_device_rfxcom", "rfxcom.temperature_humidity")
    td.configure_global_parameters({"address" : "th1 0x2504"})

    # set up the plugin name
    name = "teleinfo"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = { 'configured' : True }

    # specific configuration for test mdode (handled by the manager for plugin startup)
    cfg['test_mode'] = True
    cfg['test_option'] = "{0}/tests_hphc_data.json".format(test_folder)

    ### start tests
    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        #device_id = td.create_device(client_id, "test_device_teleinfo", "teleinfo.electric_meter")
        
        params = td.get_params(client_id, "teleinfo.electric_meter")
    
Beispiel #34
0
    # set up the plugin name
    name = "teleinfo"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = { 'configured' : True }

    # specific configuration for test mdode (handled by the manager for plugin startup)
    cfg['test_mode'] = True
    cfg['test_option'] = "{0}/tests_hphc_data.json".format(test_folder)

    ### start tests
    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        #device_id = td.create_device(client_id, "test_device_teleinfo", "teleinfo.electric_meter")
        
        params = td.get_params(client_id, "teleinfo.electric_meter")
    
from domogik.tests.common.testdevice import TestDevice
from domogik.common.utils import get_sanitized_hostname

cid = "plugin-test.{0}".format(get_sanitized_hostname())
t = TestDevice()

# an xpl device
params = t.get_params(cid, "test.xpltest")
params['name'] = 'Test-xpl-device'
params['reference'] = 'Test-xpl-reference'
params['description'] = 'Test-xpl-description'
params['global'][0]['value'] = 'xpl-set-global'
params['xpl'][0]['value'] = 'xpl-set-devicetype'
params['xpl_stats']['test_xpl_stat'][0]['value'] = 'xpl-stat-set-device' 
params['xpl_commands']['test_xpl_command'][0]['value'] = 'xpl-cmd-set-device' 
dev = t.create_device(params)

# an mq device
params = t.get_params(cid, "test.mqtest")
params['name'] = 'Test-mq-device'
params['reference'] = 'Test-mq-reference'
params['description'] = 'Test-mq-description'
params['global'][0]['value'] = 'mq-set-global'
dev = t.create_device(params)
Beispiel #36
0
    # set test plugin ready for manager
    th = threading.Thread(None, xpl_plugin.ready, "plugin_test_ready")
    th.start()

    # set up the plugin name
    name = "daikcode"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = {'configured': True}

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print(
            u"Error while deleting all the test device for the client id '{0}' : {1}"
            .format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        device_id = td.create_device(client_id, "test_daikcode_remotearc",
                                     "daikcode.remotearc")
                           nohub = True,
                           test  = True)

    # set up the plugin name
    name = "script"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = { 'configured' : True}
   

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except: 
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        params = td.get_params(client_id, "script.action")
   
        for dev in devices:
            # fill in the params
    # set up the plugin name
    name = "callerid"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = { 'configured' : True}
    # specific configuration for test mdode (handled by the manager for plugin startup)
    cfg['test_mode'] = True 
    cfg['test_option'] = "{0}/data.json".format(test_folder)
   

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except: 
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        params = td.get_params(client_id, "callerid.callerid")
   
        for dev in devices:
            # fill in the params
    # set test plugin ready for manager
    th = threading.Thread(None, xpl_plugin.ready, "plugin_test_ready") 
    th.start()

    # set up the plugin name
    name = "nutserve"

    # set up the configuration of the plugin
    # configuration is done in test_0010_configure_the_plugin with the cfg content
    # notice that the old configuration is deleted before
    cfg = {'configured': True, 'host': '192.168.0.192', 'port': 3493, 'login': '', 'pwd': ''}

    ### start tests

    # load the test devices class
    td = TestDevice()

    # delete existing devices for this plugin on this host
    client_id = "{0}-{1}.{2}".format("plugin", name, get_sanitized_hostname())
    try:
        td.del_devices_by_client(client_id)
    except:
        print(u"Error while deleting all the test device for the client id '{0}' : {1}".format(client_id, traceback.format_exc()))
        sys.exit(1)

    # create a test device
    try:
        params = td.get_params(client_id, "ups.device")
            # fill in the params
        params["device_type"] = "ups.device"
        params["name"] = "test_UPS_Monitor"
#!/usr/bin/python
# -*- coding: utf-8 -*-


from domogik.tests.common.testdevice import TestDevice
from domogik.common.utils import get_sanitized_hostname


if __name__ == "__main__":

    client_id = "plugin-diskfree.{0}".format(get_sanitized_hostname())
    td = TestDevice()
    params = td.get_params(client_id, "diskfree.disk_usage")

    # fill in the params
    params["device_type"] = "diskfree.disk_usage"
    params["name"] = "TestDevice"
    params["reference"] = "reference"
    params["description"] = "description"
    for idx, val in enumerate(params['global']):
        params['global'][idx]['value'] = 60
    for idx, val in enumerate(params['xpl']):
        params['xpl'][idx]['value'] = '/'

    # go and create
    td.create_device(params)