Project Ember official control unit (a Flask + Redis docker-ready solution)
Project Ember official control unit
Metropolis requires the following libraries (a requirement.txt
file is included)
Metropolis requires also a Redis db, up and running. If you does not have
one available you can use the docker-compose.yml
file in the folder dockerize
to deploy an instance.
Metropolis requires two mandatory parameters:
--name
: alphanumeric string that identifies the control unit in the network--kafka
: ip address of the kafka clusterThe logging messages of Flask have been disable so you can see the control messages
coming from Project Ember data stream processing component (through Kafka).
Lamp CRUD operations:
URL: /newlamp
PUT
or POST
\
{
"id" : 123456,
"address": "Piazza Massimo D'Azeglio, 22",
"model": "Philips NGX22",
"consumption": 4,
"power_on": true,
"level": 4.2,
"last_replacement": 1489059057,
"sent": 1489059058
}
DELETE
\URL: /control
POST
\URL: /api/search/<int:lamp_id>
GET
\URL: /api/stats
\
Returns the overall statistics as a json. The total number of lamps
registered by this control unit. The number of powered on lamps, the
consumption mean and the power level mean.
{
"total": 0,
"powered_on": 0,
"consumption": 0,
"level": 0
}
api/ids
\