Coder Social home page Coder Social logo

Comments (2)

acronce avatar acronce commented on June 20, 2024 1

It looks like that sensor returns 65535 when charging is not happening. @jgoldman1 you can work around this by wrapping the sensor in an availability template (substitute your vehicle name):

# Lucid Air sensor templates
- platform: template
  sensors:
    lucid_air_charge_session_time_remaining_template:
      friendly_name: "Lucid Air Charge session time remaining template"
      device_class: duration
      unit_of_measurement: minutes
      availability_template: >-
        {% if states('sensor.lucid_air_charge_session_time_remaining') | int == 65535 %}
          unavailable
        {% else %}
          true
        {% endif %}
      value_template: >-
        {{ states('sensor.lucid_air_charge_session_time_remaining') }}

Then just use the template as the entity in your dashboard card instead of the original one.

If you don't want the sensor to appear unavailable when not charging, you could instead just change the value_template to return 0 when it sees 65535.

- platform: template
  sensors:
    lucid_air_charge_session_time_remaining_template:
      friendly_name: "Lucid Air Charge session time remaining template"
      device_class: duration
      unit_of_measurement: minutes
      value_template: >-
        {% if states('sensor.lucid_air_charge_session_time_remaining') | int == 65535 %}
          0
        {% else %}
          {{ states('sensor.lucid_air_charge_session_time_remaining') }}
        {% endif %}

from ha-lucidmotors.

nshp avatar nshp commented on June 20, 2024

I think that's a max value used when there is no charge session - we should just catch that and set it to Unavailable or something. The formatting is HA's problem though - it just doesn't display durations longer than hours well. We could format it ourselves, but that would just make automations more difficult.

from ha-lucidmotors.

Related Issues (19)

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.