'''
Created on 19 janv. 2026

@author: denis
'''
from django.core.management.base import BaseCommand
from relay import tasks as relay_tasks
from home import tasks as mqtt_tasks


class Command(BaseCommand):
    help = "Démarre les tâches Celery."

    def add_arguments(self, parser):
        super(Command, self).add_arguments(parser)
        #parser.add_argument("--task", action="store", dest="task", default='start_all')

    def handle(self, *args, **options):  # @UnusedVariable
        #task = options['task']
        try:
            mqtt_tasks.start_mqtt_worker.delay()  # @UndefinedVariable
            print("task start_mqtt_worker ...")

            relay_tasks.relay_start_all.delay()   # @UndefinedVariable
            print("task relay_start_all ...")

        except Exception as e:
            print(e)

