jonasbkarlsson / ev_smart_charging

Electric vehicle smart charging for Home Assistant.
MIT License
140 stars 19 forks source link

Negative Electricity price limit not allowed #175

Closed janneho closed 10 months ago

janneho commented 1 year ago

Version of the custom_component

Version 1.8.0

Describe the bug

I have automation that sets Electricity price limit to last known price tomorrow. Tomorrows price is -0,12c/kWh. It is not permitted to use negative price as limit

Failed to call service number/set_value. Value -0.12 for number.ev_smart_charging_electricity_price_limit is outside valid range 0.0 - 10000.0

Is it possible to change range to something like -10000.0 - 10000? No harm for anyone there if negative numbers are permitted.

jonasbkarlsson commented 1 year ago

That should be possible. Need to check that it doesn't cause any side-effects.

janneho commented 1 year ago

Trying to make around this.

Made these changes, it looks like it scheduling fine but have to try if charging works...

https://github.com/jonasbkarlsson/ev_smart_charging/blob/main/custom_components/ev_smart_charging/number.py#L105 _attr_native_min_value = 0.0 --> _attr_native_min_value = -10000.0

and https://github.com/jonasbkarlsson/ev_smart_charging/blob/main/custom_components/ev_smart_charging/helpers/coordinator.py#L301 elif apply_limit and item["value"] > max_price > 0.0: --> elif apply_limit and item["value"] > max_price:

Is there something that i am missing?

jonasbkarlsson commented 10 months ago

Sorry for slow response, but now this is included in v1.9.0-dev2.

jonasbkarlsson commented 10 months ago

Part of release v1.9.0.