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


from mqtt_as import MQTTClient, config
from config import wifi_led, blue_led
import uasyncio as asyncio
# range.py Test of asynchronous mqtt client with clean session False.
# (C) Copyright Peter Hinch 2017-2019.
# Released under the MIT licence.

# Public brokers https://github.com/mqtt/mqtt.github.io/wiki/public_brokers

# This demo is for wireless range tests. If OOR the red LED will light.
# In range the blue LED will pulse for each received message.
# Uses clean sessions to avoid backlog when OOR.

# red LED: ON == WiFi fail
# blue LED pulse == message received
# Publishes connection statistics.


TOPIC = 'shed'  # For demo publication and last will use same topic

outages = 0

async def pulse():  # This demo pulses blue LED each time a subscribed msg arrives.

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


# Path: mqtt_as/range.py
from mqtt_as import MQTTClient, config
from config import wifi_led, blue_led
import uasyncio as asyncio

# range.py Test of asynchronous mqtt client with clean session False.
# (C) Copyright Peter Hinch 2017-2019.
# Released under the MIT licence.

# Public brokers https://github.com/mqtt/mqtt.github.io/wiki/public_brokers

# This demo is for wireless range tests. If OOR the red LED will light.
# In range the blue LED will pulse for each received message.
# Uses clean sessions to avoid backlog when OOR.

# red LED: ON == WiFi fail
# blue LED pulse == message received
# Publishes connection statistics.


TOPIC = 'shed'  # For demo publication and last will use same topic

outages = 0

async def pulse():  # This demo pulses blue LED each time a subscribed msg arrives.

    blue_led(True)