valiquette / homebridge-my-wallbox

Homebridge support for locking/unlocking Wallbox EV charger
MIT License
4 stars 3 forks source link

Error creating battery service. #18

Closed amrmhmohamed closed 1 year ago

amrmhmohamed commented 1 year ago

Thank you for this plugin!

I have NOT done the migration to the new Homekit system in iOS.

Homebridge version: v1.6.0

I double checked all the values. I have the location blank (only one charger). I'm so close, the logs show it logs in and finds the correct charger, but it seems to fail adding the battery service?

[03/01/2023, 19:44:14] [Pulsar Plus US SN ######] Found account for * ***** [03/01/2023, 19:44:14] [Pulsar Plus US SN ######] Found device at the location: Family [03/01/2023, 19:44:14] [Pulsar Plus US SN ######] Wallbox platform finished loading [03/01/2023, 19:44:15] [Pulsar Plus US SN ######] Adding lock for Pulsar Plus US SN ###### charger [03/01/2023, 19:44:15] [Pulsar Plus US SN ######] Adding battery service for Pulsar Plus US SN ###### charger [03/01/2023, 19:44:17] [Pulsar Plus US SN ######] Error updating status TypeError: Cannot read properties of undefined (reading 'includes') at /var/lib/homebridge/node_modules/homebridge-my-wallbox/wallboxplatform.js:224:59 at Array.filter () at wallboxPlatform.calcBattery (/var/lib/homebridge/node_modules/homebridge-my-wallbox/wallboxplatform.js:224:22) at wallboxPlatform.updateStatus (/var/lib/homebridge/node_modules/homebridge-my-wallbox/wallboxplatform.js:278:31) at wallboxPlatform.getStatus (/var/lib/homebridge/node_modules/homebridge-my-wallbox/wallboxplatform.js:246:10) at processTicksAndRejections (node:internal/process/task_queues:95:5)

valiquette commented 1 year ago

It looks like I may have a bug in how the startup handles this part of the config but I believe this is tied to your configuration, Specifically the part around the car. If this section is blank then it should start correctly or make sure the "Name of your Charger" matches the name from Wallbox, from you log snippet it looks like it should be "Pulsar Plus US SN ######" Feel free to copy in that section of your config if you still have trouble.

amrmhmohamed commented 1 year ago

thank you, that was my mistake for not reading carefully.

Now I see this when it is trying to make the switch:

[03/01/2023, 22:59:57] [Pulsar Plus US SN ######] Adding battery service for Pulsar Plus US SN ###### charger 
[03/01/2023, 22:59:57] [Pulsar Plus US SN ######] Adding switch for Pulsar Plus US SN ###### charger 
[03/01/2023, 22:59:58] [homebridge-my-wallbox] This plugin generated a warning from the characteristic 'Battery Level': characteristic value expected valid finite number and received "NaN" (number). See https://homebridge.io/w/JtMGR for more info.
amrmhmohamed commented 1 year ago

Even with a very simplified config:

        {
            "name": "Pulsar Plus US SN ######",
            "email": "am********@gmail.com",
            "password": "***",
            "refreshRate": 24,
            "liveRefreshTimeout": 2,
            "liveRefreshRate": 20,
            "locationName": "Family",
            "showControls": 0,
            "socSensor": false,
            "platform": "wallbox"
        }

I get this error:

[03/01/2023, 23:22:59] [Pulsar Plus US SN ######] Adding lock for Pulsar Plus US SN ###### charger 
[03/01/2023, 23:23:00] [Pulsar Plus US SN ######] Error updating status TypeError: Cannot read properties of undefined (reading 'getCharacteristic')
    at wallboxPlatform.calcBattery (/var/lib/homebridge/node_modules/homebridge-my-wallbox/wallboxplatform.js:222:43)
    at wallboxPlatform.updateStatus (/var/lib/homebridge/node_modules/homebridge-my-wallbox/wallboxplatform.js:278:31)
    at wallboxPlatform.getStatus (/var/lib/homebridge/node_modules/homebridge-my-wallbox/wallboxplatform.js:246:10)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Do you get your battery level in your wallbox app? I have a VW ID.4 and I never see my state of charge in my wallbox app. Maybe you're always expecting it to be there but in some cases it may not be there?

amrmhmohamed commented 1 year ago

It took me some time to realize that if I specify a car and charger, that the log message about the battery level and NaN is just a warning. I see that it is working in the Home App. Closing this issue. Thanks for the support! I'd be happy to beta test for you in the future.