Search in sources :

Example 6 with SappPnmas

use of org.openhab.binding.sapp.internal.model.SappPnmas in project openhab1-addons by openhab.

the class SappBinding method getOutputValue.

/**
     * load output value from pnmas, if not cached, and caches it
     */
private int getOutputValue(SappBindingProvider provider, String pnmasId, int address, String subAddress, boolean forceReload) throws SappException {
    Integer value = provider.getOutputCachedValue(address);
    if (forceReload || value == null) {
        logger.debug("cached value missing, reloading for [{} {} {}]", pnmasId, address, subAddress);
        SappPnmas pnmas = provider.getPnmasMap().get(pnmasId);
        SappCentralExecuter sappCentralExecuter = SappCentralExecuter.getInstance();
        value = sappCentralExecuter.executeSapp75Command(pnmas.getIp(), pnmas.getPort(), (byte) address);
        provider.setOutputCachedValue(address, value);
    }
    return value.intValue();
}
Also used : SappPnmas(org.openhab.binding.sapp.internal.model.SappPnmas) SappCentralExecuter(org.openhab.binding.sapp.internal.executer.SappCentralExecuter)

Aggregations

SappPnmas (org.openhab.binding.sapp.internal.model.SappPnmas)6 SappCentralExecuter (org.openhab.binding.sapp.internal.executer.SappCentralExecuter)5 SappBindingProvider (org.openhab.binding.sapp.SappBindingProvider)3 SappException (com.github.paolodenti.jsapp.core.command.base.SappException)2 SappBindingConfigContactItem (org.openhab.binding.sapp.internal.configs.SappBindingConfigContactItem)1 SappBindingConfigDimmerItem (org.openhab.binding.sapp.internal.configs.SappBindingConfigDimmerItem)1 SappBindingConfigNumberItem (org.openhab.binding.sapp.internal.configs.SappBindingConfigNumberItem)1 SappBindingConfigRollershutterItem (org.openhab.binding.sapp.internal.configs.SappBindingConfigRollershutterItem)1 SappBindingConfigSwitchItem (org.openhab.binding.sapp.internal.configs.SappBindingConfigSwitchItem)1 PollingResult (org.openhab.binding.sapp.internal.executer.SappCentralExecuter.PollingResult)1 SappAddressDecimal (org.openhab.binding.sapp.internal.model.SappAddressDecimal)1 SappAddressDimmer (org.openhab.binding.sapp.internal.model.SappAddressDimmer)1 SappAddressOnOffControl (org.openhab.binding.sapp.internal.model.SappAddressOnOffControl)1 SappAddressRollershutterControl (org.openhab.binding.sapp.internal.model.SappAddressRollershutterControl)1 Item (org.openhab.core.items.Item)1 ItemNotFoundException (org.openhab.core.items.ItemNotFoundException)1 ContactItem (org.openhab.core.library.items.ContactItem)1 DimmerItem (org.openhab.core.library.items.DimmerItem)1 NumberItem (org.openhab.core.library.items.NumberItem)1 RollershutterItem (org.openhab.core.library.items.RollershutterItem)1