This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # $FreeBSD$ | |
| # | |
| # PROVIDE: hass | |
| # REQUIRE: LOGIN | |
| # KEYWORD: shutdown | |
| # | |
| # Add these lines to /etc/rc.conf.local or /etc/rc.conf | |
| # to enable this service: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import uasyncio # upip install this if not present | |
| from umqtt.simple import MQTTClient | |
| import webrepl | |
| # you only need to connect once | |
| # it's more like WiFi settings then connect | |
| sta = network.WLAN(network.STA_IF) | |
| sta.connect('<SSID>', '<PASSWD>') | |
| mqtt = MQTTClient(<MQTT_SETTINGS>) |