• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ThingStatusDetail类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.smarthome.core.thing.ThingStatusDetail的典型用法代码示例。如果您正苦于以下问题:Java ThingStatusDetail类的具体用法?Java ThingStatusDetail怎么用?Java ThingStatusDetail使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ThingStatusDetail类属于org.eclipse.smarthome.core.thing包,在下文中一共展示了ThingStatusDetail类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startAutomaticRefresh

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
public void startAutomaticRefresh() {
    // refreshJob.cancel(true);
    refreshJob = scheduler.scheduleWithFixedDelay(() -> {
        try {
            boolean success = updateDraytonWiserData();
            if (success) {
                String thingUID = getThing().getUID().getId();
                updateState(new ChannelUID(getThing().getUID(), CHANNEL_TEMPERATURE), getTemperature(thingUID));
                updateState(new ChannelUID(getThing().getUID(), CHANNEL_HUMIDITY), getHumidity(thingUID));
                updateState(new ChannelUID(getThing().getUID(), CHANNEL_SETPOINT), getSetPoint(thingUID));
            }
        } catch (Exception e) {
            logger.debug("Exception occurred during execution: {}", e.getMessage(), e);
            updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, e.getMessage());
        }
    }, 0, 60, TimeUnit.SECONDS);
}
 
开发者ID:RobPope,项目名称:DraytonWiser,代码行数:18,代码来源:DraytonWiserHandler.java


示例2: getMobileDevice

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
private MobileDevice getMobileDevice() throws IOException, TadoClientException {
    try {
        MobileDevice device = getApi().getMobileDeviceDetails(getHomeId(), configuration.id);
        if (device == null) {
            String message = "Mobile device with id " + configuration.id + " unknown or does not belong to home "
                    + getHomeId();
            updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, message);
            throw new IOException(message);
        }

        return device;
    } catch (IOException | TadoClientException e) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
                "Could not connect to server due to " + e.getMessage());
        throw e;
    }
}
 
开发者ID:dfrommi,项目名称:openhab-tado,代码行数:18,代码来源:TadoMobileDeviceHandler.java


示例3: startAutomaticRefresh

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
private void startAutomaticRefresh() {
    Runnable runnable = new Runnable() {
        @Override
        public void run() {
            logger.debug("Refreshing {}", thing.getUID().getAsString());
            try {
                boolean success = updateData();
                if (success) {
                    updateState(new ChannelUID(getThing().getUID(), CHANNEL_SWITCH), getState());
                    updateState(new ChannelUID(getThing().getUID(), CHANNEL_WATTAGE), getWattage());
                    updateState(new ChannelUID(getThing().getUID(), CHANNEL_TOTAL), getTotal());
                    updateState(new ChannelUID(getThing().getUID(), CHANNEL_SYSINFO), getSysinfo());
                }
            } catch (Exception e) {
                updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, e.getMessage());
                logger.debug("Exception occurred during execution", e);
            }
        }
    };

    refreshJob = scheduler.scheduleWithFixedDelay(runnable, 0, refresh, TimeUnit.SECONDS);
}
 
开发者ID:computerlyrik,项目名称:openhab2-addon-hs110,代码行数:23,代码来源:HS110Handler.java


示例4: updateData

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
private synchronized boolean updateData() {
    logger.trace("Updating data for Plug type {}", thing.getThingTypeUID().getAsString());
    try {
        sysinfoData = plug.sendCommand(HS110.Command.SYSINFO);
        if (thing.getThingTypeUID().equals(THING_TYPE_HS110)) {
            energyData = plug.sendCommand(HS110.Command.ENERGY);
            logger.debug("Updated energy Data for {}: {}", thing.getUID(), energyData);
        }
        logger.debug("Updated sysinfo Data for {}: {}", thing.getUID(), sysinfoData);
        return true;

    } catch (IOException e) {
        logger.warn("Error accessing plug ", e);
        energyData = null;
        sysinfoData = null;
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, e.getMessage());
        return false;
    }
}
 
开发者ID:computerlyrik,项目名称:openhab2-addon-hs110,代码行数:20,代码来源:HS110Handler.java


示例5: getConfigStatus

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
@Override
public Collection<ConfigStatusMessage> getConfigStatus() {

    Collection<ConfigStatusMessage> configStatus = new ArrayList<>();

    try {
        InetAddress ip = InetAddress.getByName(plug.ip);
        if (!ip.isReachable(500)) {
            configStatus.add(
                    ConfigStatusMessage.Builder.error("offline").withMessageKeySuffix("ip unreachable").build());
            updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR);
        }
    } catch (IOException e) {
        logger.debug("Communication error ocurred reaching the device ", e);
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, e.getMessage());
    }

    return configStatus;
}
 
