itchannel / fordpass-ha

Fordpass integration for Home Assistant
301 stars 53 forks source link

fordpass_fuel > 100% #468

Closed mclever closed 3 months ago

mclever commented 8 months ago

Filled up today and noticed the fordpass_fuel showed 103%. May want to cap that at 100%.

Thank you for this integration!!

BobMac57 commented 8 months ago

Filled up today and noticed the fordpass_fuel showed 103%. May want to cap that at 100%.

Thank you for this integration!!

FYI, that's an issue with Ford. I worked with a developer creating an Android version of a more detailed version of FordPass and found the same issue. If you want to, use this but change the last number to the size of your tank in gals:

sensor.fordpass_fuel / 103 * 36

SquidBytes commented 7 months ago

I worked with a developer creating an Android version of a more detailed version of FordPass

Do you have that information? My frustration with the FordPass app drove me to this project - I have thought about trying to do something similar....but I am not good at programming and I know nothing for App development.

cr08 commented 6 months ago

I worked with a developer creating an Android version of a more detailed version of FordPass

Do you have that information? My frustration with the FordPass app drove me to this project - I have thought about trying to do something similar....but I am not good at programming and I know nothing for App development.

Just came across this and sorry for adding another off topic comment.

Ditto on this and for mostly the same reasons. If there's any more info on this app project, I'd love to see it. Ford killing off a lot of features in FordPass for my vehicle (C-Max Energi) basically directed me here and got me on the path for trying to build my own dashboard with all the extra info available from the API. But I'm more used to web based stuff and is where that focus went. Android app development is well outside my wheelhouse.

mclever commented 3 months ago

Should this be in the current beta @SquidBytes?

SquidBytes commented 3 months ago

It is not The fordpass_fuel sensor is just rounding what is returned from the vehicle

if self.sensor == "fuel":
    fuel_level = self.data.get("fuelLevel", {}).get("value")
    if fuel_level is not None:
        return round(fuel_level)

From what I know - the data from the vehicle reports similar to this

"fuelLevel": {
    "updateTime": "xxxx-xx-xxTxx:xx:xxZ",
    "oemCorrelationId": "xxxx",
    "value": 69.21759

It could be capped at 100%, but as a data nerd I default to displaying what is reported by the vehicle

mclever commented 3 months ago

Does something like this work? Sorry I don't know the correct syntax but the logic is if greater than 100 just report 100 and if not then report the value given

if self.sensor == "fuel":
    fuel_level = self.data.get("fuelLevel", {}).get("value")
    if fuel_level is not None:
        if fuel_level is > 100
            return 100
        else
            return round(fuel_level)
BobMac57 commented 3 months ago

I just created a helper using this, the number 36 is fo the tank size in gals.

{{states('sensor.fordpass_fuel') | float /103 * 36}}

On 2024-05-09 20:40, mclever wrote:

Does something like this work? Sorry I don't know the correct syntax but the logic is if greater than 100 just report 100 and if not then report the value given

if self.sensor == "fuel": fuel_level = self.data.get("fuelLevel", {}).get("value") if fuel_level is not None: if fuel_level is > 100 return 100 else return round(fuel_level)

-- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you commented.Message ID: @.***>

Links:

[1] https://github.com/itchannel/fordpass-ha/issues/468#issuecomment-2103653102 [2] https://github.com/notifications/unsubscribe-auth/BE4QBILTFVHBPHZIPAQPGK3ZBQJQHAVCNFSM6AAAAABBP3PHBSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBTGY2TGMJQGI

-- NULL

SquidBytes commented 3 months ago

@mclever I think the best solution is to do a helper or template sensor which was suggested by @BobMac57 (thank you for that!).

When modifying the sensory.py file on your HA it will require a restart to take effect. Also, just so you're aware - if you do make changes to sensor.py on your HA instance it will be reset anytime a new version is downloaded.

As @BobMac57 said, you can do the exact conversion for you vehicle using your tank size. Considering Ford being a global brand and the many different tank sizes I personally don't think its best to fix this "bug". Worst case - you know for sure your fuel tank is "FULL"