Example #1
0
  public void updatePowerStateProvider(final PowerState powerState)
      throws CouldNotPerformException {
    logger.debug("Apply powerState Update[" + powerState + "] for " + this + ".");

    try (ClosableDataBuilder<LightData.Builder> dataBuilder = getDataBuilder(this)) {
      dataBuilder.getInternalBuilder().setPowerState(powerState);
    } catch (Exception ex) {
      throw new CouldNotPerformException(
          "Could not apply powerState Update[" + powerState + "] for " + this + "!", ex);
    }
  }
  public void updateTargetTemperatureStateProvider(final TemperatureState temperatureState)
      throws CouldNotPerformException {
    logger.info("Apply targetTemperatureState Update[" + temperatureState + "] for " + this + ".");

    try (ClosableDataBuilder<TemperatureControllerData.Builder> dataBuilder =
        getDataBuilder(this)) {
      dataBuilder.getInternalBuilder().setTargetTemperatureState(temperatureState);
    } catch (Exception ex) {
      throw new CouldNotPerformException(
          "Could not apply target temperature Update[" + temperatureState + "] for " + this + "!",
          ex);
    }

    logger.info("Target temperature update applied");
  }