Search in sources :

Example 1 with FritzahaOutletMeter

use of org.openhab.binding.fritzaha.internal.hardware.interfaces.FritzahaOutletMeter in project openhab1-addons by openhab.

the class FritzahaBinding method execute.

/**
     * @{inheritDoc
     */
@Override
protected void execute() {
    logger.debug("execute() method is called!");
    for (FritzahaBindingProvider currentProvider : providers) {
        for (String currentItem : currentProvider.getItemNames()) {
            FritzahaDevice currentDevice = currentProvider.getDeviceConfig(currentItem);
            String currentHostId = currentDevice.getHost();
            if (!hostCache.containsKey(currentHostId)) {
                continue;
            }
            FritzahaWebInterface currentHost = hostCache.get(currentHostId).getConnection();
            if (currentDevice instanceof FritzahaSwitchedOutlet) {
                FritzahaSwitchedOutlet currentSwitch = (FritzahaSwitchedOutlet) currentDevice;
                currentSwitch.updateSwitchState(currentItem, currentHost);
            } else if (currentDevice instanceof FritzahaOutletMeter) {
                FritzahaOutletMeter currentMeter = (FritzahaOutletMeter) currentDevice;
                currentMeter.updateMeterValue(currentItem, currentHost);
            }
        }
    }
}
Also used : FritzahaBindingProvider(org.openhab.binding.fritzaha.FritzahaBindingProvider) FritzahaOutletMeter(org.openhab.binding.fritzaha.internal.hardware.interfaces.FritzahaOutletMeter) FritzahaDevice(org.openhab.binding.fritzaha.internal.hardware.interfaces.FritzahaDevice) FritzahaSwitchedOutlet(org.openhab.binding.fritzaha.internal.hardware.interfaces.FritzahaSwitchedOutlet) FritzahaWebInterface(org.openhab.binding.fritzaha.internal.hardware.FritzahaWebInterface)

Aggregations

FritzahaBindingProvider (org.openhab.binding.fritzaha.FritzahaBindingProvider)1 FritzahaWebInterface (org.openhab.binding.fritzaha.internal.hardware.FritzahaWebInterface)1 FritzahaDevice (org.openhab.binding.fritzaha.internal.hardware.interfaces.FritzahaDevice)1 FritzahaOutletMeter (org.openhab.binding.fritzaha.internal.hardware.interfaces.FritzahaOutletMeter)1 FritzahaSwitchedOutlet (org.openhab.binding.fritzaha.internal.hardware.interfaces.FritzahaSwitchedOutlet)1