Git Product home page Git Product logo

Comments (14)

jasonacox avatar jasonacox commented on August 18, 2024 1

Found the issue. The code was preventing anything <5 and the exception was being raised instead of handled. I updated to log the error for any value outside range of 0-100.

Give this container a try and let me know if it addresses this issue:

jasonacox/pypowerwall:0.8.4t54-beta

from pypowerwall.

jasonacox avatar jasonacox commented on August 18, 2024

Good question. I'll have to take a look.

from pypowerwall.

spoonwzd avatar spoonwzd commented on August 18, 2024

It now accepts values <5, however the API response and queried reserve after it's set still says it's set to 5.

{"set_backup_reserve_percent": {"backup_reserve_percent": 5.0, "din": "1099752-01-B--T17K0001234", "result": "Updated"}, "set_operation": {"real_mode": "self_consumption", "din": "1099752-01-B--T17K0001234", "result": "Updated"}}

from pypowerwall.

spoonwzd avatar spoonwzd commented on August 18, 2024

Update: Setting to 1 works, just not 0. If you set 0, it doesn't change anything and just reports back the current setting.

I'm content with 1. I suspect it's the Tesla API not allowing 0?

from pypowerwall.

jasonacox avatar jasonacox commented on August 18, 2024

I don't know why I didn't notice that. You are right. I figured it out. It will take 1 but for 0, it needs to be set to False, evidently indicating that you want to disable reserve. I updated the code to handle this condition if you want to test:

jasonacox/pypowerwall:0.8.4t54-beta2

Interesting note: The Tesla App will let you set it to 0, but above zero, it goes directly to 5. However, our API seems to let me set it to 1, 2, 3 and 4 as well.

from pypowerwall.

spoonwzd avatar spoonwzd commented on August 18, 2024

Done some more testing. Setting value=1 sets the value to 1 as expected, but setting 0 sets the value to 1.0 ?

{"set_backup_reserve_percent": {"backup_reserve_percent": 1, "din"

{"set_backup_reserve_percent": {"backup_reserve_percent": 1.0, "din"

I'm not really fussed about setting value to 0 as 1 is close enough, but the behaviour doesn't seem to match your expectation.

Not sure what the CANCEL lines are about either in the logs?

04/19/2024 03:00:08 AM [proxy] [INFO] Control Commands Activating - WARNING: Use with caution!
04/19/2024 03:00:09 AM [proxy] [INFO] Control Mode Enabled: Cloud Mode Connected
04/19/2024 04:34:01 AM [proxy] [INFO] Control Command: Set Reserve to 55
04/19/2024 06:33:55 AM [proxy] [INFO] Control Command: Set Reserve to 30
04/19/2024 07:00:06 AM [proxy] [INFO] Control Command: Set Reserve to 1
 CANCEL 

 CANCEL 

from pypowerwall.

jasonacox avatar jasonacox commented on August 18, 2024

Thanks @spoonwzd - Yes, my code should be setting it to "False" instead of "0". Just to confirm, you are using the latest container? jasonacox/pypowerwall:0.8.4t54-beta2

from pypowerwall.

spoonwzd avatar spoonwzd commented on August 18, 2024

Double-checked. Defo using jasonacox/pypowerwall:0.8.4t54-beta2

The console logs show me setting it to 0, but the API response is saying 1.0

from pypowerwall.

jasonacox avatar jasonacox commented on August 18, 2024

Ok, I wasn't able to reproduce but perhaps there is an edge case I'm missing.

from pypowerwall.

spoonwzd avatar spoonwzd commented on August 18, 2024

Let me know if you need anything further to assist with troubleshooting

from pypowerwall.

jasonacox avatar jasonacox commented on August 18, 2024

04/19/2024 07:00:06 AM [proxy] [INFO] Control Command: Set Reserve to 1
CANCEL

ah... The cancel means it is crashing. Can you turn on debug mode to see if we can figure out why? Edit pypowerwall.env:

PW_DEBUG=yes

from pypowerwall.

jasonacox avatar jasonacox commented on August 18, 2024

I find the issue @spoonwzd ! If you are willing, please try this one:

jasonacox/pypowerwall:0.8.4t54-beta5

Also, now supports POST:

curl -X POST -d "value=20&token=1234" http://localhost:8675/control/reserve
curl -X POST -d "value=backup&token=1234" http://localhost:8675/control/mode

from pypowerwall.

spoonwzd avatar spoonwzd commented on August 18, 2024

Sorry for the delay. I did enable debug but the logs were being spammed by my repeating polling and I never go around to stopping them :/

Not sure if it's working or not until battery levels drop, but at least the response is different now when setting 0!

{"set_backup_reserve_percent": {"backup_reserve_percent": false, "din": "1099752-01-B--T17K0001234", "result": "Updated"}, "set_operation": {"real_mode": "self_consumption", "din": "1099752-01-B--T17K0001234", "result": "Updated"}}

Additionally I tried using POST as the method, but it doesn't seem to work. I get the output:

"{"unauthorized": "Control Command Token Invalid"}"

Setting the method back to GET makes it behave again.

from pypowerwall.

jasonacox avatar jasonacox commented on August 18, 2024

Thanks @spoonwzd !

You can get the current setting by using the API call but omitting the value data.

curl -X POST -d 'token=1234' http://localhost:8675/control/reserve

Also, for the POST test, I suspect you have special characters in your token. I realized that I use double-quotes instead of single quotes in my examples so bash will translate any special characters like $. Can you try this:

curl -X POST -d 'value=20&token=1234' http://localhost:8675/control/reserve

from pypowerwall.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.