Exemple #1
0
    def __init__(self, device, name, description, value=None, func_is=None, func_set=None):
        """
        Initialize the object.

        device -- the Device this property belongs to
        name -- name of the property
        description -- description of the property, as a dictionary
        value -- current value of this property

        description e.g. {'type': 'boolean'} or more
        'visible'
        'min'
        'max'
        'type'
        'unit'
        'description'
        'minimum'
        'maximum'
        """
        Property.__init__(self, device, name, description)
        # value to and from device
        self.dev_value = 0
        self.func_is = func_is
        self.func_set = func_set
        if value is not None:
            self.set_value(value)
        logging.info("ConbeeProperty__init__ device.id: %s %s %s %s", device.id, name, description, value)
    def __init__(self, device, name, description, value):
        """
        Initialize the object.

        device -- the Device this property belongs to
        name -- name of the property
        description -- description of the property, as a dictionary
        value -- current value of this property
        """
        try:
            Property.__init__(self, device, name, description)

            self.device = device
            self.name = name
            self.description = description
            self.value = value

            self.set_cached_value(value)
            self.device.notify_property_changed(self)
            
            if self.device.adapter.DEBUG:
                print("+ PROPERTY init: " + str(name))
                #print("-device: " + str(device))
                #print("-name: " + str(name))
                #print("-description: " + str(description))
                print("  -value: " + str(value))
        except Exception as ex:
            print("property: could not init. Error: " + str(ex))
Exemple #3
0
 def __init__(self, device, name, description, value):
     Property.__init__(self, device, name, description)
     self.device = device
     self.name = name
     self.title = name
     self.description = description # dictionary
     self.value = value
     self.set_cached_value(value)
 def __init__(self, device, name, description, value):
     """ Initialize the object """
     Property.__init__(self, device, name, description)
     self.device = device
     self.title = name
     self.name = name
     self.description = description
     self.value = value
     self.set_cached_value(value)
Exemple #5
0
 def __init__(self, device, name, description, value):
     """
     Initialize the object.
     device -- the Device this property belongs to
     name -- name of the property
     description -- description of the property, as a dictionary
     value -- current value of this property
     """
     Property.__init__(self, device, name, description)
     self.set_cached_value(value)
    def __init__(self, device, value):
        """
        Initialize the object.

        device -- the Device this property belongs to
        value -- current value of this property
        """
        name = 'on'
        description = {'type': 'boolean'}
        Property.__init__(self, device, name, description)
        self.set_cached_value(value)
Exemple #7
0
    def __init__(self, device, name, description, value):

        #print("incoming thing device at property init is: " + str(device))
        Property.__init__(self, device, name, description)

        self.device = device
        self.name = name
        self.title = name
        self.description = description  # dictionary
        self.value = value
        self.set_cached_value(value)
Exemple #8
0
 def __init__(self, device, name, description, value, original_thing_id, original_property_id):
     Property.__init__(self, device, name, description)
     
     self.original_thing_id = original_thing_id
     self.original_property_id = original_property_id
     self.device = device
     self.name = name
     self.title = name
     self.description = description # dictionary
     self.value = value
     self.set_cached_value(value)
     self.device.notify_property_changed(self)
    def __init__(self, device, name, description, value):
        Property.__init__(self, device, name, description)

        #print("new property with value: " + str(value))
        self.device = device
        self.name = name
        self.title = name
        self.description = description  # dictionary
        self.value = False
        self.set_cached_value(False)
        self.device.notify_property_changed(self)
        print("privacy manager property initiated")
Exemple #10
0
    def __init__(self, device, name, description, values, value, node_id,
                 child_id, main_type, subchild_id):  # subchild_id is V_TYPE
        """
        Initialize the object.

        device -- the Device this property belongs to
        name -- name of the property
        description -- description of the property, as a dictionary
        value -- current value of this property
        """
        #print()

        #print("-device " + str(device))
        #print("-name: " + str(name))
        #print("-description: " + str(description))
        #print("-value: " + str(value))
        try:
            if device.adapter.DEBUG:
                print("Property: initialising")
            Property.__init__(self, device, name, description)

            #self.device = device
            self.node_id = node_id  # These three are used in the set_value function to send a message back to the proper node in the MySensors network.
            self.child_id = child_id
            self.main_type = main_type
            self.subchild_id = subchild_id

            self.device = device
            self.name = name
            self.title = name
            self.description = description
            self.values = values
            self.value = value
            self.set_cached_value(value)
            #self.device.notify_property_changed(self)
            #self.set_cached_value(value)
            #self.value = value #hmm, test
            #self.device = device
            if device.adapter.DEBUG:
                print("property value = " + str(self.value))
            #print("self.device inside property = " + str(self.device))
            #self.device.notify_property_changed(self)
            #print("property init done")

        except Exception as ex:
            print("inside adding property error: " + str(ex))
    def __init__(self, device, name, description):
        """
        Initialize the object.

        device -- the Device this property belongs to
        name -- name of the property
        description -- description of the property, as a dictionary

        description e.g. {'type': 'boolean'} or more
        'visible'
        'title', before 'label'
        'type'
        '@type'
        'unit'
        'description'
        'minimum'
        'maximum'
        'enum'
        'readOnly'
        """
        Property.__init__(self, device, name, description)
    def __init__(self, device, name, description):
        """
        Initialize the object.

        device -- the Device this property belongs to
        name -- name of the property
        description -- description of the property, as a dictionary
        value -- current value of this property
        """
        try:
            if device.adapter.DEBUG:
                print("Property: initialising")
            Property.__init__(self, device, name, description)

            self.device = device
            self.name = name
            self.title = name
            self.description = description
            self.value = None

        except Exception as ex:
            print("inside adding property error: " + str(ex))
Exemple #13
0
    def __init__(self, adapter, _id, provider, poll_interval, server_id):
        """
        Initialize the object.

        adapter -- the Adapter managing this device
        _id -- ID of this device
        provider -- the data provider
        poll_interval -- interval at which to poll the provider, in minutes
        server_id -- ID of server to use (for speedtest.net)
        """
        Device.__init__(self, adapter, _id)
        self._type = ['MultiLevelSensor']
        self.type = 'multiLevelSensor'

        self.provider = provider
        self.poll_interval = poll_interval
        self.server_id = server_id

        self.name = 'Internet speed test'
        self.description = 'Internet speed test'

        self.properties['download'] = Property(
            self,
            'download',
            {
                '@type': 'LevelProperty',
                'title': 'Download Speed',
                'type': 'integer',
                'unit': 'Mbps',
                'minimum': 0,
                'maximum': 10000,  # 10 Tbps... had to have something here
                'readOnly': True,
            })
        self.properties['download'].set_cached_value(0)

        self.links = [
            {
                'rel': 'alternate',
                'mediaType': 'text/html',
                'href': 'https://{}'.format(self.provider),
            },
        ]

        t = threading.Thread(target=self.poll)
        t.daemon = True
        t.start()
Exemple #14
0
 def __init__(self, device, name, description, value):
     Property.__init__(self, device, name, description)
     self.value = value
Exemple #15
0
 def __init__(self, device, name, description):
     Property.__init__(self, device, name, description)
     self.pin = device.pin
     self.ip = device.ip
     self.set_cached_value(True)
 def __init__(self, device, name, description, value):
     Property.__init__(self, device, name, description)
     self.set_cached_value(value)