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

Fuel Level In Gallons is returning Liters #178

Open
Quiqui64 opened this issue Jun 27, 2022 · 6 comments
Open

Fuel Level In Gallons is returning Liters #178

Quiqui64 opened this issue Jun 27, 2022 · 6 comments

Comments

@Quiqui64
Copy link

Quiqui64 commented Jun 27, 2022

First of all, thank you for this wrapper.
Here are my results from MQTT Explorer.
Notice that "fuel_amount" and "fuel_level_in_gal" have the same result.

Topic = homeassistant/sensor/1GNSCAKC3Hxxxxxxxx/fuel_tank_info/state
{
"fuel_amount": 23.04,
"fuel_capacity": 99.75,
"fuel_level": 23.1,
"fuel_level_in_gal": 23.04
}

Topic = homeassistant/sensor/1GNSCAKC3Hxxxxxxxx/fuel_level_in_gal/config
{
"name": "Fuel Level In Gal",
"device": {
"identifiers": [
"1GNSCAKC3Hxxxxxxxx"
],
"manufacturer": "Chevrolet",
"model": "2017",
"name": "2017 Chevrolet Tahoe"
},
"availability_topic": "homeassistant/GNSCAKC3Hxxxxxxxx/available",
"payload_available": "true",
"payload_not_available": "false",
"state_topic": "homeassistant/sensor/GNSCAKC3Hxxxxxxxx/fuel_tank_info/state",
"value_template": "{{ value_json.fuel_level_in_gal }}",
"unique_id": "GNSCAKC3Hxxxxxxxx-fuel-level-in-gal",
"unit_of_measurement": "L"
}
I believe "unit_of_measurement": should be "G"

Thank You,
Jason

@BennyDaBee
Copy link
Contributor

Hello,

How are you running this? Docker or NPM?

@Quiqui64
Copy link
Author

Docker, but now i'm having the same issue as #190

Thanks

@BennyDaBee
Copy link
Contributor

I have identified a fix in #190, but it does require moving off of docker, and my security approach for it is not great. I think I need to work with Michael on creating a gas branch as I think this issue is with some of the variables in the measurement conversion.

@fragglehunter
Copy link

I created a separate sensor template to convert liters to gallons and it seems to be accurate for my truck:

- platform: template
  sensors:
    trailboss_gas_gallons_state:
      friendly_name: "Gallons Remaining" 
      value_template: >
        {% set tbgp = states('sensor.fuel_level_in_gal') %}
        {% set value = tbgp | multiply(1) / 3.785  %} 
        {{ value | round(1) }}
      unit_of_measurement: "Gallons"
      icon_template: >-
        {% if is_state('sensor.trailboss_gas_gallons_state', '0') %}
           mdi:help-rhombus
        {% else %}
          mdi:speedometer
        {% endif %}

BigThunderSR added a commit to BigThunderSR/onstar2mqtt that referenced this issue Apr 20, 2023
@BigThunderSR
Copy link
Contributor

My proposed changes in the above PR should work with all types of vehicles (Electric/Gas/Hybrid) as long as GM doesn't change the type of the units that are reported by the vehicle.

@michaelwoods
Copy link
Owner

Please try the latest build, thanks to @BigThunderSR.

Gibby pushed a commit to Gibby/onstar2mqtt that referenced this issue May 19, 2023
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

5 participants