Feature #930
iMeter Power Usage
Start date:
12/17/2014
Due date:
% Done:
0%
Related issues
History
#1 Updated by Luke Murphey about 10 years ago
- Target version set to 0.6
#2 Updated by Luke Murphey over 9 years ago
- Target version changed from 0.6 to 0.9
#4 Updated by Luke Murphey about 9 years ago
- Related to Feature #878: Allow controlling of Insteon in Splunk added
#5 Updated by Luke Murphey about 9 years ago
See also:
- http://cache.insteon.com/developer/2448A2dev-042011-en.pdf
- http://cache.insteon.com/developer/2423A1dev-072013-en.pdf
Basically, it looks like the iMeter needs to get a 00 82 command in order to send power readings.
#6 Updated by Luke Murphey about 9 years ago
http://cache.insteon.com/developer/2423A1dev-072013-en.pdf
bytes 7 & 8 are power
bytes 9-12 are accumulated energy
IntEnergy = 256*256*256*Data9 + 256*256*Data10 + 256*Data11 + Data12; if(Data9 < 254) AccumEnergy = IntEnergy * 65535.0 / (1000 * 60.0 * 60.0 * 60.0); else AccumEnergy = 0.0; IntPwr = (Data7 << 8) | Data8; *pwr = (double)IntPwr; if(*pwr > 32767.0) *pwr = *pwr - 65535.0;
#7 Updated by Luke Murphey almost 9 years ago
- Target version changed from 0.9 to 0.10
#8 Updated by Luke Murphey over 7 years ago
public void handleMessage(int group, byte cmd1, Msg msg, DeviceFeature f, String fromPort) { if (msg.isExtended()) { try { // see iMeter developer notes 2423A1dev-072013-en.pdf int b7 = msg.getByte("userData7") & 0xff; int b8 = msg.getByte("userData8") & 0xff; int watts = (b7 << 8) | b8; if (watts > 32767) { watts -= 65535; } int b9 = msg.getByte("userData9") & 0xff; int b10 = msg.getByte("userData10") & 0xff; int b11 = msg.getByte("userData11") & 0xff; int b12 = msg.getByte("userData12") & 0xff; BigDecimal kwh = BigDecimal.ZERO; if (b9 < 254) { int e = (b9 << 24) | (b10 << 16) | (b11 << 8) | b12; kwh = new BigDecimal(e * 65535.0 / (1000 * 60 * 60 * 60)).setScale(4, RoundingMode.HALF_UP); } logger.debug("{}:{} watts: {} kwh: {} ", nm(), f.getDevice().getAddress(), watts, kwh); m_feature.publish(new DecimalType(kwh), StateChangeType.CHANGED, "field", "kwh"); m_feature.publish(new DecimalType(watts), StateChangeType.CHANGED, "field", "watts"); } catch (FieldException e) { logger.error("error parsing {}: ", msg, e); } } }