Now, the wallbox upstream library accepts modification on the price, so it would be amazing being able to modify the price from HA
The use case:
I would like to create an automation to dinamically set the charging price based on an input from another module (pvpc from spain).
The Voluntary Price for the Small Consumer tariff (the PVPC tariff) is the electricity rate you are on if you are in the regulated market and have a variable energy price: it changes every hour, 365 days a year. To be on the PVPC tariff you will be with one of the 5 benchmark energy companies (the traditional energy suppliers) in the regulated market.
I just took a few minutes to go over your code. In general, seems OK, don’t forget to change the wallbox package version in the manifest (one of the files in the component directory, and use hassfest (I think) to update the requirements file.
Also, give it a test-run, you should be able to run it locally and it should work. Finally, when tested and succesfull, home assistant requires automatic tests of your code, you should check with pytest whether test coverage is still OK after this code has been added. I might have some time this weekend to do a proper review and test it myself.
I do get one unit test failure in an existing test I can’t fully comprehend yet.
If you could have a look, must be something simple. It is this one:
========================================================================== short test summary info ==========================================================================
FAILED tests/components/wallbox/test_number.py::test_wallbox_number_class_connection_error - Failed: DID NOT RAISE <class 'ConnectionError'>
Results (0.21s):
2 passed
1 failed
- tests/components/wallbox/test_number.py:64 test_wallbox_number_class_connection_error
For manual testing, I ran HASS locally in dev container. Integrated with my wallbox account and used this manually triggered automation:
alias: New Automation
description: ""
trigger:
- platform: event
event_type: ""
condition: []
action:
- device_id: [redacted]
domain: number
entity_id: [redacted]
type: set_value
value: 0.3
mode: single
The changed value (was 0.38) was visible in the testing HASS instance immediately. On my production it needed to timeout to the next sync. The logic to change this number triggers a refresh of the sensor value. So on the hass instance running this integration the update is near immediate.