Skip to content

Commit 0027e5d

Browse files
authored
Merge branch 'master' into minimqtt-update
2 parents c7e8dff + 0da1d6c commit 0027e5d

18 files changed

+263
-214
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
source actions-ci/install.sh
4141
- name: Pip install pylint, black, & Sphinx
4242
run: |
43-
pip install --force-reinstall pylint==1.9.2 black==19.10b0 Sphinx sphinx-rtd-theme
43+
pip install --force-reinstall pylint black==19.10b0 Sphinx sphinx-rtd-theme
4444
- name: Library version
4545
run: git describe --dirty --always --tags
4646
- name: PyLint

CODE_OF_CONDUCT.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Examples of unacceptable behavior by participants include:
3434
* Excessive or unwelcome helping; answering outside the scope of the question
3535
asked
3636
* Trolling, insulting/derogatory comments, and personal or political attacks
37+
* Promoting or spreading disinformation, lies, or conspiracy theories against
38+
a person, group, organisation, project, or community
3739
* Public or private harassment
3840
* Publishing others' private information, such as a physical or electronic
3941
address, without explicit permission
@@ -72,10 +74,10 @@ You may report in the following ways:
7274
In any situation, you may send an email to <[email protected]>.
7375

7476
On the Adafruit Discord, you may send an open message from any channel
75-
to all Community Helpers by tagging @community helpers. You may also send an
76-
open message from any channel, or a direct message to @kattni#1507,
77-
@tannewt#4653, @Dan Halbert#1614, @cater#2442, @sommersoft#0222, or
78-
@Andon#8175.
77+
to all Community Moderators by tagging @community moderators. You may
78+
also send an open message from any channel, or a direct message to
79+
@kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442,
80+
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
7981

8082
Email and direct message reports will be kept confidential.
8183

docs/conf.py

+65-47
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,47 @@
22

33
import os
44
import sys
5-
sys.path.insert(0, os.path.abspath('..'))
5+
6+
sys.path.insert(0, os.path.abspath(".."))
67

78
# -- General configuration ------------------------------------------------
89

910
# Add any Sphinx extension module names here, as strings. They can be
1011
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
1112
# ones.
1213
extensions = [
13-
'sphinx.ext.autodoc',
14-
'sphinx.ext.intersphinx',
15-
'sphinx.ext.napoleon',
16-
'sphinx.ext.todo',
14+
"sphinx.ext.autodoc",
15+
"sphinx.ext.intersphinx",
16+
"sphinx.ext.napoleon",
17+
"sphinx.ext.todo",
1718
]
1819

19-
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
20+
intersphinx_mapping = {
21+
"python": ("https://docs.python.org/3.4", None),
22+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
23+
}
2024

2125
# Add any paths that contain templates here, relative to this directory.
22-
templates_path = ['_templates']
26+
templates_path = ["_templates"]
2327

24-
source_suffix = '.rst'
28+
source_suffix = ".rst"
2529

2630
# The master toctree document.
27-
master_doc = 'index'
31+
master_doc = "index"
2832

2933
# General information about the project.
30-
project = u'Adafruit Adafruit_IO Library'
31-
copyright = u'2019 Brent Rubell'
32-
author = u'Brent Rubell'
34+
project = u"Adafruit Adafruit_IO Library"
35+
copyright = u"2019 Brent Rubell"
36+
author = u"Brent Rubell"
3337

3438
# The version info for the project you're documenting, acts as replacement for
3539
# |version| and |release|, also used in various other places throughout the
3640
# built documents.
3741
#
3842
# The short X.Y version.
39-
version = u'1.0'
43+
version = u"1.0"
4044
# The full version, including alpha/beta/rc tags.
41-
release = u'1.0'
45+
release = u"1.0"
4246

4347
# The language for content autogenerated by Sphinx. Refer to documentation
4448
# for a list of supported languages.
@@ -50,7 +54,7 @@
5054
# List of patterns, relative to source directory, that match files and
5155
# directories to ignore when looking for source files.
5256
# This patterns also effect to html_static_path and html_extra_path
53-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
57+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
5458

5559
# The reST default role (used for this markup: `text`) to use for all
5660
# documents.
@@ -62,7 +66,7 @@
6266
add_function_parentheses = True
6367

6468
# The name of the Pygments (syntax highlighting) style to use.
65-
pygments_style = 'sphinx'
69+
pygments_style = "sphinx"
6670

