@Override public void event(List<HmEvent> events) { for (HmEvent e : events) { if (!address.equals(e.getAddress())) { continue; } SingleValueResource res = resources.get(e.getValueKey()); if (res == null) { continue; } try { PARAMS p = PARAMS.valueOf(e.getValueKey()); ((FloatResource) res).setValue(p.convertInput(e.getValueFloat())); logger.debug("resource updated: {} = {}", res.getPath(), e.getValue()); } catch (IllegalArgumentException ex) { //this block intentionally left blank } } }
@Override public void event(List<HmEvent> events) { for (HmEvent e: events) { if (!address.equals(e.getAddress())) { continue; } SingleValueResource res = resources.get(e.getValueKey()); if (res == null) { continue; } for (PARAMS p: PARAMS.values()) { if (p.name().equals(e.getValueKey())) { ((FloatResource) res).setValue(p.convertInput(e.getValueFloat())); logger.debug("resource updated: {} = {}", res.getPath(), e.getValue()); } } } }
@Override public void event(List<HmEvent> events) { for (HmEvent e : events) { if (!address.equals(e.getAddress())) { continue; } SingleValueResource res = resources.get(e.getValueKey()); if (res == null) { continue; } try { PARAMS p = PARAMS.valueOf(e.getValueKey()); ((FloatResource) res).setValue(p.convertInput(e.getValueFloat())); logger.debug("resource updated: {} = {}", res.getPath(), e.getValue()); } catch (IllegalArgumentException ex) { //this block intentionally left blank } } }
public void storeEvent(HmEvent e, SingleValueResource res) { logger.debug("storing event data for {}@{} to {}", e.getValueKey(), e.getAddress(), res.getPath()); if (res instanceof FloatResource) { ((FloatResource) res).setValue(e.getValueFloat()); } else if (res instanceof IntegerResource) { ((IntegerResource) res).setValue(e.getValueInt()); } else if (res instanceof StringResource) { ((StringResource) res).setValue(e.getValueString()); } else if (res instanceof BooleanResource) { ((BooleanResource) res).setValue(e.getValueBoolean()); } else { logger.warn("HomeMatic parameter resource is of unsupported type: {}", res.getResourceType()); } }