#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# System modules


# Custom modules
from utils.logger import log
from devices import lamp, light
from config.constants import on_off

# Other templates
from templates.basetemplate import BaseTemplate


class Template(BaseTemplate):
    def __init__(self):
        super().__init__()
        self.name = __name__
        self.description = "Switches off all the lamps"

    def content(self, params={}):

        for source in [lamp, light]:
            log.info(
                f"{source.description} found to be {on_off[source.state]}")
            while source.state != False:
                log.debug(f"{source.description} still {on_off[source.state]}")
                source.state = False
            log.info(f"{source.description} is now {on_off[source.state]}")

        return