6771
# If true, `todo` and `todoList` produce output, else they produce nothing.
6872
todo_include_todos = False
@@ -77,68 +81,76 @@
7781
# The theme to use for HTML and HTML Help pages. See the documentation for
7882
# a list of builtin themes.
7983
#
80-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
84+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
8185

8286
if not on_rtd: # only import and set the theme if we're building docs locally
8387
try:
8488
import sphinx_rtd_theme
85-
html_theme = 'sphinx_rtd_theme'
86-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
89+
90+
html_theme = "sphinx_rtd_theme"
91+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
8792
except:
88-
html_theme = 'default'
89-
html_theme_path = ['.']
93+
html_theme = "default"
94+
html_theme_path = ["."]
9095
else:
91-
html_theme_path = ['.']
96+
html_theme_path = ["."]
9297

9398
# Add any paths that contain custom static files (such as style sheets) here,
9499
# relative to this directory. They are copied after the builtin static files,
95100
# so a file named "default.css" will overwrite the builtin "default.css".
96-
html_static_path = ['_static']
101+
html_static_path = ["_static"]
97102

98103
# The name of an image file (relative to this directory) to use as a favicon of
99104
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
100105
# pixels large.
101106
#
102-
html_favicon = '_static/favicon.ico'
107+
html_favicon = "_static/favicon.ico"
103108

104109
# Output file base name for HTML help builder.
105-
htmlhelp_basename = 'AdafruitAdafruit_ioLibrarydoc'
110+
htmlhelp_basename = "AdafruitAdafruit_ioLibrarydoc"
106111

107112
# -- Options for LaTeX output ---------------------------------------------
108113

109114
latex_elements = {
110-
# The paper size ('letterpaper' or 'a4paper').
111-
#
112-
# 'papersize': 'letterpaper',
113-
114-
# The font size ('10pt', '11pt' or '12pt').
115-
#
116-
# 'pointsize': '10pt',
117-
118-
# Additional stuff for the LaTeX preamble.
119-
#
120-
# 'preamble': '',
121-
122-
# Latex figure (float) alignment
123-
#
124-
# 'figure_align': 'htbp',
115+
# The paper size ('letterpaper' or 'a4paper').
116+
#
117+
# 'papersize': 'letterpaper',
118+
# The font size ('10pt', '11pt' or '12pt').
119+
#
120+
# 'pointsize': '10pt',
121+
# Additional stuff for the LaTeX preamble.
122+
#
123+
# 'preamble': '',
124+
# Latex figure (float) alignment
125+
#
126+
# 'figure_align': 'htbp',
125127
}
126128

127129
# Grouping the document tree into LaTeX files. List of tuples
128130
# (source start file, target name, title,
129131
# author, documentclass [howto, manual, or own class]).
130132
latex_documents = [
131-
(master_doc, 'AdafruitAdafruit_IOLibrary.tex', u'AdafruitAdafruit_IO Library Documentation',
132-
author, 'manual'),
133+
(
134+
master_doc,
135+
"AdafruitAdafruit_IOLibrary.tex",
136+
u"AdafruitAdafruit_IO Library Documentation",
137+
author,
138+
"manual",
139+
),
133140
]
134141

135142
# -- Options for manual page output ---------------------------------------
136143

137144
# One entry per manual page. List of tuples
138145
# (source start file, name, description, authors, manual section).
139146
man_pages = [
140-
(master_doc, 'AdafruitAdafruit_IOlibrary', u'Adafruit Adafruit_IO Library Documentation',
141-
[author], 1)
147+
(
148+
master_doc,
149+
"AdafruitAdafruit_IOlibrary",
150+
u"Adafruit Adafruit_IO Library Documentation",
151+
[author],
152+
1,
153+
)
142154
]
143155

144156
# -- Options for Texinfo output -------------------------------------------
@@ -147,7 +159,13 @@
147159
# (source start file, target name, title, author,
148160
# dir menu entry, description, category)
149161
texinfo_documents = [
150-
(master_doc, 'AdafruitAdafruit_IOLibrary', u'Adafruit Adafruit_IO Library Documentation',
151-
author, 'AdafruitAdafruit_IOLibrary', 'One line description of project.',
152-
'Miscellaneous'),
162+
(
163+
master_doc,
164+
"AdafruitAdafruit_IOLibrary",
165+
u"Adafruit Adafruit_IO Library Documentation",
166+
author,
167+
"AdafruitAdafruit_IOLibrary",
168+
"One line description of project.",
169+
"Miscellaneous",
170+
),
153171
]

