File tree 2 files changed +6
-9
lines changed
2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -876,19 +876,16 @@ async def set_led_brightness(self, level: int) -> None:
876
876
async def set_divert_mode (self , mode : str = "fast" ) -> None :
877
877
"""Set the divert mode."""
878
878
url = f"{ self .url } divertmode"
879
-
880
879
if mode not in ["fast" , "eco" ]:
881
- _LOGGER .error ("Invalid value for charge_mode : %s" , mode )
880
+ _LOGGER .error ("Invalid value for divert mode : %s" , mode )
882
881
raise ValueError
883
-
884
882
_LOGGER .debug ("Setting divert mode to %s" , mode )
885
-
886
883
# convert text to int
887
884
new_mode = divert_mode [mode ]
888
- data = "divertmode=" + str ( new_mode )
889
- response = await self . process_request (
890
- url = url , method = "post" , data = data
891
- ) # noqa: E501
885
+
886
+ data = f"divertmode= { new_mode } "
887
+
888
+ response = await self . process_request ( url = url , method = "post" , rapi = data )
892
889
if response != "Divert Mode changed" :
893
890
_LOGGER .error ("Problem issuing command: %s" , response )
894
891
raise UnknownError
Original file line number Diff line number Diff line change @@ -2195,7 +2195,7 @@ async def test_set_divert_mode(
2195
2195
with pytest .raises (ValueError ):
2196
2196
with caplog .at_level (logging .DEBUG ):
2197
2197
await test_charger_new .set_divert_mode ("test" )
2198
- assert "Invalid value for charge_mode : test" in caplog .text
2198
+ assert "Invalid value for divert mode : test" in caplog .text
2199
2199
2200
2200
mock_aioclient .post (
2201
2201
TEST_URL_DIVERT ,
You can’t perform that action at this time.
0 commit comments