开发者ID:computerlyrik,项目名称:openhab2-addon-hs110,代码行数:20,代码来源:HS110Handler.java


示例6: networkStateUpdated

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
@Override
public void networkStateUpdated(final ZigBeeTransportState state) {
    switch (state) {
        case UNINITIALISED:
            break;
        case INITIALISING:
            break;
        case ONLINE:
            updateStatus(ThingStatus.ONLINE);
            break;
        case OFFLINE:
            updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE,
                    getI18nConstant(ZigBeeBindingConstants.OFFLINE_STARTUP_FAIL));
            break;
        default:
            break;
    }
}
 
开发者ID:openhab,项目名称:org.openhab.binding.zigbee,代码行数:19,代码来源:ZigBeeCoordinatorHandler.java


示例7: initialize

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
@Override
public void initialize() {
    final String configAddress = (String) getConfig().get(ZigBeeBindingConstants.CONFIGURATION_MACADDRESS);
    logger.debug("{}: Initializing ZigBee thing handler {}", configAddress, getThing().getUID());

    if (configAddress == null || configAddress.length() == 0) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
                getI18nConstant(ZigBeeBindingConstants.OFFLINE_NO_ADDRESS));
        return;
    }
    nodeIeeeAddress = new IeeeAddress(configAddress);

    updateStatus(ThingStatus.UNKNOWN);

    if (getBridge() != null) {
        bridgeStatusChanged(getBridge().getStatusInfo());
    }
}
 
开发者ID:openhab,项目名称:org.openhab.binding.zigbee,代码行数:19,代码来源:ZigBeeThingHandler.java


示例8: initialize

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
/**
 * Initialize the connection to Nest.
 */
@Override
public void initialize() {
    logger.debug("Initializing Nest bridge handler");

    config = getConfigAs(NestBridgeConfiguration.class);
    authorizer = new NestAuthorizer(config);
    updateStatus(ThingStatus.UNKNOWN, ThingStatusDetail.NONE, "Starting poll query");

    initializeJob = scheduler.schedule(() -> {
        try {
            logger.debug("Product ID      {}", config.productId);
            logger.debug("Product Secret  {}", config.productSecret);
            logger.debug("Pincode         {}", config.pincode);
            logger.debug("Access Token    {}", getExistingOrNewAccessToken());
            redirectUrlSupplier = new NestRedirectUrlSupplier(getHttpHeaders());
            restartStreamingUpdates();
        } catch (InvalidAccessTokenException e) {
            logger.debug("Invalid access token", e);
            updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
                    "Token is invalid and could not be refreshed: " + e.getMessage());
        }
    }, 0, TimeUnit.SECONDS);

    logger.debug("Finished initializing Nest bridge handler");
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:29,代码来源:NestBridgeHandler.java


示例9: startConnectAndKeepAlive

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
/**
 * Creates a session manager object and the send queue. The initial IP address may be null
 * or is not matching with the real IP address of the bridge. The session manager will send
 * a broadcast packet to find the bridge with the respective bridge ID and will change the
 * IP address of the send queue object accordingly.
 *
 * The keep alive timer that is also setup here, will send keep alive packets periodically.
 * If the bridge doesn't respond anymore (e.g. DHCP IP change), the initial session handshake
 * starts all over again.
 */
@Override
protected void startConnectAndKeepAlive(InetAddress addr) {
    dispose();

    int port = getPort(MilightBindingConstants.PORT_VER6);
    if (port == 0) {
        return;
    }

    com.setAddress(addr);
    com.setPort(port);
    com.start();

    updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_PENDING, "Waiting for session");
    session = new MilightV6SessionManager(com, bridgeid, scheduler, this, addr);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:27,代码来源:MilightBridgeV6Handler.java


示例10: initialize

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
@Override
public void initialize() {
    if (getConfig().get(IP_ADDRESS) != null && !getConfig().get(IP_ADDRESS).equals("")) {
        transceiver.registerHandler(this);

        if (pollingJob == null || pollingJob.isCancelled()) {
            try {
                pollingJob = scheduler.scheduleWithFixedDelay(pollingRunnable, 0,
                        ((BigDecimal) getConfig().get(POLLING_REFRESH_INTERVAL)).intValue(), TimeUnit.SECONDS);
            } catch (Exception e) {
                updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE,
                        "An exception occurred while scheduling the polling job");
            }
        }

        cache = new ExpiringCacheMap<>(
                Math.max((((BigDecimal) getConfig().get(POLLING_REFRESH_INTERVAL)).intValue()) - 5, 0) * 1000);

        cache.put(CACHE_REPORT_1, () -> transceiver.send("report 1", getHandler()));
        cache.put(CACHE_REPORT_2, () -> transceiver.send("report 2", getHandler()));
        cache.put(CACHE_REPORT_3, () -> transceiver.send("report 3", getHandler()));
    } else {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
                "IP address or port number not set");
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:27,代码来源:KeContactHandler.java


