Giter Site home page Giter Site logo

Comments (19)

ClaymoreTech4 avatar ClaymoreTech4 commented on June 23, 2024

Simulator issue on my system. I updated to 1.45 with no change. FYI

Logger: homeassistant.components.sensor
Source: custom_components/fordpass/sensor.py:34
Integration: Sensor (documentation, issues)
First occurred: 11:55:44 AM (3 occurrences)
Last logged: 12:20:25 PM

Error while setting up fordpass platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/fordpass/sensor.py", line 34, in async_setup_entry
if "dieselSystemStatus" in sensor.coordinator.data and sensor.coordinator.data["dieselSystemStatus"]["filterRegenerationStatus"] != None:
TypeError: 'NoneType' object is not subscriptable

from fordpass-ha.

GeneralLouis avatar GeneralLouis commented on June 23, 2024

Want to add this bug caused 1 of my cars to drop to "unavailable" on all my entities, so a re-setup it and now only has 3 entities and the same error.

Logger: homeassistant.components.sensor
Source: custom_components/fordpass/sensor.py:34
Integration: Sensor (documentation, issues)
First occurred: 2:56:19 PM (1 occurrences)
Last logged: 2:56:19 PM

Error while setting up fordpass platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/fordpass/sensor.py", line 34, in async_setup_entry
    if "dieselSystemStatus" in sensor.coordinator.data and sensor.coordinator.data["dieselSystemStatus"]["filterRegenerationStatus"] != None:
TypeError: 'NoneType' object is not subscriptable

from fordpass-ha.

itchannel avatar itchannel commented on June 23, 2024

@GeneralLouis @theOrakle @jgvary Can one of you please try the 1.46 PreRelease version I've just pushed.

Looks like for certain cars the "dieselSystemStatus" exists but not the actual filterRegeneration values. I've changed the code to check for both.

https://github.com/itchannel/fordpass-ha/releases/tag/1.46-PreRelease

from fordpass-ha.

GeneralLouis avatar GeneralLouis commented on June 23, 2024

@GeneralLouis @theOrakle @jgvary Can one of you please try the 1.46 PreRelease version I've just pushed.

Looks like for certain cars the "dieselSystemStatus" exists but not the actual filterRegeneration values. I've changed the code to check for both.

https://github.com/itchannel/fordpass-ha/releases/tag/1.46-PreRelease

Just got it up and restarted HA after re-initializing the affected vehicle, still just 3 entities. I also can't turn on debug logging?

My other vehicle, which I haven't touched, still has all it's entities so it may be another issue with my vehicle, lets's see if the other 2 tagged people get a different result.

Here is my log again:

Logger: homeassistant.components.sensor
Source: custom_components/fordpass/sensor.py:35
Integration: Sensor (documentation, issues)
First occurred: 5:19:10 PM (1 occurrences)
Last logged: 5:19:10 PM

Error while setting up fordpass platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/fordpass/sensor.py", line 35, in async_setup_entry
    if "filterRegenerationStatus" in sensor.coordinator.data["dieselSystemStatus"]:
TypeError: argument of type 'NoneType' is not iterable

EDIT: I now have the bebug logging turned on, idk why it wasn't showing up before, nothing on system->logs though new for Fordpass

from fordpass-ha.

itchannel avatar itchannel commented on June 23, 2024

@GeneralLouis Could you enable debug logging for the fordpass integration and send me the contents of the vehicle array that is in the logs. I'm struggling to replicate the issue my end which must mean your vehicles are returning a slightly different data structure for the diesel section. (Sanitize your VIN first)

