Announcement

Collapse
No announcement yet.

Charge limit not changing when run via event

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Charge limit not changing when run via event

    Hi there,
    My main use case for this plugin is to automatically change the charge limit to 80% over night but 90% tiring the day (to make use of solar energy).

    If I change the charge limit directly on the device it works as expected. If however, if I attempt to change it from an event I get an error message, please see below pics.

    Has anyone come across this? I need is a bomb proof way of change between 80% and 90% at set times!

    Click image for larger version

Name:	Screenshot 2019-06-20 at 11.33.56.png
Views:	84
Size:	57.4 KB
ID:	1311510

    Click image for larger version

Name:	Screenshot 2019-06-20 at 11.33.14.png
Views:	72
Size:	34.7 KB
ID:	1311511


  • #2
    Unfortunately there isn't really a "bomb proof" way to do anything with the internal Tesla API. What I recommend is two events:

    1. Set Night Charge Limit
    • IF time is at 21:00:00
    • AND location is home
    • THEN
      • Wake the vehicle
      • Wait 2 minutes
      • Set the charge limit to 80% (The wake before hand isn't strictly necessary, but because the car often fails to respond in a timely manner, I do this in my events just to help reduce the likelihood of failure.)
      • Wait 1 minute
      • Run Another Event "Check Night Charge Limit" (only if the conditions are true)
    2. Check Night Charge Limit
    • IF manually triggered
    • AND charge limit is not 80
    • THEN
      • Notify me that the charge limit didn't change

    You could even go more circular and have event 2 kick off the "Set Night Charge Limit" event again, but I would also start throwing in a counter and only execute if the counter is below some "Retry" limit, which also means another event to reset the counter.

    Comment


    • #3
      Originally posted by Stevemeck View Post
      Hi there,
      My main use case for this plugin is to automatically change the charge limit to 80% over night but 90% tiring the day (to make use of solar energy).

      If I change the charge limit directly on the device it works as expected. If however, if I attempt to change it from an event I get an error message, please see below pics.

      Has anyone come across this? I need is a bomb proof way of change between 80% and 90% at set times!

      Click image for larger version

Name:	Screenshot 2019-06-20 at 11.33.56.png
Views:	84
Size:	57.4 KB
ID:	1311510

      Click image for larger version

Name:	Screenshot 2019-06-20 at 11.33.14.png
Views:	72
Size:	34.7 KB
ID:	1311511
      Specific to the "already set" error message, I will need all the information requested in the sticky thread "Having problems?".

      Comment


      • #4
        Thanks very much for the reply. I'll send the error report separately.

        Regarding events I will initiate by time and location as you suggest, however I'm not able to set location to 'Home'. It seems I have to set Location to '1' which is it's value when it's string value is 'Home'. Is that what you'd expect?

        Comment


        • #5
          No, that's definitely not what I'd expect - and it's not what I'm seeing on my own system. Can you share with me your location page (with coords blurred/blacked out) and the Status Graphics page for the location device?

          Comment


          • #6
            Click image for larger version  Name:	Screenshot 2019-06-21 at 18.12.15.png Views:	0 Size:	25.6 KB ID:	1311744\

            Click image for larger version  Name:	Screenshot 2019-06-21 at 18.13.55.png Views:	0 Size:	115.6 KB ID:	1311745

            Click image for larger version

Name:	Screenshot 2019-06-21 at 18.15.45.png
Views:	68
Size:	98.1 KB
ID:	1311746

            Comment


            • #7
              Ok, for some reason it's not building out the status value pairs correctly on your location device. Can you do the following?
              • Turn the plugin log file level to TRACE
              • Add a 2nd "dummy" location of some sort
              • Check the value status pair list (the top half of the window in the screenshot above) and see if it still just shows -1 or if it has more entries?
              • Turn the plugin log file level back to whatever it was before
              If everything turned out ok, you can stop there with my apologies that it didn't work the first time. If it doesn't update, send me the log file... (steve@skware.net)

              Comment


              • #8
                OK, that seems to have forced the creation of the entries. Home is now displaying correctly in the event.

                Comment


                • #9
                  Just sent you a log file regarding error message. I see this time the error message is "could not wake buses".

                  Comment


                  • #10
                    Originally posted by Stevemeck View Post
                    Just sent you a log file regarding error message. I see this time the error message is "could not wake buses".
                    That's a totally different issue. That's Tesla telling me that it couldn't wake the car up to give it the command. I found other Tesla API projects where this has been encountered and they added some retry logic, so I also built in some retry logic if this result comes back. I'll submit the new version tonight as long as I don't run into any problems in testing.

                    That doesn't address your issue of the initial charge limit command failing because it thought it was already set to that value...

                    Comment


                    • #11
                      ... and no sooner did I start testing than I found the issue with that, too!

                      Comment


                      • #12
                        Great! I've just updated to latest version. Will report back..

                        Comment


                        • #13
                          OK, still getting same error...

                          Command 'set_charge_limit' failed: '{"response":{"reason":"already_set","result":false}}'

                          Any ideas?

                          Comment


                          • #14
                            Oddly, if I change the charge limit from the device itself it seems to work reliably. It seems to be only when changing via an event that it fails.

                            Comment


                            • #15
                              Heres the log running the event (that fails) followed by a successful manual adjustment directly from the device...
                              Jun-26 18:23:58 Device Control Device: Downstairs Garage Charge Limit to Daily (1132) by/from: CAPI Control Handler
                              Jun-26 18:23:37 Tesla Vehicles Command 'set_charge_limit' failed: '{"response":{"reason":"already_set","result":false}}'
                              Jun-26 18:23:28 Device Control Device: Downstairs Garage Charge Limit to 90% (90)

                              Comment

                              Working...
                              X