Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculating Remaining Units #19

Open
jacauc opened this issue Aug 10, 2021 · 5 comments
Open

Calculating Remaining Units #19

jacauc opened this issue Aug 10, 2021 · 5 comments
Labels
help-wanted We need some extra helping hands or expertise in order to resolve this. new-feature New features or request.

Comments

@jacauc
Copy link

jacauc commented Aug 10, 2021

I love this integration. Got it working quite well with an LDR since I don't have access to photodiode.

I have a prepaid meter where I load e.g 500 units at the beginning of the month. Since I can look on the display to see there are currently 537.1 units left, I'm looking for tips on how I can manually enter this into HA and then expose/calculate the remaining units in HA (since glow is able to tell me how many times the light blinked - i.e. how many units I have consumed.)

Any nifty ways for achieving this in HA?

@fourtrax01
Copy link

I would use the monthly utility meter on your sensor data from your glow it will reset every month but will not reset your overall consumption from your glow. It will count up but with a quick calculation you should be able to get it to count down. either way you will be able to see how much you have used and it automatically resets every month.

@klaasnicolaas klaasnicolaas added the help-wanted We need some extra helping hands or expertise in order to resolve this. label Aug 16, 2021
@iamvlanone
Copy link

I am doing this with a template sensor in HA. I have a input-number helper for the starting units, where I will enter the starting units and then subtract the total usage from that. I still need to decide if I want to reset my total usage everytime I enter the starting units for the month, but got it working in principle.

image

template sensor config:

  • platform: template
    sensors:
    kwh_available:
    value_template: '{{ ((states.input_number.starting_kwh_units.state | float | round(2))) - ((states.sensor.power_total_energy.state | float | round(2))) }} '
    friendly_name: Available kWh Units
    unit_of_measurement: kWh

@iamjb
Copy link

iamjb commented Feb 25, 2022

@iamvlanone

template sensor config:

I am trying to get this to work. I have created the input-number helper, but i am a little lost as to where the template sensor config goes. I get errors when i put it in config.yaml

Would you mind giving me a little more insight?

@iamvlanone
Copy link

Did you indent your config correctly? I could not figure out how to paste the code with indents.

My config is split into different files. You can test the value_template using the template option in developer tools. Do you mind sharing your code and include the sensor names for the input_number and the energy value. I will see if I can assist as much of my coding is by trial and error

input_number.yaml
starting_kwh_units:
name: Starting kWh Units
mode: box
min: 0.00
max: 1000.00
unit_of_measurement: kWh
step: 0.01

sensors.yaml
platform: template
sensors:
kwh_available:
value_template: '{{ ((states.input_number.starting_kwh_units.state | float | round(2))) - ((states.sensor.power_total_energy.state | float | round(2))) }} '
friendly_name: Available kWh Units
unit_of_measurement: kWh

Available KWh config.txt

@iamjb
Copy link

iamjb commented Mar 9, 2022

Sorry for the late reply @iamvlanone .
Thank you for your reply.
Now that I had some time i had a look at the log file and noticed that there was an error on the template sensor where your sensor was:
states.sensor.power_total_energy.state
Mine was:
states.sensor.house_total_energy.state

Now it seems to be working perfectly.

Thank you!
JB

@klaasnicolaas klaasnicolaas added the new-feature New features or request. label May 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help-wanted We need some extra helping hands or expertise in order to resolve this. new-feature New features or request.
Projects
None yet
Development

No branches or pull requests

5 participants