Skip to content
View in the app

A better way to browse. Learn more.

Power Forum - Renewable Energy Discussion

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Home Assistant Eskom Prepaid

Featured Replies

Good day All

is there a way to have home assistant monitor my prepaid electricity box so it can warn me when my electricity is running low or even top up the meter somehow (this is probably just a pip dream)

I did once see a person who stuck a photo diode directly over the LED on his pre-paid meter to count pulses. The LED on the meter flashes at something like 1000 pulses per kWh.

Then he wrote some software that tracked his usage based on the count. Unfortunately you then have to manually update the remaining kWh when you recharge your meter.

2 hours ago, Stanley said:

I did once see a person who stuck a photo diode directly over the LED on his pre-paid meter to count pulses. The LED on the meter flashes at something like 1000 pulses per kWh.

I've done that, back when I was developing the pulse meter implementation for the Venus-GX (it was for water pumps... but this seemed like a good way to test it):

18446706_10155147385400619_6981506205540298313_n.jpg.9008e44e0c549626adee28ad08680ad4.jpg

Also, I made this some years ago, or rather, I fixed it up so it works again, an Android app that uses the camera to count pulses.

There is no intelligence in it, it simply uses the average value of the whole photo frame, ie you need to hold the camera close to the LED. I wanted to make it so it can also upload the value to "the cloud" but I kinda lost interest when I found out you can just punch #1# into the conlog to get a power reading.

 

  • 1 year later...

I was also looking for a solution here

If you have some energy meter (measuring total consumed kWh). You can try the following (I use it in packages\prepaid.yaml). My energy from the grid is measured by the sunsynk inverter, but any meter should work

You can now create an automation if sensor.prepaid_units_left<20 to send you a message etc...

 

# A sensor that indicates how many prepaid units you have left
#
#   1. Enter the units using "input_test.prepaid_units"
#   2. An automation save the sum of the enetered units + grid total
#   3. The sensor displays the saved value - the current grid total

automation:
  -
    id: "prepaid-set-units"
    alias: Prepaid - set units
    initial_state: true
    trigger:
      - platform: state
        entity_id: sensor.prepaid_units_left
    condition: "{{ states('sensor.prepaid_units_left') | float < 0 }}"
    action:
      - service: input_text.set_value
        target:
          entity_id: input_text.prepaid_units
        data:
          value: >
            {% set units = states('input_text.prepaid_units') | float %}
            {% set total = states('sensor.ss_total_grid_import') | float %}
            {{ (units+total) | round(2) }}

input_text:
  prepaid_units:
    name: Enter Prepaid units from meter
    pattern: '\d+(\.\d+)?'
    mode: password
    icon: mdi:home-lightning-bolt-outline
    min: 1
    max: 10


template:
  - sensor:
      - name: "Prepaid units left"
        icon: mdi:home-lightning-bolt-outline
        unit_of_measurement: "kWh"
        state: >
          {% set units = states('input_text.prepaid_units') | float %}
          {% set total = states('sensor.ss_total_grid_import') | float %}
          {% if (units-total) > 999 %}999.999{% else %}{{ (units-total) | round(1) }}{% endif %}

 

  • 1 year later...

Hi @kellerza

Digging this one up, hope you don't mind. I've recently gone solar/prepaid so would like to monitor my PP balance in my HA dashboard. Is your code still relevant or has there been updates?

Thanks

  • 5 months later...
On 2022/02/22 at 8:54 PM, kellerza said:

I was also looking for a solution here

If you have some energy meter (measuring total consumed kWh). You can try the following (I use it in packages\prepaid.yaml). My energy from the grid is measured by the sunsynk inverter, but any meter should work

You can now create an automation if sensor.prepaid_units_left<20 to send you a message etc...

 

Sorry but how do you implement this? I have tried this but getting "unavailable".

I have the Sunsynk inverter in HA.

On 2022/02/22 at 8:54 PM, kellerza said:

If you have some energy meter (measuring total consumed kWh). You can try the following (I use it in packages\prepaid.yaml). My energy from the grid is measured by the sunsynk inverter, but any meter should work

The useage your inverter sees is not necessarily the same amount by which your prepaid balance changes. I say this from personal experience.

So if you want to track the inverter's net draw from the grid then your method is a good one. If you want to track the actual balance on the meter then we're back to interfacing with the meter itself.

On 2024/02/26 at 2:19 PM, McGuywer said:

Sorry but how do you implement this? I have tried this but getting "unavailable".

I have the Sunsynk inverter in HA.

@McGuywer did you manage to get it going. 

On 2024/03/06 at 8:09 AM, debug78 said:

@kellerza can you give us a step by step on the implementation thanks in advance.

 

 

1. Read up on config packages here - config-packages

2. Save the code above in a "package" file

3. Add your elements to your HA dashboard
image.png.03049e19561d50d0e989e2caccc65b31.png

On 2024/02/26 at 3:20 PM, Bobster. said:

The useage your inverter sees is not necessarily the same amount by which your prepaid balance changes. I say this from personal experience.

So if you want to track the inverter's net draw from the grid then your method is a good one. If you want to track the actual balance on the meter then we're back to interfacing with the meter itself.

If your inverter's mode (load_limit sensor) is set to "Zero export" and your inverter's CT sensor is working, then total_grid_import is very close. If you set load_limit to only essentials or to export then the inverter does not include the non-essential power draw. Why you should ask Sunsynk, but so far, they have told us to update the inverter firmware, without any success.

Sorry @kellerza, I am still struggling:

 

image.thumb.png.7e0c1a611e76acf40c8cf869077cce04.png

Quote

 

root@server:/data/docker/homeassist# cat config/packages/prepaid.yaml 

# A sensor that indicates how many prepaid units you have left

#

#   1. Enter the units using "input_test.prepaid_units"

#   2. An automation save the sum of the enetered units + grid total

#   3. The sensor displays the saved value - the current grid total

 

automation:

  -

    id: "prepaid-set-units"

    alias: Prepaid - set units

    initial_state: true

    trigger:

      - platform: state

        entity_id: sensor.prepaid_units_left

    condition: "{{ states('sensor.prepaid_units_left') | float < 0 }}"

    action:

      - service: input_text.set_value

        target:

          entity_id: input_text.prepaid_units

        data:

          value: >

            {% set units = states('input_text.prepaid_units') | float %}

            {% set total = states('sensor.sunsynk_total_grid_import') | float %}

            {{ (units+total) | round(2) }}

 

input_text:

  prepaid_units:

    name: Enter Prepaid units from meter

    pattern: '\d+(\.\d+)?'

    mode: password

    icon: mdi:home-lightning-bolt-outline

    min: 1

    max: 10

 

 

template:

  - sensor:

      - name: "Prepaid units left"

        icon: mdi:home-lightning-bolt-outline

        unit_of_measurement: "kWh"

        state: >

          {% set units = states('input_text.prepaid_units') | float %}

          {% set total = states('sensor.ss_total_grid_import') | float %}

          {% if (units-total) > 999 %}999.999{% else %}{{ (units-total) | round(1) }}{% endif %}

 

root@server:/data/docker/homeassist# 

 

 

 

What am I missing?

 

On 2024/03/15 at 9:52 AM, McGuywer said:

Sorry, but I am not following?

I am not sure what to do?

@McGuywer you need to change sensor.sunsynk_total_grid_import to your sensor entity then in works perfectly. Thanks @kellerza 

  • 3 weeks later...
  • 1 month later...

I found this very useful and decided to put together a video on installing it as some people, including myself :-), were having a few issues setting it up. 

I hope that the video helps 

 

 

 

On 2024/06/05 at 12:54 PM, Sc00bs said:

I found this very useful and decided to put together a video on installing it as some people, including myself :-), were having a few issues setting it up. 

I hope that the video helps 

 

 

 

@Sc00bs Thanks for this. Unfortunately I cannot get this to work. I had to manually create the templates as the code was giving errors. I am actually using the Home | Home Assistant Glow 🌟 (glow-energy.io) mentioned by @hilt_ctn above as the total grid use number. I am almost certainly doing something wrong because the nothing updates. I suspect the issue is in the script but i can't see what is wrong there -

alias: Update Prepaid Units
sequence:
  - service: input_number.set_value
    target:
      entity_id: input_number.enter_prepaid_units_from_meter
    data:
      value: '{{ states(''input_number.enter_prepaid_units_from_meter'') | float }}'
  - service: input_number.set_value
    target:
      entity_id: input_number.prepaid_units_left
    data:
      value: '{{ states(''sensor.prepaid_units_left'') | float }}'
  - service: input_number.set_value
    target:
      entity_id: input_number.initial_prepaid_units
    data:
      value: '{{ states(''input_number.initial_prepaid_units'') | float }}'
  - service: input_datetime.set_datetime
    target:
      entity_id: input_datetime.last_update
    data:
      datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
mode: single

On 2024/04/09 at 12:06 PM, hilt_ctn said:

Came across this today - Home Assistant Glow

home-assistant-glow-455411006a29853c05cdf47e1a1d2b81.jpg

I have just installed this on my meter. Seems to be tracking my meter much better than IAMMETER. Will feedback after a bit more time testing. I fount it very hard to get the exact LM393 Photodiode. I eventually found it at Leobot Electronics (Pretoria). Quite expensive though when you add on postage to the Cape.

Edited by rgt.dnl

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.