Code Monkey home page Code Monkey logo

lego-diorama-usi-2022's People

Watchers

 avatar  avatar  avatar  avatar

lego-diorama-usi-2022's Issues

formatting topics according to fiware iot-agents

instead of passing the topic as variable, let's compose it inside the code following fiware protocol

a topic will be formed by:

  • protocol (share across multiple sensors)
  • service_api_key (share across multiple sensors of the same time, e.g. streetlights)
  • sensor_id (different for each sensor)

a topic to read/write sensor values will be as follow: /<protocol>/<service_api_key>/<sensor_id>/attrs

i.e. supposed that the protocol is json, the service api key is 4jggokgpepnvsb2uv4s40d59ov and the sensor is urn:streetlight:001: /json/4jggokgpepnvsb2uv4s40d59ov/urn:streetlight:001/attrs

a message to update attributes is a json payload serialized as a string that maps attribute names to values:

{"attribute_name": "value"}

e.g.:

{"h": 70, "t": 15}

i.e., updating the sensor values will be a mqtt command as:

$ mosquitto_pub -t /json/4jggokgpepnvsb2uv4s40d59ov/urn:streetlight:001/attrs -m '{"h": 70, "t": 15}' -h <mosquitto_broker> -p <mosquitto_port> -u <user> -P <password>

a topic to receive commands will be as follow: /<protocol>/<service_api_key>/<sensor_id>/cmd

i.e. supposed that the protocol is json, the service api key is 4jggokgpepnvsb2uv4s40d59ov and the sensor is urn:streetlight:001: /json/4jggokgpepnvsb2uv4s40d59ov/urn:streetlight:001/cmd

a message to receive command is a json payload serialized as a string that maps command names to passed parameters and their values:

{ "command name": { "command parameter":  "value" } }

e.g.

{ "light": { "switch":  "on" } }

last, but not least, once a sensor receive a commands and execute it, it should confirm the execution (or report error) on the topic: /<protocol>/<service_api_key>/<sensor_id>/cmdexe

i.e. supposed that the protocol is json, the service api key is 4jggokgpepnvsb2uv4s40d59ov and the sensor is urn:streetlight:001: /json/4jggokgpepnvsb2uv4s40d59ov/urn:streetlight:001/cmdexe

the message to be sent is a json payload serialized as a string that maps attribute names to values:

{ "command name": { "command parameter":  "value" } }

e.g.

{ "light": { "switch":  "ok" } }

Turn on streetlight (raspberrypi)

  • monitor mqtt queue (1 topic for streetlight or for street)
  • if message received "turn on light" turn on light
  • when command succesfully applied send message "light on" in the topic (same as above)

docker ministack supporting mqtt + lorawan

Is your feature request related to a problem? Please describe.

Given that we are not yet ready for the k8s + kubeedge stack, let's start with basic integration at the service level
by providing a docker ministack.

Describe the solution you'd like

deploy a stack with one click that includes different services required:

  • iot agents
  • context broker
  • mongo
  • ql
  • timescale
  • grafana

Describe alternatives you've considered

N/A

Additional context

N/A

parking (raspberrypi)

  • when sensor detect something (proximity)
  • send message parking spot occupied
  • turn on red light (closed loop)
  • when sensor detect nothing
  • send message parking spot free
  • turn on green light (closed loop)

use a mqtt queue, 1 topic per sensor (2)

reformat streelight code based on [#18]

def on_message(client, userdata, msg):

the flow should be:

  1. subscribe to command topic
  2. when command received to turn on light (e.g. { "light": { "power": "on" } }):
    1. turn on lights (a leave them on - the off control will be done with an external logic that ask to turn off)
    2. send ack to cmdexe topic (e.g. { "light": { "power": "ok" } })
    3. update status attribute on attrs topic (e.g. { "powerState": "on" })
  3. when command received to turn off light (e.g. { "light": { "power": "off" } }):
  4. turn off lights
  5. send ack to cmdexe topic (e.g. { "light": { "power": "ok" } })
  6. update status attribute on attrs topic (e.g. { "powerState": "off" })

ev charging (raspberrypi)

  • when sensor detect something (proximity)
  • send message parking spot occupied
  • turn on red light (closed loop)
  • if charging button pressed (and sensor detect something), blink red light for 10 seconds (then again static red)
  • when sensor detect nothing
  • send message parking spot free
  • turn on green light (closed loop)
  • use a mqtt queue, 1 topic per sensor (2)

kubedge testing

  • deploy microk8s and register pi as kubedge node
  • deploy docker container from the scenario on pi using kubedge
  • deploy docke mqtt broker on microk8s node

TrafficCounter (raspberrypi)

  • read ir sensor movement
  • send reading to mqtt topic (1 topic per sensor / topic should be configurable for each sensor)

define and order devices

Waste Management

Environment Management

Parking and EVCharging

TrafficFlow and Streetlight

Other items:

  • Wires

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.