Esempio n. 1
0
def PolyRemote(config):
    configData = yaml.load(config)
    try:
        polyglot = polyinterface.Interface(configData['controller']['name'])
        polyglot.start()
        controller = RemoteController(polyglot, configData)
        controller.name = configData['controller']['name']
        controller.runForever()
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
Esempio n. 2
0
def PolyRemote(serverconfig, config):
    configData = yaml.safe_load(serverconfig)
    if config:
        configData.update(yaml.safe_load(config))

    try:
        polyglot = polyinterface.Interface(configData['controller']['name'])
        polyglot.start()
        controller = RemoteController(polyglot, configData, config is not None)
        controller.name = configData['controller']['name']
        controller.runForever()
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
Esempio n. 3
0
#!/usr/bin/env python
#
import polyinterface
import sys
LOGGER = polyinterface.LOGGER
""" Grab My Controller Node """
from nodes import CamectController

if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('Camect')
        polyglot.start()
        control = CamectController(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        LOGGER.warning("Received interrupt or exit...")
        polyglot.stop()
    except Exception as err:
        LOGGER.error('Excption: {0}'.format(err), exc_info=True)
    sys.exit(0)
Esempio n. 4
0
        self.reportDrivers()

    drivers = [{
        'driver': 'ST',
        'value': 0,
        'uom': 25
    }, {
        'driver': 'GV0',
        'value': 0,
        'uom': 56
    }, {
        'driver': 'GV1',
        'value': 1,
        'uom': 2
    }]

    id = 'hostnode'

    commands = {'DON': setOn, 'DOF': setOff, 'QUERY': query}


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('PingNodeServer')
        polyglot.start()
        control = Controller(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        polyglot.stop()
        sys.exit(0)
Esempio n. 5
0
        'driver': 'ST',
        'value': 1,
        'uom': 2
    }, {
        'driver': 'GV0',
        'value': 0,
        'uom': 14
    }, {
        'driver': 'GV1',
        'value': 0,
        'uom': 14
    }, {
        'driver': 'GV2',
        'value': 0,
        'uom': 14
    }, {
        'driver': 'GV3',
        'value': 0,
        'uom': 56
    }]


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('Sun')
        polyglot.start()
        control = Controller(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
Esempio n. 6
0
by JimBoCA [email protected]
"""
try:
    import polyinterface
except ImportError:
    import pgc_interface as polyinterface
import sys
import time

from nodes import Controller

LOGGER = polyinterface.LOGGER

if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('StressTest')
        """
        Instantiates the Interface to Polyglot.
        The name doesn't really matter unless you are starting it from the
        command line then you need a line Template=N
        where N is the slot number.
        """
        polyglot.start()
        """
        Starts MQTT and connects to Polyglot.
        """
        control = Controller(polyglot)
        """
        Creates the Controller Node and passes in the Interface
        """
        control.runForever()
Esempio n. 7
0
        #LOGGER.debug('setSetback Called')
        value = int(command.get('value'))
        #LOGGER.debug('setSetback Reeived:' + str(value))
        if self.messana.systemSetback(value):
            ISYdriver = self.messana.getSystemSetbackISYdriver()
            self.setDriver(ISYdriver, value, report=True)

    def ISYupdate(self, command):
        #LOGGER.info('ISY-update called')
        self.messana.updateSystemData('all')
        self.updateISYdrivers('all')
        self.reportDrivers()

    commands = {
        'UPDATE': ISYupdate,
        'SET_STATUS': setStatus,
        'SET_ENERGYSAVE': setEnergySave,
        'SET_SETBACK': setSetback
    }


if __name__ == "__main__":
    try:
        LOGGER.info('Starting Messana Controller')
        polyglot = polyinterface.Interface('Messana_Control')
        polyglot.start()
        control = MessanaController(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
Esempio n. 8
0
def holidays_server():
    polyglot = polyinterface.Interface('HolidayServer')
    polyglot.start()
    controller = Controller(polyglot)
    controller.name = 'Holiday Controller'
    controller.runForever()
Esempio n. 9
0
    }]

    id = 'DYPFANV1'

    commands = {
        'QUERY': query,
        'DON': set_on,
        'DOF': set_off,
        'SPEED': set_speed,
        'OFFTMR': set_off_timer,
        'AUTO': set_auto,
        'OSCON': set_oscillation_on,
        'OSCOFF': set_oscillation_off,
        'NIGHTON': set_night_on,
        'NIGHTOFF': set_night_off,
        'STBYON': set_standby_mon_on,
        'STBYOFF': set_standby_mon_off,
        'RSTFLT': reset_filter_life,
        'SETQAL': set_quality
    }


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('Dyson')
        polyglot.start()
        control = Controller(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
Esempio n. 10
0
#!/usr/bin/env python3
"""
Polyglot v2 node server Volumio Media Server control.
Copyright (C) 2021 Robert Paauwe
"""
import polyinterface
import sys
from nodes import controller

LOGGER = polyinterface.LOGGER

if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('Volumio')
        polyglot.start()
        control = controller.Controller(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
        

Esempio n. 11
0
        {
            'driver': 'GV1',
            'value': 20,
            'uom': 25
        },  # integer: Log/Debug Mode
        {
            'driver': 'GV2',
            'value': 0,
            'uom': 2
        }  # Listen
    ]


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('HueEmulator')
        """
        Instantiates the Interface to Polyglot.
        """
        polyglot.start()
        """
        Starts MQTT and connects to Polyglot.
        """
        control = Controller(polyglot)
        """
        Creates the Controller Node and passes in the Interface
        """
        control.runForever()
        """
        Sits around and does nothing forever, keeping your program running.
        """
Esempio n. 12
0
    
    id = 'baspedge1_id'

    commands = {
                    'BON1': setOn1,
                    'BOF1': setOff1,
                    'BON2': setOn2,
                    'BOF2': setOff2,
                    'BON3': setOn3,
                    'BOF3': setOff3,
                    'BON4': setOn4,
                    'BOF4': setOff4,
                    'BON5': setOn5,
                    'BOF5': setOff5,
                    'BON6': setOn6,
                    'BOF6': setOff6,
                    'QUERY': query,
                } 
    

if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('BASpi-Edge')
        polyglot.start()
        control = Controller(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        polyglot.stop()
        sys.exit(0)
        
    id = 'templatenodeid'
    """
    id of the node from the nodedefs.xml that is in the profile.zip. This tells
    the ISY what fields and commands this node has.
    """
    commands = {
                    'DON': setOn, 'DOF': setOff
                }
    """
    This is a dictionary of commands. If ISY sends a command to the NodeServer,
    this tells it which method to call. DON calls setOn, etc.
    """

if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('Template')
        """
        Instantiates the Interface to Polyglot.
        The name doesn't really matter unless you are starting it from the
        command line then you need a line Template=N
        where N is the slot number.
        """
        polyglot.start()
        """
        Starts MQTT and connects to Polyglot.
        """
        control = Controller(polyglot)
        """
        Creates the Controller Node and passes in the Interface
        """
        control.runForever()
Esempio n. 14
0
        'DON': set_on,
        'DOF': set_off,
        'DFON': set_on,
        'DFOF': set_off,
        'RR': set_transition,
        'CLITEMP': set_colortemp,
        'SET_COLOR_RGB': set_rgb,
        'SET_COLOR': set_color,
        'SET_HSB': set_hsv,
        'SET_CTBR': set_colortemp,
        'SET_HUE': set_hsv,
        'SET_SAT': set_hsv,
        'SET_BRI': set_hsv,
        'BRT': brt_dim,
        'DIM': brt_dim,
        'FDUP': fade,
        'FDDOWN': fade,
        'FDSTOP': fade,
        'EFFECT': set_effect
    }


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('Yeelight')
        polyglot.start()
        control = Controller(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
Esempio n. 15
0
    values and uoms(units of measure) from ISY. This is how ISY knows what kind
    of variable to display. Check the UOM's in the WSDK for a complete list.
    UOM 2 is boolean so the ISY will display 'True/False'
    """
    id = 'onkyozone'
    """
    id of the node from the nodedefs.xml that is in the profile.zip. This tells
    the ISY what fields and commands this node has.
    """
    commands = {
        'VOLUME': _Volume,
        'MUTE': _Mute,
        'UNMUTE': _UnMute,
        'POWERON': _PowerOn,
        'POWEROF': _PowerOff
    }
    """
    This is a dictionary of commands. If ISY sends a command to the NodeServer,
    this tells it which method to call. DON calls setOn, etc.
    """


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('Onkyo')
        polyglot.start()
        control = Controller(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
Esempio n. 16
0
        'value': 0,
        'uom': 2
    }, {
        'driver': 'GV3',
        'value': 0,
        'uom': 2
    }, {
        'driver': 'GV4',
        'value': 0,
        'uom': 25
    }]


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('RainMachine')
        """
        Instantiates the Interface to Polyglot.
        The name doesn't really matter unless you are starting it from the
        command line then you need a line Template=N
        where N is the slot number.
        """
        polyglot.start()
        """
        Starts MQTT and connects to Polyglot.
        """
        control = RMController(polyglot)
        """
        Creates the Controller Node and passes in the Interface
        """
        control.runForever()
