severnt / efergy-elite-ir-decode

Decodes frames from the Efergy Elite IR (CA)
MIT License
0 stars 1 forks source link

Calculate kWh #1

Open ukshady opened 9 years ago

ukshady commented 9 years ago

Sample is 30 secs so for an hour multiply by 120 For a meter with 1000 pulses per kWh Take byte 8 divide by 1000 and multiply by 120 to get k Watts per hour

Energy Now Reading 0.239 KW

00001010 [ 0] = 10(0x0a) 10100010 [ 1] = 162(0xa2) 10111010 [ 2] = 186(0xba) 01000000 [ 3] = 64(0x40) 00000000 [ 4] = 0(0x00) 00000000 [ 5] = 0(0x00) 00000000 [ 6] = 0(0x00) 00000000 [ 7] = 0(0x00) 00000010 [ 8] = 2(0x02) 00001111 [ 9] = 15(0x0f) 00101010 [10] = 42(0x2a) 10101000 [11] = 168(0xa8) 10(0x0a) 162(0xa2) 186(0xba) 64(0x40) 0(0x00) 0(0x00) 0(0x00) 0(0x00) 2(0x02) 15(0x0f) 42(0x2a) 168(0xa8) CRC OK

2 * 120 =0.240 kWh

Energy Now Reading 3.239 KW

00001010 [ 0] = 10(0x0a) 10100010 [ 1] = 162(0xa2) 10111010 [ 2] = 186(0xba) 01000000 [ 3] = 64(0x40) 00000000 [ 4] = 0(0x00) 00000000 [ 5] = 0(0x00) 00000000 [ 6] = 0(0x00) 00000000 [ 7] = 0(0x00) 00011011 [ 8] = 27(0x1b) 00001111 [ 9] = 15(0x0f) 10010011 [10] = 147(0x93) 01000011 [11] = 67(0x43) 10(0x0a) 162(0xa2) 186(0xba) 64(0x40) 0(0x00) 0(0x00) 0(0x00) 0(0x00) 27(0x1b) 15(0x0f) 147(0x93) 67(0x43) CRC OK

27 /1000 * 120 = 3.24 kWh

severnt commented 9 years ago

Thanks! That matches all the samples I have perfectly whenever byte 9 is 15. This works until it gets to very low values when byte 9 is a larger number.

Bytes 8, 9 2, 21 = 0.199 kWh 1, 17 = 0.211 kWh 1, 16 = 0.224 kWh 2, 16 = 0.239 kWh

Any ideas?

ukshady commented 9 years ago

Hi there, for low pulse counts I believe byte 9 is the number seconds it took for the pulse to appear. The logic I have in my code is:

if byte 8 is less than 3 then watts per hour = (3600/byte 9) else watts per hour =byte 8 *(3600/30)

I have noticed that byte 9 always tends to be 15 when byte 8 gets above 2. There is probably a better way to do this but it seems good enough to me. Thanks for your code as I would never got this working.

ukshady commented 9 years ago

Its been 20 odd years since I have done any coding, so please excuse the 'hacks', I studied electronics a long time ago so I am new to this programming and github stuff. I have forked your repo to here https://github.com/ukshady/efergy-elite-ir-decode and added the code I have been working on.