def _set_time(device: CommonThermostat) -> None: """Set device time.""" # Calling this clears any local temperature override and # reverts to the scheduled temperature. now = dt_util.now() device.time = { "day": now.weekday(), "hour": now.hour, "minute": now.minute, }
def test_calls_post(self, mock_post): tstat = CommonThermostat('192.168.0.1') tstat.set_day_program('cool', 'tue', PROGRAM) mock_post.assert_called_once_with('/tstat/program/cool/tue', json.dumps(PROGRAM).encode('utf-8'))
def test_calls_validate_response(self, mock_validate_response): tstat = CommonThermostat(IP) tstat.reboot() mock_validate_response.assert_called_once_with(RESPONSE_VALUE)
def test_calls_post(self, mock_validate_response, mock_post): tstat = CommonThermostat(IP) tstat.reboot() mock_post.assert_called_once_with(COMMAND, JSON_VALUE)