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

[Hyundai] maxRange is undefined #7

Closed
milhaus opened this issue Feb 23, 2021 · 10 comments · Fixed by #9 or #14
Closed

[Hyundai] maxRange is undefined #7

milhaus opened this issue Feb 23, 2021 · 10 comments · Fixed by #9 or #14
Labels
bug Something isn't working

Comments

@milhaus
Copy link

milhaus commented Feb 23, 2021

Describe The Bug:
This error pops up in the logs every time it checks. I've tried plugging in different values, swapping the order of maxRange and VIN so I could make sure there weren't linefeed/whitespace issues with the value, making it a string so I could append "mi" to it. Nothing works to remove the error. Other integer values in the config are fine. The only thing I get in homekit from the plugin is locks and on/off. Vehicle is a 2021 Kona EV.

To Reproduce:
This happens automatically with each check.

Expected behavior:
No error in logs. Charge level reported in HomeKit

Logs:

[2/23/2021, 2:01:53 PM] [Hyundai] maxRange is undefined
[2/23/2021, 2:11:54 PM] [Hyundai] maxRange is undefined
[2/23/2021, 2:21:53 PM] [Hyundai] maxRange is undefined
[2/23/2021, 2:31:53 PM] [Hyundai] maxRange is undefined

Plugin Config:

{
            "credentials": {
                "username": "[redacted]",
                "password": "[redacted]",
                "region": "US",
                "pin": "[redacted]"
            },
            "vehicles": [
                {
                    "vin": "[redacted]",
                    "maxRange": 258
                }
            ],
            "remoteStart": {
                "cool": false,
                "heat": false,
                "defrost": false,
                "igniOnDuration": 15
            },
            "refreshInterval": 600,
            "platform": "Hyundai"
        }

Environment:

  • Plugin Version: 1.2.11
  • Homebridge Version: 1.3.1 and a few prior
  • Node.js Version: 14.15.5
  • NPM Version: 6.14.11
  • Operating System: Debian Buster
@milhaus milhaus added the bug Something isn't working label Feb 23, 2021
@athal7
Copy link
Collaborator

athal7 commented Feb 24, 2021

Can you run homebridge in debug mode? Want to see what the status update payload looks like:

https://github.com/athal7/homebridge-hyundai-bluelink/blob/7d60d51f1fe770fa5b9cde32d023b7be6dd3f561/src/platformAccessory.ts#L31

@milhaus
Copy link
Author

milhaus commented Feb 24, 2021

Oh, good hunch. Looks like range is undefined in the update payload.

[2/23/2021, 6:00:40 PM] [Hyundai] Received status update {
  chassis: {
    hoodOpen: false,
    trunkOpen: false,
    locked: true,
    openDoors: {
      frontRight: false,
      frontLeft: false,
      backLeft: false,
      backRight: false
    },
    tirePressureWarningLamp: {
      rearLeft: false,
      frontLeft: false,
      frontRight: false,
      rearRight: false,
      all: false
    }
  },
  climate: {
    active: false,
    steeringwheelHeat: false,
    sideMirrorHeat: false,
    rearWindowHeat: false,
    defrost: false,
    temperatureSetpoint: 'LO',
    temperatureUnit: 1
  },
  engine: {
    ignition: false,
    adaptiveCruiseControl: false,
    range: undefined,
    charging: false,
    batteryCharge12v: 85,
    batteryChargeHV: 85
  }
}
[2/23/2021, 6:00:40 PM] [Hyundai] Vehicle is Locked
[2/23/2021, 6:00:40 PM] [Hyundai] maxRange is undefined
[2/23/2021, 6:00:40 PM] [Hyundai] Vehicle is Off

@athal7
Copy link
Collaborator

athal7 commented Feb 24, 2021

Thanks! We may need to bring this over to the bluelinky library, since the type definition they have claims engine.range will always be a number https://github.com/Hacksore/bluelinky/blob/039a0c25c19666fed9c38d06b80c80e56e27e5cd/src/interfaces/common.interfaces.ts#L41

@milhaus
Copy link
Author

milhaus commented Feb 24, 2021

It would be timely. Looks like they're actively working on engine.range right now:

Hacksore/bluelinky@c326c3f#diff-4bc921cf635defe83396ed691d13ea4c47bd9ed50241618e2cc3a802aa05d03aL274

My first instinct for now on this side would be validation, maybe around:
https://github.com/athal7/homebridge-hyundai-bluelink/blob/7d60d51f1fe770fa5b9cde32d023b7be6dd3f561/src/services/range.ts#L30

But that would probably be premature before cluing bluelinky in because who knows what engine.range value would be in the undefined case once they decide how they'd like to handle it.

athal7 added a commit that referenced this issue Mar 8, 2021
@athal7 athal7 closed this as completed in #9 Mar 8, 2021
athal7 added a commit that referenced this issue Mar 8, 2021
* Update bluelinky to 6.0.1

Fixes #7

* Bump version
@milhaus
Copy link
Author

milhaus commented Mar 8, 2021

#9 does not fix this for me. I confirmed bluelinky in the plugin was v6.0.1 and even went as far as to reboot the server homebridge is running on.

@milhaus
Copy link
Author

milhaus commented Mar 8, 2021

Ran homebridge in debug mode and got the same undefined value in the response payload for range as listed above.

@athal7 athal7 reopened this Mar 9, 2021
@athal7
Copy link
Collaborator

athal7 commented Mar 9, 2021

Will wait for Hacksore/bluelinky#106 to be resolved

@athal7
Copy link
Collaborator

athal7 commented Apr 26, 2021

@milhaus all set here?

@milhaus
Copy link
Author

milhaus commented Apr 26, 2021

Oddly I'm still getting that error. homebridge-hyundai-bluelink v1.3.2, node v14.16.1, npm v7.10.0 on debian 10.

I notice bluelinky closed out 106 but it wasn't listed in release notes for 7.x

I just restarted homebridge to get fresh results and got the undefined error. As a sanity check I did an npm list in the plugins node-modules directory and noticed some busted dependencies. So I did an npm update and restarted homebridge and now I'm getting exciting new errors. I don't know if I just messed up all the perms (forgot I was root) and that's the cause of new errors.

@athal7
Copy link
Collaborator

athal7 commented Apr 27, 2021

Ah it looks like the associated fix is in bluelinky 7.2, but the dependency here is 7.1. Will release an update with that dependency bumped shortly

athal7 added a commit that referenced this issue Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants