Prepaid meter Reading

Hi,

I have pre paid electricity, like quite alot of users.
Was wondering if there is a way to calculate how much units we have left and display it somewhere?

My meter is in the Garage, not a big deal just to walk there every now and again to check what we have left, but it would be nice if somehow it can by display somewhere base on monthly purchase - et112 reading.

Idea is to manual entre the current reading and then it automaticly deduct what is being used.

Can it be done, is this possible?

I have a similar issue. Iā€™m trying to implement Seven Segments OCR - Home Assistant but I am not having much luck.

On the prepaid meter there is a small LED that flashed as you consume energy, most of them are 1000 flashes per 1 kWh.
With an LDR and esp8266, you could count the flashes and then deduct them from what your current units are. It should be fairly close to what the meter shouws.

I remember @plonkster doing something like reading the blinking light.

The blinking light is great, but it doesnā€™t let you know how much is left unless you manually edit the starting values every time you load a token.

Please provide details of the meterā€¦

Yeah, I made an Android app (or rather, I fixed one up from someone elseā€¦ someone who stubbornly refused to answer my emails when I asked if it was okay :slight_smile:) that uses the camera of the device to count the LED blinks and calculate it for you. I went as far as making the app keep the phone alive, with the idea of later adding some logging to it. You could then, in theory, mount an old phone to your prepaid meter to do a bit of logging.

Shortly afterwards I discovered that my conlog meter has a feature: Type #1# on the keypad, and it shows you the current consumption on the LCD. Lost interest in the Android app after that.

Someone contacted me once and asked if they can use the app for some project in their country. I said yes, but ask the original author. CCed him in the mail. Still no response. Iā€™m pretty sure he intended the code to be public domain (since he put it up for download without an explicit license), soā€¦ here it is. It is positively ancient by now :slight_smile:

Thanks for all the great feedback.
I was more wondering in the lines of useing the ā€œfrom Gridā€ values in VRM to calculate the remaining units left on the prepaid meter.

But i quest i can use a webscraper and excell to calculate that.
Unless, if possible, to build in a extra menu into venus os that you can manually type in your existing units, and then it will automatically deduct the ā€œfrom Gridā€ units as they are being used.
But then, i quest it will be easier to just walk once or twice a month to check what is left!

Why not just download the data from VRMā€¦

Selection_921

With a bit of trickery, it should be simple enough to figure out what http request you need to pull that using a scriptā€¦

1 Like

Finally got this working on a static image. Now to see if i can pull it from a camera feed that 2m away.

I have NOT done this so canā€™t help with tech support but for anyone who wants to tinker. One option to explore (depending on what else may still need to be purchased) is an Efergy CT Clamp+Transmitter, a RTL-SDR (USB type receiver that has many ā€œoff-labelā€ uses) and home assistant.

The Efergys transmit their measurement on 433Mhz and you can pick that up with a RTL dongle, decode it and via mqtt probably get it into something like home assistant. Even if getting all of this to work it will not be 100% accurate (Efergy sends measurement at most every 6 seconds and also does not measure, voltage so power ā€œmeasurementā€ is dependent on your programmed voltage).

Some links for anyone wanting to dive down the SDR rabbit hole
SDR general info
Efergy + SDR 1 2 3

For those like @plonkster with a very wide interest you can even use these RTL based receivers to receive and decode satellite signals (even I managed to get a weather satellite image - so it is doable).

Back to topic sort of : ā†’ The CBI nanoview energy monitor communicates via UART and the technically inclined should find all they need about the protocol etc. here if wanting to use these measurements in something like home assistant (again donā€™t ask me for tech support - I must still figure out what an unsigned integer isā€¦ :flushed: ). The nanoview should give a more accurate reading since it also measures voltage but you will now run into the problem of getting that measurement from the garage (or wherever) to anywhere else. The fact that the nanoview is probably more expensive than an ET112 is beside the point :wink: (but you can measure multiple different circuits if necessary with the nanoviewā€¦)

Efergy integrates directly into Home Assistant with the Efergy Hub.

1 Like

The short answer is that it is a number value that can go pretty large, but only hole number (no dicimals) and never negative.

From 0 to 4,294,967,295 which (2 to the power of 32) āˆ’ 1

If it was signed then the largest number is half that, but it can now go just as large in the negative
āˆ’2,147,483,648 to 2,147,483,647

In reality the size of an integer does depend on the programming language and if it was build for 16bit, 32bit or 64bit CPUs.

1 Like

So it will be numbers from 0 to 0,000,000,000 - these are all hole numbers I think. Is 8 two hole numbers? I am now more confused :wink: ā€¦ you can now see why I just barely passed math.

Now seriously, @Louisvdw thanks for the explanation - much better than my google results.

1 Like

Remember the old 99 bottles of beer songā€¦ well, imagine you finally got down to zero, and this happensā€¦

Zero bottles of beer on the wall. Zero bottles of beer! Take one down, pass it around, 65535 bottles of beer on the wall!

Thatā€™s what happens with unsigned ints :slight_smile:

1 Like

Actually, I have another little story I can tell here.

So every single CAN-bms battery maker defines the Ah rating of the battery as a signed 16-bit integer, with one decimal. This is how the protocol developed ever since someone started it and everyone copied it, so that today it is a kind of defacto standard.

Signed 16-bit integer means it can represent numbers from -3276.8 Ah to -3276.7Ah.

First, the idea of negative Amp-hours is completely nonsensical. Second, I donā€™t think Iā€™ve ever seen anyone use the decimal point that is provided for. And thirdā€¦ the battery makers donā€™t actually follow this spec to the letter. They send an unsigned 16-bit integer (which makes a little more sense).

A 16-bit unsigned integer scaled to have one decimal has a range of 0 to 6553.5Ah.

Now as you might imagine, there are now a few battery banks in the world with a capacity of more than 3276Ah. And the moment that happenedā€¦ yupā€¦ the number showed up as negative on the other end :slight_smile:

2 Likes

one of the problems with numbers - they seldom allow for context

During the current lockdown, if you are stopped at a road block the answer will always be 0 bottles of beer - no matter what was signedā€¦

Apologies to the thread/soup police.

1 Like

Now if you are a C (or C++) programmer and you are going for an interview, there will always be that one question: How large is an integer.

The answer (as indicated in @plonksterā€™s answer) is that it depends. If you are on a 16bit CPU the integer is 16 bits (2 power of 16 cause a bit or switch can be either On or Off)
A 32bit CPU will have an integer as 32bits. And 64bit for the new guys.

Other types tend to be fixed, but integer is suppose to be the most effecient size, thus matching the CPU.
It is because of this story that 64bit OS and 64bit apps works, but you canā€™t run 64bit apps on a 32bit OS. Most od the OS and drivers are still build on C/C++ or derivatives so you find this everywhere.

Can you track the usage, using and ET112, and deduct it from the ā€œbalanceā€ using some logic - I use Node Red for other stuff so that would work?

I bring you this absolutely stupid errorā€¦

ERROR:dbus.service:Unable to append (10000000000,) to message with signature v: <class 'OverflowError'>: Value 1410065408 out of range for Int32

So python2 has both a long (64-bit) and an int (32-bit). Python3 has only an int which can do everything. The dbus library has a bit of code that checks what kind of int it is working with, and then uses the correct C-type to send it over the IPC bus.

In the old code, it first checked if it was an int or a long. If it was a long, it would go through a long switch statement, and finally default to int64.

But now in python3, everything is an int. So now it executes the other default, which is to turn all unknown numbers into an int32. Causing errors.

So even in python land, this bites you in the arse every now and thenā€¦

1 Like