Project

General

Profile

Feature #930

iMeter Power Usage

Added by Luke Murphey over 9 years ago. Updated about 7 years ago.

Status:
New
Priority:
Normal
Assignee:
Target version:
Start date:
12/17/2014
Due date:
% Done:

0%


eve-energy-device-app-icons.jpg View (44.3 KB) Luke Murphey, 06/04/2015 05:48 PM


Related issues

Related to Insteon Control - Feature #878: Allow controlling of Insteon in Splunk Closed 12/19/2015

History

#1 Updated by Luke Murphey over 9 years ago

  • Target version set to 0.6

#2 Updated by Luke Murphey about 9 years ago

  • Target version changed from 0.6 to 0.9

#4 Updated by Luke Murphey over 8 years ago

  • Related to Feature #878: Allow controlling of Insteon in Splunk added

#5 Updated by Luke Murphey over 8 years ago

See also:

Basically, it looks like the iMeter needs to get a 00 82 command in order to send power readings.

#6 Updated by Luke Murphey over 8 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 about 8 years ago

  • Target version changed from 0.9 to 0.10

#8 Updated by Luke Murphey about 7 years ago

See also: https://github.com/openhab/openhab1-addons/blob/0d13cc0761633efd7998f89bca31e6887403490a/bundles/binding/org.openhab.binding.insteonplm/src/main/java/org/openhab/binding/insteonplm/internal/device/MessageHandler.java

        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);
                }
            }
        }

Also available in: Atom PDF