itchannel / fordpass-ha

Fordpass integration for Home Assistant
301 stars 53 forks source link

Fuel Level -5% #101

Closed schlaggi closed 3 years ago

schlaggi commented 3 years ago

I have the problem, that when I manually trigger an update while the engine is off my car tells me the fuel level is -5%. This stays until I start the engine, then everything works perfectly again.

image

Maybe this comes from the Ford API because it can't reach the fuel sensor or something but if so it would be perfect if the integration just shows the last detected value.

Besides that I really like this integration! Keep up the good work! :)

itchannel commented 3 years ago

Can I ask what model you have. As -5 to 105% is the value range of the fuel sensor, however it shouldn't drop to -5% when the engines off as the API just returns the last read value of the car.

Can you let me know what fuel value you get in your fordpass app if you do a manual update with the car off?

schlaggi commented 3 years ago

Its a 2019 Ford Focus MK4 and I never recognized it but the FordPass app shows no fuel data in this case! 😮 No value at all.

I'll look if there are more boxes to tick in the cars settings...

itchannel commented 3 years ago

That's weird. Must be something to do with your model/year of car not holding the fuel data in memory maybe.

On my two cars it always displays the fuel level regardless of when I refresh and I've had my fuel tank at -5% before running it on empty so wouldn't be effective adding a check for -5%.

However if it's a niche case for you then I'd suggest creating yourself a template in HA for the fordpass_fuel sensor which when the value = -5% show the last known state.

schlaggi commented 3 years ago

Okay I was able to help myself with a template sensor:

template:
  - sensor:
    - name: "Fordpass Fuel (Correct)"
      unit_of_measurement: "%"
      icon: 'mdi:gas-station'
      state: >
        {% if state_attr('sensor.fordpass_fuel', 'fuelLevel') > -5 %}
          {{ states('sensor.fordpass_fuel') | int }}
        {% else %}
          {{ states('sensor.fordpass_fuel_correct') | int }}
        {% endif %}

This sensor now always shows the value of sensor.fordpass_fuel, as long as it is not -5 or below.

Thanks anyway 🙂

itchannel commented 3 years ago

Nice 👍