GithubHelp home page GithubHelp logo

Comments (4)

djfanatix avatar djfanatix commented on July 22, 2024

Yes one up for this!
Since HA 2023.3, decimals are configured in the UI, and some are messed up. (such as my battery %)

from tesla-style-solar-power-card.

PierreScerri avatar PierreScerri commented on July 22, 2024

That would be nice. It would save having duplicate template sensors.

from tesla-style-solar-power-card.

melvanderwal avatar melvanderwal commented on July 22, 2024

I figured out something that works for me - rounding the APF xxxx Entities to the nearest 100 Watts. In the card, the entity is then shown as an integer when it is watts, and to 1 decimal place when it is kilowatts (and maintains the trimming of the trailing zero, like the grid entity shown below). You could similarly round to 10 Watts or 1000 Watts for different levels of decimal precision.
e.g. For the APF House Entity:
state: "{{ (states('sensor.load')|float / 100)|round(0) * 100 }}"

Would still be handy to do it via the config, but this also works.

image

from tesla-style-solar-power-card.

mkanet avatar mkanet commented on July 22, 2024

I figured out something that works for me - rounding the APF xxxx Entities to the nearest 100 Watts. In the card, the entity is then shown as an integer when it is watts, and to 1 decimal place when it is kilowatts (and maintains the trimming of the trailing zero, like the grid entity shown below). You could similarly round to 10 Watts or 1000 Watts for different levels of decimal precision. e.g. For the APF House Entity: state: "{{ (states('sensor.load')|float / 100)|round(0) * 100 }}"


@melvanderwal I hope you're still watching this thread. Could you please do me a huge favor and copy and paste all your template sensors related to tesla-style-solar-power-card as
tesla-style-solar-power-card lovelace code?

I think something must have changed in Home Assistant or the Integration to make your example not correct anymore. When I use your example above, all my AFP values show as 0. It looks like your suggested code is presuming that my tesla powerwall Entities are in Watts. They are actually in Kilowatts for me.

Below are my template sensors:

      - name: APF Grid Entity
        device_class: power
        state_class: measurement
        unit_of_measurement: W
        state: "{{ ((0 - states('sensor.powerwall_site_power')|float * 1000) / 100)|round(0) * 100 }}"
      - name: APF House Entity
        device_class: power
        state_class: measurement
        unit_of_measurement: W
        state: "{{ (states('sensor.powerwall_load_power')|float * 1000 / 100)|round(0) * 100 }}"
      - name: APF Generation Entity
        device_class: power
        state_class: measurement
        unit_of_measurement: W
        state: "{{ (states('sensor.powerwall_solar_power')|float * 1000 / 100)|round(0) * 100 }}"
      - name: APF Battery Entity
        device_class: power
        state_class: measurement
        unit_of_measurement: W
        state: "{{ ((0 - states('sensor.powerwall_battery_power')|float * 1000) / 100)|round(0) * 100 }}"
      - name: APF Grid Import
        device_class: power
        state_class: measurement
        unit_of_measurement: W
        state: >
          {% if states('sensor.apf_grid_entity')|int(default=0) < 0 %}
            {{ states('sensor.apf_grid_entity')|int(default=0)|abs }}
          {% else %}
            0
          {% endif %}

from tesla-style-solar-power-card.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.