-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reconstruct the modules into installable modules
- Loading branch information
Showing
33 changed files
with
143 additions
and
157 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[tool.poetry] | ||
name = "shedpi-module-utils" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Andrew Aikman <[email protected]>"] | ||
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
|
||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
File renamed without changes.
This file contains 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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...les/shed_pi_module_utils/base_protocol.py → ...tils/shedpi_module_utils/base_protocol.py
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
File renamed without changes.
3 changes: 1 addition & 2 deletions
3
...dules/shed_pi_module_utils/tests/utils.py → shedpi_module_utils/tests/utils.py
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
11 changes: 6 additions & 5 deletions
11
standalone_modules/shed_pi_example_device_installation/device_protocol.py
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# AM2320 temperature and humidity module | ||
|
||
Read more at https://learn.adafruit.com/adafruit-am2320-temperature-humidity-i2c-sensor_ | ||
|
||
## Hardware installation | ||
|
||
AM2320 pinout to Raspberry Pi 4B GPIO pins | ||
|
||
AM2320 - Type - RPI pin | ||
Pin 1 - 3.3v - Pin 1 | ||
Pin 2 - SDA - GPIO (SDA) Pin 3 | ||
Pin 3 - gnd - Pin 6 | ||
Pin 4 - SCL - GPIO (SCL) pin 5 | ||
|
||
## Software instalation | ||
|
||
``` | ||
poetry add adafruit-circuitpython-am2320 | ||
``` |
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[tool.poetry] | ||
name = "shedpi-module-am2320" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Andrew Aikman <[email protected]>"] | ||
readme = "README.md" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.11" | ||
|
||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
Empty file.
45 changes: 45 additions & 0 deletions
45
standalone_modules/shedpi_module_am2320/shedpi_module_am2320/device_protocol.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import time | ||
|
||
import adafruit_am2320 | ||
import board | ||
from shed_pi_module_utils.data_submission import ( | ||
ReadingSubmissionService, | ||
) | ||
from shed_pi_module_utils.utils import logger | ||
|
||
# create the I2C shared bus | ||
i2c = board.I2C() # uses board.SCL and board.SDA | ||
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller | ||
am = adafruit_am2320.AM2320(i2c) | ||
|
||
while True: | ||
print("Temperature: ", am.temperature) | ||
print("Humidity: ", am.relative_humidity) | ||
time.sleep(2) | ||
|
||
|
||
class DeviceProtocol(BaseProtocol): | ||
def __init__(self, submission_service: ReadingSubmissionService): | ||
... | ||
|
||
def stop(self): | ||
logger.info("Stopping device protocol") | ||
|
||
def start(self): | ||
logger.info("Starting device protocol") | ||
|
||
|
||
def main(): | ||
# The Submission service is used to record any module data | ||
submission_service = ReadingSubmissionService() | ||
device = DeviceProtocol(submission_service=submission_service) | ||
|
||
try: | ||
device.startup() | ||
device.start() | ||
finally: | ||
device.shutdown() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Empty file.
Empty file.
This file contains 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
Oops, something went wrong.