/** @{inheritDoc */ public State calculate(List<Item> items) { if (items.size() > 0) { State state = items.get(0).getState(); for (int i = 1; i < items.size(); i++) { if (!state.equals(items.get(i).getState())) { return UnDefType.UNDEF; } } return state; } else { return UnDefType.UNDEF; } }
/** * Update a channel if the mac matches our own * * @param mac * @param channelID * @param state */ private void updateChannel(String mac, String channelID, State state) { if (isMe(mac)) { State prevState = stateMap.put(channelID, state); if (prevState == null || !prevState.equals(state)) { logger.trace( "Updating channel {} for thing {} with mac {} to state {}", channelID, getThing().getUID(), mac, state); updateState(channelID, state); } } }