use of org.creek.mailcontrol.model.data.StateTransformable in project openhab1-addons by openhab.
the class ItemStateRequestProcessor method getState.
private StateTransformable getState(Item item) {
StateTransformable state = null;
if (item.getState() instanceof HSBType) {
HSBType hsb = (HSBType) item.getState();
state = new HSBData(hsb.getHue().longValue(), hsb.getHue().longValue(), hsb.getHue().longValue());
} else if (item.getState() instanceof DateTimeType) {
DateTimeType dt = (DateTimeType) item.getState();
DateTimeDataType data = new DateTimeDataType(dt.toString());
state = new DateTimeData(data);
} else if (item.getState() instanceof DecimalType) {
} else if (item.getState() instanceof OnOffType) {
} else if (item.getState() instanceof OpenClosedType) {
} else if (item.getState() instanceof PercentType) {
} else if (item.getState() instanceof UpDownType) {
}
return state;
}
use of org.creek.mailcontrol.model.data.StateTransformable in project openhab1-addons by openhab.
the class ItemStateRequestProcessor method getItemState.
public ItemStateData getItemState(String itemId) throws ServiceException {
ItemRegistry itemRegistry = getItemRegistry();
ItemStateData itemState = null;
try {
Item item = itemRegistry.getItem(itemId);
StateTransformable state = getState(item);
itemState = new ItemStateData(System.currentTimeMillis(), itemId, state);
} catch (ItemNotFoundException ex) {
logger.info(itemId + " not found", ex);
}
return itemState;
}
use of org.creek.mailcontrol.model.data.StateTransformable in project openhab1-addons by openhab.
the class ItemStateRequestProcessor method getItemStates.
public List<ItemStateData> getItemStates() throws ServiceException {
List<ItemStateData> itemStates = new ArrayList<ItemStateData>();
ItemRegistry itemRegistry = getItemRegistry();
for (Item item : itemRegistry.getItems()) {
logger.debug("Item: " + item.getName() + " " + item.getState());
StateTransformable state = getState(item);
ItemStateData itemState = new ItemStateData(System.currentTimeMillis(), item.getName(), state);
itemStates.add(itemState);
}
return itemStates;
}
Aggregations