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

[BUG] Last reset is missing #67

Open
2 tasks
jeppemedleen opened this issue Jul 2, 2024 · 3 comments
Open
2 tasks

[BUG] Last reset is missing #67

jeppemedleen opened this issue Jul 2, 2024 · 3 comments

Comments

@jeppemedleen
Copy link

jeppemedleen commented Jul 2, 2024

Please help me help you:

  • Describe what you experience and what the expectation was
    When using the entity Eforsyning_water_used it states that the last reset is missing
  • If relevant, please post screenshots
    image
    image
@mm98
Copy link
Contributor

mm98 commented Aug 20, 2024

@jeppemedleen If you know how to add a template sensor by YAML. You could add the following, to get water consumption working in the Energy area. This will always be one day delayed, even though it will be shown today.

- platform: template
  sensors:
    eforsyning_water_usage_total:
      friendly_name: "EForsyning: Water usage (total)"
      unique_id: eforsyning_water_usage_total
      unit_of_measurement: 
      device_class: water
      availability_template: >
        {{ has_value("sensor.eforsyning_water_end") and states("sensor.eforsyning_water_end") | float(0) > 0 }}
      value_template: >-
        {{ states("sensor.eforsyning_water_end") | float(0) }}
      attribute_templates:
        state_class: total_increasing
        last_reset: >
          {{ ((state_attr("sensor.eforsyning_water_end", "data") | sort(attribute="date", reverse=true))[0].date | as_datetime).isoformat() }}

@kpoppel
Copy link
Owner

kpoppel commented Aug 20, 2024

Thank you. I have never used the energy dashboard as I am apparently not clever enough to set it up 😀
So a missing last reset could be done as the template sensor above. Let me have a look at it.

@kpoppel kpoppel closed this as completed Aug 20, 2024
@kpoppel kpoppel reopened this Aug 20, 2024
@mm98
Copy link
Contributor

mm98 commented Aug 20, 2024

Thank you. I have never used the energy dashboard as I am apparently not clever enough to set it up 😀 So a missing last reset could be done as the template sensor above. Let me have a look at it.

last_reset attribute should just be the last known date in .isoformat() format. This allows the device to be added to the Energy area (uses the delta to calculate the value, since last_reset). The only challenge is, that the data is from yesterday (since it is one day offset) and it will be shown today (better than nothing).

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

No branches or pull requests

3 participants