Beiträge von chriscat

    Could you maybe debug it a little, put your credentials directly in the script and check it with different vins? Basically it's just one api call inside the getCarInfo() method. The result of it is already logged on the console (huge json response). I only have one car so I can't double check.

    The other day, I already tried everything I could think of. But today the test was even simpler:


    1. The widget works for Car A, I confirm it by going in scriptable and run it.

    2. I go to hello smart, which is showing Car A and I change to look at Car B

    3. I go back to scriptable and run the same script for Car A and it fails with following consol logs


    Code
    2023-11-18 14:09:09: Found apiAccessToken.
    2023-11-18 14:09:09: Signing api request with hmac *********
    2023-11-18 14:09:10: status code: 200
    2023-11-18 14:09:10: {"data":null,"code":"8160","httpStatus":"OK","success":false,"hint":null,"sessionId":"***********","message":"Currently no permission to operate"}


    4. I go back to hello smart and switch to car A

    5. The widget works again perfectly

    Noch eine Idee: Irgendwelche besonderen Sonderzeichen im Passwort? Zum Beispiel ein , oder ein ;

    sorry I forgot I had to change my script too because of special characters in the password! I should have shared it and forgot:


    see the change I made here:


    see if adding those

    encodeURIComponent(userName) and encodeURIComponent(password) fixes your issue. My API user password was starting with a '&' and it didn't like that at all.

    chriscat
    Thanks for verification. The temperature is from the inside of the car. It changes here all the time, especially at night (7 degrees last night). If you start the air condition from the app, it should definetly change. That's one reason why I put it there. In a future update, I was thinking about starting the air condition from within the widget (bigger size).

    I see, it will be handy in winter.

    I made it work for 2 cars with this small change https://github.com/marco79cgn/ios-scriptable-widgets/pull/3


    I had to use 2 different users. A given user can access only the latest car that was accessed in the App.


    I also noticed that if a user wasn't used in too long, I have to login with it in the Hello Smart app to make the widget work. Did you notice the same thing with a dedicated API user? needing to logon with hello smart if you haven't used it in too long.



    Next step: I will change the image for each car to be able to recognise them. 2 are blacks, and I will mirror one to make it the UK one

    IMG_1835 2.jpg

    Also, with the address format in France, number would come first. but I'm not bothered by it.

    Indeed. All makes perfect sense. I suppose it’s also why I got the message my 12V battery was low and I should start the car. I never had such a message from hello smart before.

    battery draining by locking the car every few minutes and maintaining the Bluetooth connection from next room.


    All seems to work now. I even tested successfully the location today.


    Thank you


    Is the temperature useful for you? It never gets updated for me. It stayed tonight at 24 and update to 17 only when I started the car

    Sadly I had to remove the widget from my iPhone as I kept hearing the car every 10 minutes or so. the sound the car usually makes when we lock it.


    After stopping the widget the sounds stopped. After adding it back on my iPhone one hour later, the sound came back immediately.


    The weirdest part is that all along the widget was on iPad too and there is no problem there

    Ah, my bad, Sorry. Actually multiple users are not supported yet. Only one user with multiple cars.


    This is because I store the credentials and tokens for the user inside a file in iCloud Drive in order to cache them. This way I can reuse the tokens as long as possible without having to log in again.


    Please do the following:

    • delete all your Smart widgets from the home screen (to stop them running automatically every few minutes)
    • go to your iCloud Drive Scriptable folder (e.g. in the Files app) and delete the file smart-credentials.json
    • setup one script/widget again and see if it works (it should!)

    After that you can set up another car but it has to be the same user! All scripts/widgets use the same user tokens as of now.

    I wonder if with this method it means we don't have to fear to setup also on iPad and Macbook in addition to iPhone, with same credentials. Because iCloud sync the file between devices.


    When you said "setup one script/widget". Do you mean one script per widget? I like it better if I plan to re-use it on more devices.


    I can get only one working at a time. one or the other.


    After a few tries, it seems it's the lastest car I used on the app. it would mean it's impossible to avoid this issue. I would be able to get only the one I used last in the app for each user


    IMG_62E2C592F6CA-1.jpeg    IMG_23023BDD0FD9-1.jpeg


    Basically you don't need one user per car in order to setup multiple widgets as long as your single user has access to all cars.


    So there are two options for you (I'd prefer the first):

    1. leave the script as it is (from github) and set up the parameters only in the widget configuration: username;password;vin (works as long as there is no semicolon in your password)
    2. set up the script multiple times in Scriptable (with different names) and hard code your user, pass and vin in each script (line 21-23) - in this case, leave the widget params empty in the configuration!

    I tried with both solutions. Neither worked. I suspect my users are blocked but I still can connect into the app


    Using twice the same user, I thought it might explain why i had credentials error. You said one account can connect only once so I tried with 2.

    It worked for the first car. But when I added a 2nd car, it never worked and the 1st started failing too.


    I’ll give it a couple of hours and see again. Maybe just a temporary block because I logon onto the app to share the cars.

    chriscat

    When I got the car in late April, it worked for a few months without a problem. But yes, obviously they broke this functionality somehow. Really frustrating, so many bugs! :rolleyes:


    If you set up the widget on your homescreen by just using the parameters, you can setup multiple widgets simply by using different vins - no need to touch the script at all. So it's both more secure and more flexible.

    Thanks. actually the trick was just to use the VIN for the 2nd car. I was looking for an index.


    I created a 2nd API user so that I could get 2 widgets at the same times.


    Do we have to wait for a while after we connected in the app with that user to accept the sharing? I lost access also to the 1st one which worked before.

    IMG_1827.jpeg

    Thanks for your feedback. I realized in your screnshot that the current position of your car seems to be unavailable. As far as I know, this happens if the user didn't accept the terms and conditions checkboxes - or when the car forgot about it and logged you out.
    Could you please double check if you can see the position of your car in the official Hello Smart App when logging in with the same user you used for the script?

    I will add a more pleasing output in case this happens (instead of undefined). :)

    do you mean you can generally see the position of your cars in Germany?


    It's a big complain in France, we rarely can see the location of our smart #1. It worked well in July, the first month, then stopped one day for everyone. We see it from time to time, particularly if we are driving it.


    Next time we can see the location of the car for a few minutes I will let you know if the widget is not showing it.




    Would you be able to point me at the line to change in order to target my 2nd and 3rd car? I will try to have 2 widgets showing at the same time. one for each car.

    I'm not seeing any obvious place in your Javascript with a position.


    Edit: was obvious, I just had to use a different VIN