Esempio n. 17
0
        self.send_response(200)
        self.send_header('Content-type', 'application/json')
        self.end_headers()

    def do_HEAD(self):
        self._set_response()

    def do_GET(self):
        self._set_response()

    def do_POST(self):
        self._set_response()
        content_length = int(self.headers['Content-Length'])
        raw_post_data = self.rfile.read(content_length)
        _event = json.loads(raw_post_data.decode('utf-8'))
        control.callback(_event)


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('Traccar')
        polyglot.start()
        control = Controller(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        LOGGER.warning("Received interrupt or exit...")
    except Exception as err:
        LOGGER.error('Excption: {0}'.format(err), exc_info=True)
        polyglot.stop()
        sys.exit(0)
Esempio n. 18
0
#!/usr/bin/env python3
"""
This is a NodeServer template for Polyglot v2 written in Python2/3
by Einstein.42 (James Milne) [email protected]
"""

import polyinterface
import sys
# Harmony Hub Main Controller
from camera_nodes import CameraController

if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('Camera')
        """
        Instantiates the Interface to Polyglot.
        """
        polyglot.start()
        """
        Starts MQTT and connects to Polyglot.
        """
        control = CameraController(polyglot)
        """
        Creates the Controller Node and passes in the Interface
        """
        control.runForever()
        """
        Sits around and does nothing forever, keeping your program running.
        """
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
        'value': 0,
        'uom': 100
    }, {
        'driver': 'GV3',
        'value': 0,
        'uom': 100
    }, {
        'driver': 'GV4',
        'value': 0,
        'uom': 100
    }]

    id = 'MQSENS'

    commands = {
        'QUERY': query,
        'DON': led_on,
        'DOF': led_off,
        'SETLED': led_set
    }


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('MQTT')
        polyglot.start()
        control = Controller(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
Esempio n. 20
0
    }, {
        'driver': 'GV1',
        'value': 0,
        'uom': 25
    }, {
        'driver': 'GV2',
        'value': 0,
        'uom': 30
    }, {
        'driver': 'GV3',
        'value': 0,
        'uom': 25
    }, {
        'driver': 'GV4',
        'value': 0,
        'uom': 30
    }]

    id = 'SENSEDEVICE'
    commands = {'QUERY': query}


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('SenseNodeServer')
        polyglot.start()
        control = Controller(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
Esempio n. 21
0
    def SetUnits(self, u):
        self.units = u

    def setDriver(self, driver, value):
        if (driver == 'GV0'):
            if (self.units != 'metric'):
                value = round(value / 1.609344, 1)
        super(LightningNode, self).setDriver(driver,
                                             value,
                                             report=True,
                                             force=True)


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('MeteoBridge')
        """
        Instantiates the Interface to Polyglot.
        """
        polyglot.start()
        """
        Starts MQTT and connects to Polyglot.
        """
        control = Controller(polyglot)
        """
        Creates the Controller Node and passes in the Interface
        """
        control.runForever()
        """
        Sits around and does nothing forever, keeping your program running.
        """
Esempio n. 22
0
        'value': 0,
        'uom': 9
    }, {
        'driver': 'GV8',
        'value': 0,
        'uom': 77
    }, {
        'driver': 'GV9',
        'value': 0,
        'uom': 20
    }, {
        'driver': 'GV10',
        'value': 0,
        'uom': 44
    }]
    id = 'TEMPSENSOR'

    commands = {'UPDATE': updateInfo}


