Dependencies¶
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.
BloomSky Account¶
This library is only useful to owners of BloomSky Weather Stations. Get your Bloomsky API Key from your Bloomsky Dashboard. https://dashboard.bloomsky.com/
Usage Example¶
See full working example in the examples folder. The basic structure looks like this,
## Join Network
wifi.radio.connect(secrets["ssid"], secrets["password"])
# Setup Requests
radio = wifi.radio
pool = socketpool.SocketPool(radio)
requests = adafruit_requests.Session(pool,
ssl.create_default_context())
# Create Bloomsky client.
bloomsky_client = circuitpython_bloomsky.BloomSkyAPIClient(
requests, api_key=secrets["bloomsky_key"]
)
# Get data and utilize it in your application.
# This is the section you would put in your While loop if running
# repeatedly.
bloomsky_report = bloomsky_client.get_data()
print(bloomsky_report.device)
print(bloomsky_report.indoor)
print(bloomsky_report.sky)
print(bloomsky_report.storm)
Contributing¶
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Documentation¶
Pretty documentation available https://circuitpython-bloomsky.readthedocs.io/en/latest/
Installing from PyPI¶
Note
This library is not available on PyPI yet. Stay tuned for PyPI availability, when or if CircuitPython libraries are supported from there.
Acknowledgements¶
The basic idea for this library and the concept to rename attributes came from https://github.com/tylerdave/bloomsky-api and was heavily reworked for this library.
Table of Contents¶
Simple test¶
Ensure your device works with this simple test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | # SPDX-FileCopyrightText: Copyright (c) 2021 Patrick Walters
#
# SPDX-License-Identifier: Unlicense
"""
This example shows retrieving data from the BloomSky API
It will run on boards with native WIFI such as the ESP32-S2 based boards.
"""
import ssl
import socketpool
import wifi
import adafruit_requests
import circuitpython_bloomsky
# Get secrets
try:
from secrets import secrets
except ImportError:
print("Secrets are kept in secrets.py, please add them there!")
raise
## Join Network
print("Joining Network")
wifi.radio.connect(secrets["ssid"], secrets["password"])
print(f"ip: {wifi.radio.ipv4_address}")
print(f"hostname: {wifi.radio.hostname}")
# Setup Requests
radio = wifi.radio
pool = socketpool.SocketPool(radio)
requests = adafruit_requests.Session(pool, ssl.create_default_context())
bloomsky_client = circuitpython_bloomsky.BloomSkyAPIClient(
requests, api_key=secrets["bloomsky_key"]
)
bloomsky_report = bloomsky_client.get_data()
print(bloomsky_report.device) # Device Details and Media
print(bloomsky_report.indoor) # Indoor Data if Available
print(bloomsky_report.sky) # Sky Weather Station Data
print(bloomsky_report.storm) # Storm rain and wind gauge
|
circuitpython_bloomsky
¶
CircuitPython Wrapper for BloomSky API
Author(s): Patrick Walters
Implementation Notes¶
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
Adafruit CircuitPython Datetime Library https://github.com/adafruit/Adafruit_CircuitPython_datetime
Adafruit CircuitPython Requests Library https://github.com/adafruit/Adafruit_CircuitPython_Requests
-
class
circuitpython_bloomsky.
BLOOMSKY_REPORT
(response_json)¶ Bloomsky Report Class represents data from the Bloomsky API. DEVICE is the Sky’s non-wx and available media data. SKY is the base weather station. STORM is the add-on rain and wind gauge.