4 Commits

Author SHA1 Message Date
gballan 8b5852c012 Version bump to v0.1.1
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2026-09-06 01:27:32 -04:00
gballan 7dbabc902b Adding CI badge
ci/woodpecker/push/woodpecker Pipeline was successful
2026-09-06 01:26:42 -04:00
gballan 2b4faca80d [Issue #3] - Fixing small linter issue
ci/woodpecker/push/woodpecker Pipeline was successful
2026-09-06 01:25:14 -04:00
gballan d28ff065f5 Adding short delay and LED indicator to show that the app is running
ci/woodpecker/push/woodpecker Pipeline failed
2026-09-06 01:21:59 -04:00
3 changed files with 30 additions and 3 deletions
+2
View File
@@ -1,5 +1,7 @@
# pico-thermo # pico-thermo
![Woodpecker CI badge](https://builds.metaunix.net/api/badges/90/status.svg)
MicroPython app to read data from BME280 sensor and send it to Home Assistant MicroPython app to read data from BME280 sensor and send it to Home Assistant
## Running ## Running
+26 -1
View File
@@ -259,7 +259,7 @@ def register_ha_discovery(mqtt):
# ------------------------------------------------------------- # -------------------------------------------------------------
# Main Execution Loop # Instantiate Wi-Fi connection
# ------------------------------------------------------------- # -------------------------------------------------------------
def connect_wifi(): def connect_wifi():
wlan = network.WLAN(network.STA_IF) wlan = network.WLAN(network.STA_IF)
@@ -277,6 +277,22 @@ def connect_wifi():
print(f"Wi-Fi connected. IP: {wlan.ifconfig()[0]}") print(f"Wi-Fi connected. IP: {wlan.ifconfig()[0]}")
# -------------------------------------------------------------
# Panic when the sensor isn't ready
# -------------------------------------------------------------
def panic(err=None):
"""Signals a fatal fault by blinking the onboard LED continuously."""
if err:
print(f"Fatal error: {err}")
led = Pin("LED", Pin.OUT)
while True:
led.toggle()
time.sleep(0.1)
# -------------------------------------------------------------
# Main Execution Loop
# -------------------------------------------------------------
def main(): def main():
# Adjust SDA/SCL pins according to your wiring # Adjust SDA/SCL pins according to your wiring
i2c = SoftI2C(sda=Pin(16), scl=Pin(17), freq=100000) i2c = SoftI2C(sda=Pin(16), scl=Pin(17), freq=100000)
@@ -322,4 +338,13 @@ def main():
if __name__ == "__main__": if __name__ == "__main__":
# Allow 3.3V power rails and I2C registers to settle on cold boot
time.sleep(2)
# Indicate startup has begun
Pin("LED", Pin.OUT).on()
try:
main() main()
except Exception as e:
panic(e)
+1 -1
View File
@@ -1,6 +1,6 @@
[project] [project]
name = "pico-thermo" name = "pico-thermo"
version = "0.1.0" version = "0.1.1"
description = "MicroPython MQTT app to read BME280 sensor into Home Assistant" description = "MicroPython MQTT app to read BME280 sensor into Home Assistant"
readme = "README.md" readme = "README.md"
requires-python = ">=3.9" requires-python = ">=3.9"