first commit

master
Cole Deck 2 years ago
commit eca3e08291

@ -0,0 +1,6 @@
FROM waggle/plugin-base:1.1.1-ml
COPY requirements.txt /app/
RUN pip3 install --no-cache-dir --upgrade -r /app/requirements.txt
COPY . /app/
WORKDIR /app
ENTRYPOINT ["python3", "/app/main.py"]

@ -0,0 +1,21 @@
#!/usr/bin/python
from waggle.plugin import Plugin
import time
sensortypes = ["microphone", "camera", "humidity"]
showData = True
def publishData(data, sensorID, sensorType, dataTimestamp):
with Plugin() as plugin:
if showData is True:
print("publishing network.bridge.sensor." + sensorType + "with metadata:", {"sensorID": sensorID, "sensorType": sensorType}, "and timestamp:", dataTimestamp, "and data:", data)
else:
print("publishing network.bridge.sensor." + sensorType + "with metadata", {"sensorID": sensorID, "sensorType": sensorType})
plugin.publish("network.bridge.sensor." + sensorType, data, meta={"sensorID": sensorID, "sensorType": sensorType}, timestamp=dataTimestamp)
time.sleep(1)
if __name__ == "__main__":
# testing
publishData(1, "0", sensortypes[0], time.time_ns())

@ -0,0 +1 @@
pywaggle[all]

@ -0,0 +1,4 @@
#!/bin/bash
export PYWAGGLE_LOG_DIR=test-run
python main.py

@ -0,0 +1,13 @@
name: "network-sensor-bridge"
description: "Bridge plugin to connect networked (optionally meshed sensors)"
keywords: "network, mesh, bridge"
authors: "Your Name <your.email@somewhere.org>, A Coworker <your.coworker@somewhere.org>"
collaborators: "Cole Deck <cdeck@hawk.iit.edu>"
funding: ""
license: ""
homepage: ""
source:
architectures:
- "linux/amd64"
- "linux/arm64"
- "linux/arm/v7"

@ -0,0 +1,5 @@
{"meta":{"sensorID":"0","sensorType":"microphone"},"name":"network.bridge.sensor.microphone","timestamp":"2023-03-21T14:46:25.762401149","value":1}
{"meta":{"sensorID":"0","sensorType":"microphone"},"name":"network.bridge.sensor.microphone","timestamp":"2023-03-21T14:49:11.913989882","value":1}
{"meta":{"sensorID":"0","sensorType":"microphone"},"name":"network.bridge.sensor.microphone","timestamp":"2023-03-21T14:52:40.885835367","value":1}
{"meta":{"sensorID":"0","sensorType":"microphone"},"name":"network.bridge.sensor.microphone","timestamp":"2023-03-21T14:53:10.464592551","value":1}
{"meta":{"sensorID":"0","sensorType":"microphone"},"name":"network.bridge.sensor.microphone","timestamp":"2023-03-21T14:53:17.921731597","value":1}
Loading…
Cancel
Save