File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Expand file tree Collapse file tree 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:
876876 async def set_divert_mode (self , mode : str = "fast" ) -> None :
877877 """Set the divert mode."""
878878 url = f"{ self .url } divertmode"
879-
880879 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 )
882881 raise ValueError
883-
884882 _LOGGER .debug ("Setting divert mode to %s" , mode )
885-
886883 # convert text to int
887884 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 )
892889 if response != "Divert Mode changed" :
893890 _LOGGER .error ("Problem issuing command: %s" , response )
894891 raise UnknownError
Original file line number Diff line number Diff line change @@ -2195,7 +2195,7 @@ async def test_set_divert_mode(
21952195 with pytest .raises (ValueError ):
21962196 with caplog .at_level (logging .DEBUG ):
21972197 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
21992199
22002200 mock_aioclient .post (
22012201 TEST_URL_DIVERT ,
You can’t perform that action at this time.
0 commit comments