示例11: initialize

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
@Override
public void initialize() {
    logger.debug("Niko Home Control: initializing bridge handler");

    Configuration config = this.getConfig();
    InetAddress addr = getAddr();
    int port = getPort();

    logger.debug("Niko Home Control: bridge handler host {}, port {}", addr, port);

    if (addr != null) {
        createCommunicationObject(addr, port);
    } else {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
                "Niko Home Control: cannot resolve bridge IP with hostname " + config.get(CONFIG_HOST_NAME));
    }

}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:19,代码来源:NikoHomeControlBridgeHandler.java


示例12: updateStatus

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
/**
 * Updates the thing status based on device status.
 */
private void updateStatus(HmDevice device) throws BridgeHandlerNotAvailableException, IOException {
    loadHomematicChannelValues(device.getChannel(0));

    ThingStatus oldStatus = thing.getStatus();
    ThingStatus newStatus = ThingStatus.ONLINE;
    ThingStatusDetail newDetail = ThingStatusDetail.NONE;

    if (device.isFirmwareUpdating()) {
        newStatus = ThingStatus.OFFLINE;
        newDetail = ThingStatusDetail.FIRMWARE_UPDATING;
    } else if (device.isUnreach()) {
        newStatus = ThingStatus.OFFLINE;
        newDetail = ThingStatusDetail.COMMUNICATION_ERROR;
    } else if (device.isConfigPending() || device.isUpdatePending()) {
        newDetail = ThingStatusDetail.CONFIGURATION_PENDING;
    }

    if (thing.getStatus() != newStatus || thing.getStatusInfo().getStatusDetail() != newDetail) {
        updateStatus(newStatus, newDetail);
    }
    if (oldStatus == ThingStatus.OFFLINE && newStatus == ThingStatus.ONLINE) {
        initialize();
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:28,代码来源:HomematicThingHandler.java


示例13: initialize

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
@Override
public void initialize() {
    try {
        config = getThing().getConfiguration();
        host = InetAddress.getByName(config.get(HOST).toString());
        port = getConfigInteger(config, PORT);
    } catch (UnknownHostException e) {
        logger.warn("Bridge IP/PORT config is not set or not valid");
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR);
        return;
    }
    logger.debug("Init socket on Port: {}", port);
    socket = new XiaomiBridgeSocket(port);
    socket.intialize();
    socket.registerListener(this);

    scheduler.schedule(() -> {
        discoverItems();
    }, 1, TimeUnit.SECONDS);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:21,代码来源:XiaomiBridgeHandler.java


示例14: updateThingStatus

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
private void updateThingStatus() {
    if (getItemId() != null) {
        // note: this call implicitly registers our handler as a listener on the bridge, if it's not already
        if (getXiaomiBridgeHandler() != null) {
            Bridge bridge = getBridge();
            ThingStatus bridgeStatus = (bridge == null) ? null : bridge.getStatus();
            if (bridgeStatus == ThingStatus.ONLINE) {
                ThingStatus itemStatus = getThing().getStatus();
                boolean hasItemActivity = getXiaomiBridgeHandler().hasItemActivity(getItemId(),
                        ONLINE_TIMEOUT_MILLIS);
                ThingStatus newStatus = hasItemActivity ? ThingStatus.ONLINE : ThingStatus.OFFLINE;

                if (!newStatus.equals(itemStatus)) {
                    updateStatus(newStatus);
                }
            } else {
                updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
            }
        } else {
            updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
        }
    } else {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:26,代码来源:XiaomiDeviceBaseHandler.java


示例15: update

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
private synchronized void update() {
    logger.debug("Updating WiFiLED data '{}'", getThing().getUID());

    try {
        LEDStateDTO ledState = driver.getLEDStateDTO();
        HSBType color = new HSBType(ledState.getHue(), ledState.getSaturation(), ledState.getBrightness());
        updateState(WiFiLEDBindingConstants.CHANNEL_POWER, ledState.power);
        updateState(WiFiLEDBindingConstants.CHANNEL_COLOR, color);
        updateState(WiFiLEDBindingConstants.CHANNEL_WHITE, ledState.getWhite());
        updateState(WiFiLEDBindingConstants.CHANNEL_PROGRAM, ledState.getProgram());
        updateState(WiFiLEDBindingConstants.CHANNEL_PROGRAM_SPEED, ledState.getProgramSpeed());

        if (getThing().getStatus().equals(ThingStatus.OFFLINE)) {
            updateStatus(ThingStatus.ONLINE);
        }
    } catch (IOException e) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, e.getMessage());
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:20,代码来源:WiFiLEDHandler.java


示例16: initialize

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
@Override
public void initialize() {
    config = getConfigAs(SourceConfig.class);
    scheduler.scheduleWithFixedDelay(new Runnable() {
        @Override
        public void run() {
            try {
                refresh();
                updateStatus(ThingStatus.ONLINE);
            } catch (Exception e) {
                updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
                        e.getClass().getName() + ":" + e.getMessage());
                logger.debug("Error refreshing source {} ", getThing().getUID(), e);
            }
        }

    }, 0, config.refreshInterval, TimeUnit.SECONDS);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:19,代码来源:WebscrapeHandler.java


示例17: statusChanged

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
/**
 * Overrides the status changed to simply call the {@link #_wrappedCallback}
 *
 * @param status the new status
 * @param detail the new detail
 * @param msg the new message
 */
@Override
public void statusChanged(ThingStatus status, ThingStatusDetail detail, String msg) {
    _statusLock.lock();
    try {
        // Simply return we match the last status change (prevents loops if changing to the same status)
        if (status == _lastThingStatus && detail == _lastThingStatusDetail) {
            return;
        }

        _lastThingStatus = status;
        _lastThingStatusDetail = detail;
    } finally {
        _statusLock.unlock();
    }
    // If we got this far - call the underlying one
    _wrappedCallback.statusChanged(status, detail, msg);

}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:26,代码来源:StatefulHandlerCallback.java


示例18: initialize

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
@Override
public void initialize() {
    logger.debug("Initializing Z-Way device handler ...");

    // Set thing status to a valid status
    updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_PENDING,
            "Checking configuration and bridge...");

    // Configuration - thing status update with a error message
    mConfig = loadAndCheckConfiguration();

    if (mConfig != null) {
        logger.debug("Configuration complete: {}", mConfig);

        // Start an extra thread to check the connection, because it takes sometimes more
        // than 5000 milliseconds and the handler will suspend (ThingStatus.UNINITIALIZED).
        scheduler.schedule(new Initializer(), 2, TimeUnit.SECONDS);
    } else {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Z-Way node id required!");
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:22,代码来源:ZWayZWaveDeviceHandler.java


示例19: initialize

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
/**
 * Calls createCommunicationObject if the host name is configured correctly.
 */
@Override
public void initialize() {
    // Determine the zone of this thing
    String zoneName = (String) thing.getConfiguration().get(YamahaReceiverBindingConstants.CONFIG_ZONE);
    zone = zoneName != null ? YamahaReceiverBindingConstants.Zone.valueOf(zoneName) : null;
    if (zoneName == null || zone == null) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Zone not set!");
        return;
    }

    channelsTypeProviderPreset = new ChannelsTypeProviderPreset(thing.getUID());
    channelsTypeProviderAvailableInputs = new ChannelsTypeProviderAvailableInputs(thing.getUID());
    // Allow bundleContext to be null for tests
    if (bundleContext != null) {
        servicePreset = bundleContext.registerService(ChannelTypeProvider.class.getName(),
                channelsTypeProviderPreset, new Hashtable<>());
        serviceAvailableInputs = bundleContext.registerService(ChannelTypeProvider.class.getName(),
                channelsTypeProviderAvailableInputs, new Hashtable<>());
    }

    YamahaBridgeHandler bridgeHandler = getBridgeHandler();
    if (bridgeHandler != null) {
        bridgeStatusChanged(bridgeHandler.getThing().getStatusInfo());
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:29,代码来源:YamahaZoneThingHandler.java


示例20: updateData

import org.eclipse.smarthome.core.thing.ThingStatusDetail; //导入依赖的package包/类
private synchronized void updateData() {
    logger.debug("Update SMAEnergyMeter data '{}'", getThing().getUID());

    try {
        energyMeter.update();

        updateState(CHANNEL_POWER_IN, energyMeter.getPowerIn());
        updateState(CHANNEL_POWER_OUT, energyMeter.getPowerOut());
        updateState(CHANNEL_ENERGY_IN, energyMeter.getEnergyIn());
        updateState(CHANNEL_ENERGY_OUT, energyMeter.getEnergyOut());

        if (getThing().getStatus().equals(ThingStatus.OFFLINE)) {
            updateStatus(ThingStatus.ONLINE);
        }
    } catch (IOException e) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR, e.getMessage());
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:19,代码来源:SMAEnergyMeterHandler.java



注:本文中的org.eclipse.smarthome.core.thing.ThingStatusDetail类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IColumnIteratorFactory类代码示例发布时间:2022-05-22
下一篇:
Java FigletFont类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap