Skip to content

Instantly share code, notes, and snippets.

View dafvid's full-sized avatar
🍍

David Stenwall dafvid

🍍
View GitHub Profile
@dafvid
dafvid / hass
Created December 21, 2022 22:45
Homeassistant FreeBSD rc-script
#!/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:
@dafvid
dafvid / main.py
Created January 4, 2022 19:38
Micropython async reconnect
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>)