# Path: mqtt_as/config.py
# def ledfunc(pin):
#     def func(v):
# def ledfunc(led, init):
#     def func(v):


import gc
import ubinascii
import uasyncio as asyncio
import usocket as socket
import ustruct as struct
from mqtt_as import MQTTClient, config
from machine import Pin, unique_id, freq
from network import WLAN, STA_IF, AP_IF
from syncom import SynCom
from status_values import *  # Numeric status values shared with user code.
        self.dprint('Time received: ', t, ' from:', host)
        return t

    async def wifi_han(self, state):
        if state:
            self.channel.send(argformat(STATUS, WIFI_UP))
        else:
            self.channel.send(argformat(STATUS, WIFI_DOWN))
        blue(not state)
        await asyncio.sleep(1)

    async def conn_han(self, _):
        for topic, qos in self.subscriptions.items():
            await self.subscribe(topic, qos)

    def subs_cb(self, topic, msg, retained):
        self.channel.send(argformat(SUBSCRIPTION, topic.decode('UTF8'), msg.decode('UTF8'), retained))

class Channel(SynCom):
    def __init__(self):
        mtx = Pin(14, Pin.OUT)              # Define pins
        mckout = Pin(15, Pin.OUT, value=0)  # clocks must be initialised to 0
        mrx = Pin(13, Pin.IN)
        mckin = Pin(12, Pin.IN)
        super().__init__(True, mckin, mckout, mrx, mtx, string_mode = True)
        self.cstatus = False  # Connection status
        self.client = None

# Task runs continuously. Process incoming Pyboard messages.
# Started by main_task() after client instantiated.

# Path: mqtt_as/config.py
# def ledfunc(pin):
#     def func(v):
# def ledfunc(led, init):
#     def func(v):


# Path: bridge/esp8266/mqtt.py
import gc
import ubinascii
import uasyncio as asyncio
import usocket as socket
import ustruct as struct
from mqtt_as import MQTTClient, config
from machine import Pin, unique_id, freq
from network import WLAN, STA_IF, AP_IF
from syncom import SynCom
from status_values import *  # Numeric status values shared with user code.

        self.dprint('Time received: ', t, ' from:', host)
        return t

    async def wifi_han(self, state):
        if state:
            self.channel.send(argformat(STATUS, WIFI_UP))
        else:
            self.channel.send(argformat(STATUS, WIFI_DOWN))
        blue(not state)
        await asyncio.sleep(1)

    async def conn_han(self, _):
        for topic, qos in self.subscriptions.items():
            await self.subscribe(topic, qos)

    def subs_cb(self, topic, msg, retained):
        self.channel.send(argformat(SUBSCRIPTION, topic.decode('UTF8'), msg.decode('UTF8'), retained))

class Channel(SynCom):
    def __init__(self):
        mtx = Pin(14, Pin.OUT)              # Define pins
        mckout = Pin(15, Pin.OUT, value=0)  # clocks must be initialised to 0
        mrx = Pin(13, Pin.IN)
        mckin = Pin(12, Pin.IN)
        super().__init__(True, mckin, mckout, mrx, mtx, string_mode = True)
        self.cstatus = False  # Connection status
        self.client = None

# Task runs continuously. Process incoming Pyboard messages.
# Started by main_task() after client instantiated.

    async def from_pyboard(self):