Closed y-mishchenko closed 2 years ago
This doesn't seem to connect to the Ford api?
This doesn't seem to connect to the Ford api?
How do you mean? I have simply checked the JSON which your code gets from the API and noted this section:
"chargingStatus":{ "value":"NotReady", "status":"CURRENT", "timestamp":"07-10-2022 16:21:24" }, "plugStatus":{ "value":0, "status":"CURRENT", "timestamp":"07-10-2022 16:21:24" },
So my code simply uses what is already available.
Ah. I see. So when the vehicle is charging, it enables the occupancy sensor. Have you tried with the programmable switch? It is in the latest version. 98b17ca84e71f4eaadc2e0e909b42701160a1c3c
The programmable switch does not work for me as it never gets into "ChargingAC" state because my power socket is disabled. I have made my sensor to be controlled by the same configuration switch (the one which enables the programmable switch).
In other words I need to differentiate between: "plugged" and "charging". My car can be plugged but not charging (as the socket is disabled).
Interesting! I'll play around with this and get back to you if I have any questions. Thanks for the PR!
@y-mishchenko, I made a few changes to the PR. Namely, I like your implementation of the occupancy sensor better than the programmable switch, so I converted the charging switch to that as well. And of course Ford broke some other API calls, so I fixed those here as well.
Let me know if this works for you and I'll merge it into master.
@Brandawg93, this works for me, thank you!
@Brandawg93 , I have just tried the latest changes. I does not work for me. It fails while adding accessory. I have added a debug message which prints the vehicle JSON. As you see it does not contain either the nickName nor the model
[7/24/2022, 11:46:32 PM] [FordPass] Add vehicle : { "VIN": "W****", "nickName": "", "tcuEnabled": true, "isASDN": false }
(node:2131) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: Accessories must be created with a non-empty displayName.
at new Accessory (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:421:11)
at new PlatformAccessory (/usr/local/lib/node_modules/homebridge/src/platformAccessory.ts:70:9)
at FordPassPlatform.
That could be a cache issue. I changed the vehicle details api call because the other one is always down for some reason.
@Brandawg93 , There were few issues , I have committed some changes: Generate accessory name in the "old" style: "[year] Ford [model]" There was a bug in getVehicles: array elements are not updated by assigning new values to the loop variable Services were registered by name via FordAccessory which added accessory name to the service ID, so homebridge native getServiceById did not work
Hi, I have an outdoor power socket. The socket is disabled by default as I do not want strangers to use it. I only enable it when I plug my car into it. Currently I need to remember to do that. Instead I can create an automation which enables the socket when the car reports that it is plugged.
It seems to work for my Kuga 2021 (in Germany). So perhaps it might be helpful for other people like me.
Regards, Yury.