if __name__ == "__main__":

    try:
        LOGGER.info('Starting Temperaure Server')
        polyglot = polyinterface.Interface('Temp_Sensors')
        polyglot.start()
        control = Controller(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
        },
        {
            'driver': 'GV2',
            'value': 0,
            'uom': 2
        },
    ]

    id = 'tuyaswitch2'

    commands = {
        'SWTON': setSwOn,
        'SWTOF': setSwOff,
        'QUERY': query,
    }


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('TuyaSwitch')
        polyglot.start()
        control = Controller(polyglot)
        control.runForever()
        ""
    except (KeyboardInterrupt, SystemExit):
        polyglot.stop()
        sys.exit(0)
        """
        Catch SIGTERM or Control-C and exit cleanly.
        """
Esempio n. 24
0
        """ ISY Requested that we query the remote device """
        LOGGER.debug('query of {} requested'.format(self.device.name))
        self.st = self._getstate()
        self.updateInfo()
        self.reportDrivers()
        return True

    drivers = [ {'driver': 'ST', 'value': 0, 'uom': 2} ]

    commands = {
                   'DON': don, 
                   'DOF': dof, 
                   'QUERY': query
               }

    id = 'WEMO_SWITCH'


if __name__ == "__main__":
    try:
        LOGGER.debug("Getting Poly")
        poly = polyinterface.Interface("Wemo")
        LOGGER.debug("Starting Poly")
        poly.start()
        LOGGER.debug("Getting Control")
        wemo = Control(poly)
        LOGGER.debug("Starting Control")
        wemo.runForever()
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
Esempio n. 25
0

# Removes invalid charaters and lowercase ISY Node address
def getValidNodeAddress(s):

    # remove <>`~!@#$%^&*(){}[]?/\;:"' characters
    addr = re.sub(r"[.<>`~!@#$%^&*(){}[\]?/\\;:\"']+", "", s)

    return addr[:14].lower()


# Removes invalid charaters for ISY Node description
def getValidNodeName(s):

    # remove <>`~!@#$%^&*(){}[]?/\;:"' characters from names
    return re.sub(r"[<>`~!@#$%^&*(){}[\]?/\\;:\"']+", "", s)


# Main function to establish Polyglot connection
if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface()
        polyglot.start()
        control = Controller(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        LOGGER.warning("Received interrupt or exit...")
        polyglot.stop()
    except Exception as err:
        LOGGER.error('Excption: {0}'.format(err), exc_info=True)
        sys.exit(0)
Esempio n. 26
0
        'uom': 78
    }, {
        'driver': 'GV3',
        'value': 0,
        'uom': 51
    }, {
        'driver': 'GV4',
        'value': 1,
        'uom': 25
    }]

    id = 'AURORA'
    commands = {
        'QUERY': query,
        'DON': setOn,
        'DOF': setOff,
        'SET_PROFILE': setProfile,
        'SET_BRI': setBrightness,
        'SET_EFFECT': setEffect
    }


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('NanoLeafNodeServer')
        polyglot.start()
        control = Controller(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
"""
Original NodeServer template for Polyglot v2 written in Python2/3
by Einstein.42 (James Milne) [email protected]
BasGarageDoors by Steve Bailey [email protected]
"""
try:
    import polyinterface
except ImportError:
    import pgc_interface as polyinterface
import sys
from nodes import GarageDoorsController
from nodes import GarageDoorsNodes

LOGGER = polyinterface.LOGGER

if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('Garage_Doors')
        polyglot.start()
        control = GarageDoorsController(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        LOGGER.warning("Received interrupt or exit...")
        """
                Catch SIGTERM or Control-C and exit cleanly.
        """
        polyglot.stop()
    except Exception as err:
        LOGGER.error('Excption: {0}'.format(err), exc_info=True)
    sys.exit(0)
Esempio n. 28
0
    id = 'magichomewwled'
    commands = {
        'DON': setOn,
        'DOF': setOff,
        'DFON': fastOn,
        'DFOF': fastOff,
        'QUERY': query,
        'BRT': setBrtDim,
        'DIM': setBrtDim,
        'SET_COLOR': setColor,
        'SETR': setManual,
        'SETG': setManual,
        'SETB': setManual,
        'SETW': setManual,
        'SET_RGB': setRGB,
        'SET_RGBW': setRGBW,
        'SETWW': setWW,
        'SETCW': setCW,
        'SET_TEMP': setTemperature
    }


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('MagicHome')
        polyglot.start()
        control = Controller(polyglot)
        control.runForever()
    except (KeyboardInterrupt, SystemExit):
        sys.exit(0)
Esempio n. 29
0
    """
    id = 'omniamotor'
    """
    id of the node from the nodedefs.xml that is in the profile.zip. This tells
    the ISY what fields and commands this node has.
    """
    commands = {'BUP': cmd_up, 'BDOWN': cmd_down, 'BSTOP': cmd_stop}
    """
    This is a dictionary of commands. If ISY sends a command to the NodeServer,
    this tells it which method to call. DON calls setOn, etc.
    """


if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('PythonTemplate')
        """
        Instantiates the Interface to Polyglot.
        The name doesn't really matter unless you are starting it from the
        command line then you need a line Template=N
        where N is the slot number.
        """
        polyglot.start()
        """
        Starts MQTT and connects to Polyglot.
        """
        control = Controller(polyglot)
        """
        Creates the Controller Node and passes in the Interface
        """
        control.runForever()
Esempio n. 30
0
This is a NodeServer template for Polyglot v2 written in Python2/3
by Einstein.42 (James Milne) [email protected]
"""
try:
    import polyinterface
except ImportError:
    import pgc_interface as polyinterface
import sys

LOGGER = polyinterface.LOGGER
""" Grab My Controller Node """
from nodes import Controller

if __name__ == "__main__":
    try:
        polyglot = polyinterface.Interface('FlumeWater')
        """
        Instantiates the Interface to Polyglot.
        The name doesn't really matter unless you are starting it from the
        command line then you need a line Template=N
        where N is the slot number.
        """
        polyglot.start()
        """
        Starts MQTT and connects to Polyglot.
        """
        control = Controller(polyglot)
        """
        Creates the Controller Node and passes in the Interface
        """
        control.runForever()