This is what my diesel section is like which really isn't handy for testing even though it's a diesel truck.

   "dieselSystemStatus":{
      "exhaustFluidLevel":"None",
      "filterSoot":"None",
      "ureaRange":"None",
      "metricType":"None",
      "filterRegenerationStatus":"None"

from fordpass-ha.

itchannel avatar itchannel commented on June 23, 2024

Can you give this version a go. Changed the coding to use .get() which should fail nicer if the value doesn't exist. But going to refactor some of the logic later today anyway when I merge a new pull request.

https://github.com/itchannel/fordpass-ha/releases/tag/1.46-PreRelease2

from fordpass-ha.

GeneralLouis avatar GeneralLouis commented on June 23, 2024

@GeneralLouis Could you enable debug logging for the fordpass integration and send me the contents of the vehicle array that is in the logs. I'm struggling to replicate the issue my end which must mean your vehicles are returning a slightly different data structure for the diesel section. (Sanitize your VIN first)

This is what my diesel section is like which really isn't handy for testing even though it's a diesel truck.

   "dieselSystemStatus":{
      "exhaustFluidLevel":"None",
      "filterSoot":"None",
      "ureaRange":"None",
      "metricType":"None",
      "filterRegenerationStatus":"None"

I am sorry but I am gonna need some help how to find these logs you mention, I got the debug logging on but I see no difference in system->logs

from fordpass-ha.

itchannel avatar itchannel commented on June 23, 2024

@GeneralLouis Could you enable debug logging for the fordpass integration and send me the contents of the vehicle array that is in the logs. I'm struggling to replicate the issue my end which must mean your vehicles are returning a slightly different data structure for the diesel section. (Sanitize your VIN first)
This is what my diesel section is like which really isn't handy for testing even though it's a diesel truck.

   "dieselSystemStatus":{
      "exhaustFluidLevel":"None",
      "filterSoot":"None",
      "ureaRange":"None",
      "metricType":"None",
      "filterRegenerationStatus":"None"

I am sorry but I am gonna need some help how to find these logs you mention, I got the debug logging on but I see no difference in system->logs

Do you have the following in your configuration.yaml to enable debug logging:

logger:
  default: warning
  logs:
    custom_components.fordpass: debug

If so it should just show up under system -> logs, it might now always show though if you filter by fordpass just look at the latest manually.

from fordpass-ha.

GeneralLouis avatar GeneralLouis commented on June 23, 2024

logger:
default: warning
logs:
custom_components.fordpass: debug

I was just clicking the 3 dots on the Fordpass integration itself in the devices and services page to enable it.

I will add this and try now

from fordpass-ha.

theOrakle avatar theOrakle commented on June 23, 2024

{'vin': 'VIN-REDACT', 'lockStatus': {'value': 'LOCKED', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'alarm': {'value': 'SET', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'PrmtAlarmEvent': {'value': 'Null', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'odometer': {'value': 96849.0, 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'fuel': {'fuelLevel': 35.978376, 'distanceToEmpty': 238.2, 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'gps': {'latitude': '38.8623783', 'longitude': '-94.7182467', 'gpsState': 'UNSHIFTED', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'remoteStart': {'remoteStartDuration': 0, 'remoteStartTime': 0, 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'remoteStartStatus': {'value': 0, 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'battery': {'batteryHealth': {'value': 'STATUS_LOW', 'timestamp': '02-17-2021 13:28:08'}, 'batteryStatusActual': {'value': 12, 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}}, 'oil': {'oilLife': 'STATUS_GOOD', 'oilLifeActual': 31, 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'tirePressure': {'value': 'STATUS_GOOD', 'timestamp': '04-07-2018 18:37:36'}, 'authorization': 'AUTHORIZED', 'TPMS': {'tirePressureByLocation': {'value': 0, 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'tirePressureSystemStatus': {'value': 'Systm_Activ_Composite_Stat', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'dualRearWheel': {'value': None, 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}, 'leftFrontTireStatus': {'value': '', 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}, 'leftFrontTirePressure': {'value': '', 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}, 'rightFrontTireStatus': {'value': '', 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}, 'rightFrontTirePressure': {'value': '', 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}, 'outerLeftRearTireStatus': {'value': '', 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}, 'outerLeftRearTirePressure': {'value': '', 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}, 'outerRightRearTireStatus': {'value': '', 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}, 'outerRightRearTirePressure': {'value': '', 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}, 'innerLeftRearTireStatus': {'value': '', 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}, 'innerLeftRearTirePressure': {'value': '', 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}, 'innerRightRearTireStatus': {'value': '', 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}, 'innerRightRearTirePressure': {'value': '', 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}, 'recommendedFrontTirePressure': {'value': None, 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}, 'recommendedRearTirePressure': {'value': None, 'status': 'LAST_KNOWN', 'timestamp': '08-12-2017 21:25:26'}}, 'firmwareUpgInProgress': {'value': False, 'timestamp': '06-24-2022 18:03:26'}, 'deepSleepInProgress': {'value': False, 'timestamp': '06-24-2022 18:03:26'}, 'ccsSettings': {'timestamp': '04-21-2017 17:27:00', 'location': -1, 'vehicleConnectivity': -1, 'vehicleData': -1, 'drivingCharacteristics': -1, 'contacts': -1}, 'lastRefresh': '02-16-2023 22:56:53', 'lastModifiedDate': '02-16-2023 22:56:54', 'serverTime': '02-16-2023 23:02:44', 'batteryFillLevel': {'value': 50.0, 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'elVehDTE': None, 'hybridModeStatus': {'value': 'NullState', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'chargingStatus': {'value': 'NotReadyNullState', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'plugStatus': {'value': 0, 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'chargeStartTime': {'value': '01-01-2010 00:00:00', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'chargeEndTime': {'value': '01-01-2010 00:00:00', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'preCondStatusDsply': None, 'chargerPowertype': {'value': 'NotCharging', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'batteryPerfStatus': None, 'outandAbout': {'value': 'PwPckOffTqNotAvailable', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'batteryChargeStatus': {'value': 'NoReportRequest', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'dcFastChargeData': None, 'windowPosition': {'driverWindowPosition': {'value': 'Fully_closed_position', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'passWindowPosition': {'value': 'Fully_closed_position', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'rearDriverWindowPos': {'value': 'Undefined_window_position', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'rearPassWindowPos': {'value': 'Undefined_window_position', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}}, 'doorStatus': {'rightRearDoor': {'value': 'Closed', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'leftRearDoor': {'value': 'Closed', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'driverDoor': {'value': 'Closed', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'passengerDoor': {'value': 'Closed', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'hoodDoor': {'value': 'Closed', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'tailgateDoor': {'value': 'Closed', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'innerTailgateDoor': {'value': 'Closed', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}}, 'ignitionStatus': {'value': 'Off', 'status': 'CURRENT', 'timestamp': '02-16-2023 22:56:54'}, 'batteryTracLowChargeThreshold': None, 'battTracLoSocDDsply': None, 'dieselSystemStatus': None, 'messages': []}

from fordpass-ha.

theOrakle avatar theOrakle commented on June 23, 2024

Just tried with 1.46-Rel2...

Traceback (most recent call last):
  File "/opt/homeassistant/3.10.8/lib/python3.10/site-packages/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform
    await asyncio.shield(task)
  File "/opt/homeassistant/config/custom_components/fordpass/sensor.py", line 34, in async_setup_entry
    if sensor.coordinator.data.get("dieselSystemStatus", {}).get("filterRegenerationStatus"):
AttributeError: 'NoneType' object has no attribute 'get'

from fordpass-ha.

itchannel avatar itchannel commented on June 23, 2024

Can you manually update the sensor.py and replace with the following:
Original:

        elif key == "dieselSystemStatus":
            if sensor.coordinator.data.get("dieselSystemStatus", {}).get("filterRegenerationStatus"):
                sensors.append(sensor)
        elif key == "exhaustFluidLevel":
            if sensor.coordinator.data.get("dieselSystemStatus", {}).get("exhaustFluidLevel"):
                sensors.append(sensor)

Modified:

        elif key == "dieselSystemStatus":
            if sensor.coordinator.data.get("dieselSystemStatus", {}):
                if sensor.coordinator.data.get("dieselSystemStatus", {}).get("filterRegenerationStatus"):
                    sensors.append(sensor)
        elif key == "exhaustFluidLevel":
            if sensor.coordinator.data.get("dieselSystemStatus", {}):
                if sensor.coordinator.data.get("dieselSystemStatus", {}).get("exhaustFluidLevel"):
                    sensors.append(sensor)

from fordpass-ha.

itchannel avatar itchannel commented on June 23, 2024

Save me sending out another pre-release. @theOrakle Thanks for your debug logs, I didn't realise for some people it returns a None value for "dieselSystemStatus" and some people like me it just returns an empty array so wasn't handling it correctly.

from fordpass-ha.

theOrakle avatar theOrakle commented on June 23, 2024

2 min

from fordpass-ha.

itchannel avatar itchannel commented on June 23, 2024

No problems thanks for debugging 👍

from fordpass-ha.

theOrakle avatar theOrakle commented on June 23, 2024

That did it. Clean reload & devices enabled... All good.

Thank YOU for all your work - debugging is easy.

from fordpass-ha.

itchannel avatar itchannel commented on June 23, 2024

Great! I have pushed 1.46 now with those changes.

from fordpass-ha.

ClaymoreTech4 avatar ClaymoreTech4 commented on June 23, 2024

Thank you!~

from fordpass-ha.

itchannel avatar itchannel commented on June 23, 2024

Closing as issue is now fixed in 1.46

from fordpass-ha.

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.