examples/http/adafruit_io_analog_in.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import board
77
import busio
88
from digitalio import DigitalInOut
9-
from adafruit_esp32spi import adafruit_esp32spi, adafruit_esp32spi_wifimanager
109
from analogio import AnalogIn
10+
from adafruit_esp32spi import adafruit_esp32spi, adafruit_esp32spi_wifimanager
1111

1212
# Import NeoPixel Library
1313
import neopixel
@@ -37,35 +37,37 @@
3737

3838
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
3939
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
40-
status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards
40+
status_light = neopixel.NeoPixel(
41+
board.NEOPIXEL, 1, brightness=0.2
42+
) # Uncomment for Most Boards
4143
"""Uncomment below for ItsyBitsy M4"""
42-
#status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
44+
# status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
4345
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light)
4446

4547
# Set your Adafruit IO Username and Key in secrets.py
4648
# (visit io.adafruit.com if you need to create an account,
4749
# or if you need your Adafruit IO key.)
48-
aio_username = secrets['aio_username']
49-
aio_key = secrets['aio_key']
50+
aio_username = secrets["aio_username"]
51+
aio_key = secrets["aio_key"]
5052

5153
# Create an instance of the Adafruit IO HTTP client
5254
io = IO_HTTP(aio_username, aio_key, wifi)
5355

5456
try:
5557
# Get the 'light' feed from Adafruit IO
56-
light_feed = io.get_feed('light')
58+
light_feed = io.get_feed("light")
5759
except AdafruitIO_RequestError:
5860
# If no 'light' feed exists, create one
59-
light_feed = io.create_new_feed('light')
61+
light_feed = io.create_new_feed("light")
6062

6163
# Set up an analog light sensor on the PyPortal
6264
adc = AnalogIn(board.LIGHT)
6365

6466
while True:
6567
light_value = adc.value
66-
print('Light Level: ', light_value)
67-
print('Sending to Adafruit IO...')
68-
io.send_data(light_feed['key'], light_value)
69-
print('Sent!')
68+
print("Light Level: ", light_value)
69+
print("Sending to Adafruit IO...")
70+
io.send_data(light_feed["key"], light_value)
71+
print("Sent!")
7072
# delay sending to Adafruit IO
7173
time.sleep(SENSOR_DELAY)

examples/http/adafruit_io_digital_out.py

+15-13
Original file line numberDiff line numberDiff line change
@@ -35,43 +35,45 @@
3535

3636
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
3737
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
38-
status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2) # Uncomment for Most Boards
38+
status_light = neopixel.NeoPixel(
39+
board.NEOPIXEL, 1, brightness=0.2
40+
) # Uncomment for Most Boards
3941
"""Uncomment below for ItsyBitsy M4"""
40-
#status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
42+
# status_light = dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.2)
4143
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light)
4244

4345
# Set your Adafruit IO Username and Key in secrets.py
4446
# (visit io.adafruit.com if you need to create an account,
4547
# or if you need your Adafruit IO key.)
46-
aio_username = secrets['aio_username']
47-
aio_key = secrets['aio_key']
48+
aio_username = secrets["aio_username"]
49+
aio_key = secrets["aio_key"]
4850

4951
# Create an instance of the Adafruit IO HTTP client
5052
io = IO_HTTP(aio_username, aio_key, wifi)
5153

5254
try:
5355
# Get the 'digital' feed from Adafruit IO
54-
digital_feed = io.get_feed('digital')
56+
digital_feed = io.get_feed("digital")
5557
except AdafruitIO_RequestError:
5658
# If no 'digital' feed exists, create one
57-
digital_feed = io.create_new_feed('digital')
59+
digital_feed = io.create_new_feed("digital")
5860

5961
# Set up LED
6062
LED = DigitalInOut(board.D13)
6163
LED.direction = Direction.OUTPUT
6264

6365
while True:
6466
# Get data from 'digital' feed
65-
print('getting data from IO...')
66-
feed_data = io.receive_data(digital_feed['key'])
67+
print("getting data from IO...")
68+
feed_data = io.receive_data(digital_feed["key"])
6769

6870
# Check if data is ON or OFF
69-
if int(feed_data['value']) == 1:
70-
print('received <- ON\n')
71-
elif int(feed_data['value']) == 0:
72-
print('received <= OFF\n')
71+
if int(feed_data["value"]) == 1:
72+
print("received <- ON\n")
73+
elif int(feed_data["value"]) == 0:
74+
print("received <= OFF\n")
7375

7476
# Set the LED to the feed value
75-
LED.value = int(feed_data['value'])
77+
LED.value = int(feed_data["value"])
7678

7779
time.sleep(5)

0 commit comments

Comments
 (0)