File tree Expand file tree Collapse file tree 2 files changed +5
-13
lines changed
homeassistant/components/shelly Expand file tree Collapse file tree 2 files changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -749,17 +749,13 @@ def hvac_action(self) -> HVACAction:
749749
750750 async def async_set_temperature (self , ** kwargs : Any ) -> None :
751751 """Set new target temperature."""
752- await self .call_rpc (
753- "Thermostat.SetConfig" ,
754- {"config" : {"id" : self ._id , "target_C" : kwargs [ATTR_TEMPERATURE ]}},
752+ await self .coordinator .device .climate_set_target_temperature (
753+ self ._id , kwargs [ATTR_TEMPERATURE ]
755754 )
756755
757756 async def async_set_hvac_mode (self , hvac_mode : HVACMode ) -> None :
758757 """Set hvac mode."""
759- mode = hvac_mode in (HVACMode .COOL , HVACMode .HEAT )
760- await self .call_rpc (
761- "Thermostat.SetConfig" , {"config" : {"id" : self ._id , "enable" : mode }}
762- )
758+ await self .coordinator .device .climate_set_hvac_mode (self ._id , str (hvac_mode ))
763759
764760
765761class RpcBluTrvClimate (ShellyRpcEntity , ClimateEntity ):
Original file line number Diff line number Diff line change @@ -665,9 +665,7 @@ async def test_rpc_climate_hvac_mode(
665665 )
666666 mock_rpc_device .mock_update ()
667667
668- mock_rpc_device .call_rpc .assert_called_once_with (
669- "Thermostat.SetConfig" , {"config" : {"id" : 0 , "enable" : False }}
670- )
668+ mock_rpc_device .climate_set_hvac_mode .assert_called_once_with (0 , str (HVACMode .OFF ))
671669 assert (state := hass .states .get (entity_id ))
672670 assert state .state == HVACMode .OFF
673671
@@ -717,9 +715,7 @@ async def test_rpc_climate_set_temperature(
717715 )
718716 mock_rpc_device .mock_update ()
719717
720- mock_rpc_device .call_rpc .assert_called_once_with (
721- "Thermostat.SetConfig" , {"config" : {"id" : 0 , "target_C" : 28 }}
722- )
718+ mock_rpc_device .climate_set_target_temperature .assert_called_once_with (0 , 28 )
723719 assert (state := hass .states .get (entity_id ))
724720 assert state .attributes [ATTR_TEMPERATURE ] == 28
725721
You can’t perform that action at this time.
0 commit comments