use of org.openhab.core.config.core.Configuration in project openhab-addons by openhab.
the class HueBridgeHandler method updateBridgeThingConfiguration.
private void updateBridgeThingConfiguration(String userName) {
Configuration config = editConfiguration();
config.put(USER_NAME, userName);
try {
updateConfiguration(config);
logger.debug("Updated configuration parameter '{}'", USER_NAME);
hueBridgeConfig = getConfigAs(HueBridgeConfig.class);
} catch (IllegalStateException e) {
logger.trace("Configuration update failed.", e);
logger.warn("Unable to update configuration of Hue bridge.");
logger.warn("Please configure the user name manually.");
}
}
use of org.openhab.core.config.core.Configuration in project openhab-addons by openhab.
the class InnogyBridgeHandlerTest method testOnEventDisconnect.
@Test
public void testOnEventDisconnect() throws Exception {
final String disconnectEventJSON = "{ type: \"Disconnect\" }";
Configuration bridgeConfig = new Configuration();
when(bridgeMock.getConfiguration()).thenReturn(bridgeConfig);
bridgeHandler.initialize();
verify(webSocketMock).start();
assertEquals(1, bridgeHandler.getDirectExecutionCount());
bridgeHandler.onEvent(disconnectEventJSON);
// automatically restarted (with a delay)
verify(webSocketMock, times(2)).start();
assertEquals(1, bridgeHandler.getDirectExecutionCount());
bridgeHandler.onEvent(disconnectEventJSON);
// automatically restarted (with a delay)
verify(webSocketMock, times(3)).start();
assertEquals(1, bridgeHandler.getDirectExecutionCount());
}
use of org.openhab.core.config.core.Configuration in project openhab-addons by openhab.
the class InnogyBridgeHandlerTest method testInitializeErrorOnStartingWebSocket.
@Test
public void testInitializeErrorOnStartingWebSocket() throws Exception {
Configuration bridgeConfig = new Configuration();
when(bridgeMock.getConfiguration()).thenReturn(bridgeConfig);
doThrow(new RuntimeException("Test-Exception")).when(webSocketMock).start();
bridgeHandler.initialize();
verify(webSocketMock, times(MAXIMUM_RETRY_EXECUTIONS)).start();
// only the first execution should be without a delay
assertEquals(1, bridgeHandler.getDirectExecutionCount());
}
use of org.openhab.core.config.core.Configuration in project openhab-addons by openhab.
the class AhaWasteCollectionHandlerTest method createConfig.
private static Configuration createConfig() {
final Configuration config = new Configuration();
config.put("commune", "Hannover");
config.put("collectionPlace", "02095-0010+");
config.put("houseNumber", "10");
config.put("houseNumberAddon", "");
config.put("street", "02095@Oesterleystr.+/+Südstadt@Südstadt");
return config;
}
use of org.openhab.core.config.core.Configuration in project openhab-addons by openhab.
the class AVMFritzBaseThingHandler method updateThingChannelConfiguration.
/**
* Updates thing channel configurations.
*
* @param channelId ID of the channel which configuration to be updated.
* @param configId ID of the configuration to be updated.
* @param value Value to be set.
*/
protected void updateThingChannelConfiguration(String channelId, String configId, Object value) {
Channel channel = thing.getChannel(channelId);
if (channel != null) {
Configuration editConfig = channel.getConfiguration();
editConfig.put(configId, value);
}
}
Aggregations