Smart homes are becoming increasingly complex with the increase in the number of various sensors and connected devices. This complexity introduces challenges in task scheduling that ensures optimal performance and user satisfaction. Traditional cloud-based solutions, widely used for data processing and task scheduling, face limitations in meeting the real-time demands of smart home applications. To address the challenges inherent in smart home environments, fog computing has emerged as an innovative paradigm for optimizing task scheduling. This paper presents a fog-cloud framework for task scheduling in smart home environments. It also introduces a hybrid algorithm which uses Q-learning and jellyfish search optimizer. The proposed framework classifies the users’ tasks based on their sensitivity to latency. Real-time tasks are allotted to the fog layer, which consists of strategically placed fog computing nodes within the smart home environment, while non-real-time tasks are forwarded to the cloud layer for processing. The hybrid algorithm developed by integrating Q-learning and jellyfish search optimizer is dynamic in nature, ensures minimal latency. The simulation study conducted in MATLAB shows the better performance of Reinforcement Learning based Jellyfish search optimizer (RL-JSO) over existing algorithms in terms of execution time, energy consumption, load ratio and resource utilization metrics.