コード例 #1
0
 def __init__(self, devices):
     super().__init__(devices)
     self.devices.append(
         VoltageSensor(devices, 'volt', 'voltage', ' (Voltage)'))
     self.devices.append(
         CurrentSensor(devices, 'ampere', 'current', ' (Current)'))
     self.devices.append(KwhSensor(devices, 'power', ['power'], ' (Power)'))
コード例 #2
0
    def _add_energy_device(self, features):
        power = self._get_feature(features, 'power')
        energy = self._get_feature(features, 'energy')
        device = None

        if power and energy:
            device = KwhSensor(domoticz.get_devices(), 'power',
                               [power['property'], energy['property']],
                               ' (Power)')
        elif power:
            device = KwhSensor(domoticz.get_devices(), 'power',
                               [power['property']], ' (Power)')

        if device:
            device.feature = power
            self.devices.append(device)
            return
コード例 #3
0
    def __init__(self, devices):
        super().__init__(devices)

        self.devices.append(OnOffSwitch(devices, 'l1', 'state_l1'))
        self.devices.append(OnOffSwitch(devices, 'l2', 'state_l2'))
        values = ['power', 'consumption']
        self.devices.append(KwhSensor(devices, 'kwh', values))
        self.devices.append(TemperatureSensor(devices, 'temp', 'temperature'))
コード例 #4
0
    def register(self, features):
        devices = []
        power = get_feature(features, 'power')
        energy = get_feature(features, 'energy')
        device = None

        if power and energy:
            device = KwhSensor('power',
                               [power['property'], energy['property']],
                               ' (Power)')
        elif power:
            device = KwhSensor('power', [power['property']], ' (Power)')

        if device:
            device.feature = power
            devices.append(device)

        return devices
コード例 #5
0
    def __init__(self, devices):
        super().__init__(devices)

        selector = SelectorSwitch(devices, 'click', 'click')
        selector.add_level('Off', None)
        selector.add_level('Left', 'left_single')
        selector.add_level('Right', 'right_single')
        selector.add_level('Both', 'both_single')
        selector.disable_value_check_on_update()

        self.devices.append(OnOffSwitch(devices, 'left', 'state_left'))
        self.devices.append(OnOffSwitch(devices, 'right', 'state_right'))
        self.devices.append(selector)
        self.devices.append(KwhSensor(devices, 'kwh', ['power']))
コード例 #6
0
    def __init__(self, devices):
        super().__init__(devices)

        kwh_consumed = KwhSensor(devices, 'cons', ['power', 'energyconsumed'], ' (Consumed)')
        kwh_consumed.energy_multiplier = 1

        kwh_produced = KwhSensor(devices, 'prod', ['power', 'energyproduced'], ' (Produced)')
        kwh_produced.energy_multiplier = 1

        self.devices.append(TemperatureSensor(devices, 'temp', 'temperature', ' (Temperature)'))
        self.devices.append(VoltageSensor(devices, 'volt', 'voltage', ' (Voltage)'))
        self.devices.append(CurrentSensor(devices, 'ampere', 'current', ' (Current)'))
        self.devices.append(kwh_consumed)
        self.devices.append(kwh_produced)
コード例 #7
0
    def __init__(self, devices):
        super().__init__(devices)

        self.devices.append(KwhSensor(devices, 'kwh', ['power']))
コード例 #8
0
 def __init__(self, devices):
     super().__init__(devices)
     self.devices.append(VoltageSensor(devices, 'volt', 'voltage'))
     self.devices.append(KwhSensor(devices, 'kwh', 'power'))
コード例 #9
0
    def __init__(self, devices):
        super().__init__(devices)

        self.devices.append(KwhSensor(devices, 'kwh', ['power']))
        self.devices.append(VoltageSensor(devices, 'volt', 'voltage', ' (Voltage)'))
        self.devices.append(TemperatureSensor(devices, 'temp', 'temperature', ' (Temperature)'))
コード例 #10
0
    def add_numeric_device(self, feature):
        state_access = self._has_access(feature['access'], ACCESS_STATE)
        write_access = self._has_access(feature['access'], ACCESS_WRITE)

        # TODO: Use energy value for `power` feature
        if feature['name'] == 'energy':
            return

        if (feature['name'] == 'linkquality' and state_access):
            if domoticz.get_plugin_config('trackLinkQuality'):
                self._add_device('signal', feature, CustomSensor,
                                 ' (Link Quality)')
            return

        if (feature['name'] == 'battery' and state_access):
            if domoticz.get_plugin_config('useBatteryDevices'):
                self._add_device('btperc', feature, PercentageSensor,
                                 ' (Battery)')
            return

        if (feature['name'] == 'brightness' and state_access):
            alias = feature['endpoint'] if 'endpoint' in feature else 'light'
            self._add_device(alias, feature, DimmerSwitch)
            return

        if (feature['name'] == 'humidity' and state_access):
            self._add_device('hum', feature, HumiditySensor, ' (Humidity)')
            return

        if (feature['name'] == 'temperature' and state_access):
            self._add_device('temp', feature, TemperatureSensor,
                             ' (Temperature)')
            return

        if (feature['name'] == 'local_temperature' and state_access):
            self._add_device('ltemp', feature, TemperatureSensor,
                             ' (Local Temperature)')
            return

        if (feature['name'] == 'pressure' and state_access):
            self._add_device('pres', feature, PressureSensor, ' (Pressure)')
            return

        if (feature['name'] == 'voltage' and state_access):
            self._add_device('volt', feature, VoltageSensor, ' (Voltage)')
            return

        if (feature['name'] == 'current' and state_access):
            self._add_device('ampere', feature, CurrentSensor, ' (Current)')
            return

        if (feature['name'] == 'power' and state_access
                and feature['unit'] == 'W'):
            device = KwhSensor(domoticz.get_devices(), 'power',
                               [feature['property']], ' (Power)')
            device.feature = feature
            self.devices.append(device)
            return

        if 'setpoint' in feature['name'] and feature[
                'unit'] == '°C' and write_access:
            alias = feature['endpoint'] if 'endpoint' in feature else 'spoint'
            self._add_device(alias, feature, SetPoint, ' (Setpoint)')
            return

        if (feature['name'] == 'position' and state_access):
            alias = feature['endpoint'] if 'endpoint' in feature else 'level'
            self._add_device(alias, feature, LevelSwitch)
            return

        domoticz.error(self.name + ': can not process numeric item "' +
                       feature['name'] + '"')
        domoticz.debug(json.dumps(feature))
コード例 #11
0
 def __init__(self, devices):
     super().__init__(devices)
     values = ['power', 'energy']
     self.devices.append(KwhSensor(devices, 'kwh', values))