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

Added Persistent Total Water Meter Reading #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Diondk
Copy link
Contributor

@Diondk Diondk commented Sep 7, 2024

Note: This code requires testing before being committed. I am unable to test it myself as my water meter is currently on loan.

Added water usage tracking via Pulse Meter for Liters and Cubic Meters

  • Implemented total water meter reading with the initial value (in m³), including persistent storage to retain data across reboots.
  • Added visual feedback with a green LED that flashes for 1 second with each pulse.
  • Replaced the binary sensor with the Pulse Meter, which now manages pulse detection.
  • Introduced three new sensors:
    • 'Water Usage in Liters' for real-time water consumption in liters.
    • 'Water Usage in M³' for real-time water consumption in cubic meters (m³).
    • 'Total Water Meter Reading' for tracking the cumulative water usage in cubic meters (m³).

Added globals with an initial value so that we can store the original value of the watermeter. 

Added 3 sensors
Usage in liters
Usage in m3
Usage in m3 total amount, including the initial value.
Translation to english for new part of initial_value.
@Diondk
Copy link
Contributor Author

Diondk commented Sep 7, 2024

How to Set the Initial Value for the Water Meter in ESPHome

In this guide, you'll learn how to fill in the initial value of your water meter in ESPHome so that it reflects the correct total water usage from the start.

Step-by-Step Instructions:

  1. Open your ESPHome configuration file where the globals are defined for your water meter.

  2. Locate the initial_value field in the globals section. This is where you set the starting value for the total water meter reading in cubic meters (m³). Here’s an example:

    globals:
      - id: totalwater
        type: float
        restore_value: yes  # Ensures the value is saved after a reboot
        initial_value: '00012.345'  # <-- Set your starting value here
  3. Determine the current meter reading:

    • Check your physical water meter and note the current reading. This will typically be in cubic meters (m³).
    • The value usually looks like a number with 3 decimal places (e.g., 12.345 m³).
  4. Update the initial_value:

    • Replace the value '00012.345' with the actual reading from your water meter.
    • For example, if your water meter reads 15.678 m³, set the initial_value like this:
    initial_value: '00015.678'
  5. Save your changes to the configuration file.

  6. Deploy the updated configuration to your ESPHome device. This will set the initial total water usage to the value you specified.

Additional Notes:

  • Units: The initial_value is in cubic meters (m³), so make sure you are entering the correct units.
  • Reboots: With restore_value: yes, the value will persist across reboots, so you only need to set it once unless you reset the device.

By following these steps, you ensure that the ESPHome device starts tracking water consumption from the correct initial value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant