{"id":15600499,"url":"https://github.com/flopezag/fiware-iot-hackathon","last_synced_at":"2026-03-07T00:33:14.878Z","repository":{"id":80957773,"uuid":"93343061","full_name":"flopezag/fiware-iot-hackathon","owner":"flopezag","description":"Automatic deploy and configuration of FIWARE Lab instance to use docker and creation of a docker-compose with Orion, IoT Agent UL2.0 and MondoDB","archived":false,"fork":false,"pushed_at":"2017-06-06T06:25:29.000Z","size":25,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T13:51:52.841Z","etag":null,"topics":["ansible","docker","docker-compose","fiware","fiware-iot-agents","fiware-orion","fiware-sth-comet","openstack"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flopezag.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-04T21:40:32.000Z","updated_at":"2022-03-01T17:28:23.000Z","dependencies_parsed_at":"2023-03-12T12:52:29.351Z","dependency_job_id":null,"html_url":"https://github.com/flopezag/fiware-iot-hackathon","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.125,"last_synced_commit":"9dc37ff5ef326a22621a60314f08241a0910a237"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/flopezag/fiware-iot-hackathon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flopezag%2Ffiware-iot-hackathon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flopezag%2Ffiware-iot-hackathon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flopezag%2Ffiware-iot-hackathon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flopezag%2Ffiware-iot-hackathon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flopezag","download_url":"https://codeload.github.com/flopezag/fiware-iot-hackathon/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flopezag%2Ffiware-iot-hackathon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30204154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","docker","docker-compose","fiware","fiware-iot-agents","fiware-orion","fiware-sth-comet","openstack"],"created_at":"2024-10-03T02:03:45.756Z","updated_at":"2026-03-07T00:33:09.860Z","avatar_url":"https://github.com/flopezag.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003ca name=\"top\"\u003e\u003c/a\u003eFIWARE IoT Hackathon content\n[![License badge](https://img.shields.io/badge/license-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nAnsible paybooks to deploy and configure server and the installation and configuration\nof docker and docker-compose over ubuntu server and install Orion, IoT Agent - UL2.0 and\nComet with MongoDB as database in a FIWARE Lab [FIWARE Lab](https://cloud.lab.fiware.org) \ncloud.\n\nThe OpenStack dynamic inventory code presented here is taken from the repository \nhttps://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/openstack.py\n\nIf you want to obtain more information about those FIWARE Generic Enablers, please visit \nthe following web sites:\n- [Orion Context Broker](https://fiware-orion.readthedocs.io)\n- [IoT Agent for UL2.0 (HTTP or MQTT transport)](https://github.com/telefonicaid/iotagent-ul)\n- [IoT Agent for JSON (MQTT transport)](https://github.com/telefonicaid/iotagent-uljson)\n- [IoT Agent for OMA-LWM2M (CoAP transport)](https://github.com/telefonicaid/lightweightm2m-iotagent)\n- [Short Term Historic (Comet)](https://fiware-sth-comet.readthedocs.io/en/latest/)\n\n\n## How to start it\n\n- Create virtualenv and activate it:\n```\nvirtualenv -p python2.7 $NAME_VIRTUAL_ENV\nsource $NAME_VIRTUAL_ENV/bin/activate\n```\n- Install the pre-requisites:\n```\npip install -r requirements.txt\n```\n- Put the correct path to your '/env/bin/python' into the localhost_inventory file.\n- Download you OpenStack RC file from the OpenStack dashboard (it's available under \n\"info\" option on the top left of the FIWARE Lab Cloud Portal). Please, do not forget \nto fill in with your password.\n```\nexport OS_REGION_NAME=xxxxxx\nexport OS_USERNAME=xxxxx\nexport OS_PASSWORD=xxxxxx\nexport OS_AUTH_URL=http://130.206.84.8:4730/v3/\nexport OS_TENANT_NAME=xxxxxxx\n```\n- You have to add the following to your .openrc file\n```\nexport OS_PROJECT_DOMAIN_NAME=default\nexport OS_USER_DOMAIN_NAME=default\nexport OS_IDENTITY_API_VERSION=3\n```\n- [OPTIONAL] I suggest to add the following line to it.\n```\nexport PS1='(`basename \\\"$VIRTUAL_ENV`)[\\u@FIWARE Lab \\W(keystone_user)]\\$ '\n```\n- Source your OpenStack RC file: `source \u003cpath to rc file\u003e`. This will load information \nabout you OpenStack Setup into your environment.\n- Create the security group for your virtual machine:\n```\nopenstack security group create \u003cYOUR SEC. GROUP NAME\u003e --description \"internal security group for IoT Hackathon\"\nopenstack security group rule create iotweek --protocol tcp --dst-port 22\nopenstack security group rule create iotweek --protocol tcp --dst-port 1026\nopenstack security group rule create iotweek --protocol tcp --dst-port 4041\nopenstack security group rule create iotweek --protocol tcp --dst-port 7896\nopenstack security group rule create iotweek --protocol tcp --dst-port 8666\nopenstack security group rule create iotweek --protocol tcp --dst-port 27017\n```\n- Create a keypair to be used in your instances:\n```\nopenstack keypair create \u003cNAME OF THE KEY PAIR\u003e \u003e \u003cYOUR SSH KEY.pem\u003e\n```\n- Change permissions to the ssh key file:\n```\nchmod 400 \u003cYOUR SSH KEY.pem\u003e\n```\n- Edit the setup variables to fit your setup. Open `vars/main.yml` and setup the \nvariables as explained there.\n- One all the variables are in place you should now be able to create your instances:\n```\nansible-playbook -i localhost_inventory --private-key=\u003cYOUR SSH KEY\u003e create_instance_playbook.yml\n```\n- Then install tempest+ralli on the node (I have noticed that sometimes it takes a while \nfor the ssh-server on the nodes to start, therefore if you get an initial ssh-error, \nwait a few minutes and try again).\n```\nansible-playbook -i openstack_inventory.py --user=ubuntu --private-key=\u003cYOUR SSH KEY.pem\u003e \\\n deploy_iotplatform_playbook.yml\n```\n- Once this has finished successfully your IoT Platform instance server is ready to use. You can access\nyour instance through the execution of the command:\n```\nssh -i \u003cYOUR SSH KEY.pem\u003e` ubuntu@\u003cIP of your instance\u003e\n```\nAnd now just activate the docker-compose executing:\n```\nsudo docker-compose up\n```\nIn the directory /home/ubuntu in which is located the file docker-compose.yml.\n\nNow just enjoy FIWARE.\n\n\n## How to play with it\n\nFirstly, be sure that you have installed [curl](https://curl.haxx.se/) program \nand [jq](https://stedolan.github.io/jq/download/).\n\nThe first thing that you have to do is register a new service in the IoT Agent\n\n```  \ncurl -H \"Content-type: application/json\" -H \"Fiware-Service: openiot\" -H \"Fiware-ServicePath: /\" \\ \nhttp://\u003cIP of your FIWARE Lab Instance\u003e:4041/iot/services -d '{\n \"services\": [\n   {\n     \"apikey\":      \"4jggokgpepnvsb2uv4s40d59ov\",\n     \"cbroker\":     \"http://0.0.0.0:1026\",\n     \"entity_type\": \"thing\",\n     \"resource\":    \"/iot/d\"\n   }\n ]\n}'\n```\n\nYou can check now the new created service through the following command:\n\n```\ncurl -H \"Content-type: application/json\" -H \"Fiware-Service: openiot\" -H \"Fiware-ServicePath: /\" \\ \nhttp://\u003cIP of your FIWARE Lab Instance\u003e:4041/iot/services | jq .\n```\n\nNow, you have to register the sensor (devices), which type and which values should receive from it.\n\n```\ncurl http://\u003cIP of your FIWARE Lab Instance\u003e:4041/iot/devices \\\n-H \"Content-type: application/json\" -H \"Fiware-Service: openiot\" -H \"Fiware-ServicePath: /\" \\\n-d '{\n \"devices\": [\n   {\n     \"device_id\":   \"my_device_01\",\n     \"entity_name\": \"my_entity_01\",\n     \"entity_type\": \"thing\",\n     \"protocol\":    \"PDI-IoTA-UltraLight\",\n     \"timezone\":    \"Europe/Madrid\",\n     \"attributes\": [\n       {\n         \"object_id\": \"t\",\n         \"name\":      \"temperature\",\n         \"type\":      \"int\"\n       },\n       {\n         \"object_id\": \"l\",\n         \"name\":      \"luminosity\",\n         \"type\":      \"number\"\n       }\n     ]\n   }\n ]\n}'\n```\n\nTo check the information of the device, just execute the sentence:\n\n```\ncurl -H \"Content-type: application/json\" -H \"Fiware-Service: openiot\" -H \"Fiware-ServicePath: /\" \\ \nhttp://\u003cIP of your FIWARE Lab Instance\u003e:4041/iot/devices | jq .\n```\n\nNow, we can subscribe the Short Term Historical data (FIWARE STH-Commet) to store the different context \ninformation that we send to the Orion Context Broker. Just execute the following sentence:\n```\ncurl -X POST -H \"Content-Type: application/json\" -H \"Accept: application/json\" -H \"Fiware-Service: openiot\" \\ \n-H \"Fiware-ServicePath: /\" -H \"Cache-Control: no-cache\" -d '{\n    \"entities\": [\n        {\n            \"type\": \"thing\",\n            \"isPattern\": \"false\",\n            \"id\": \"my_entity_01\"\n        }\n    ],\n    \"attributes\": [\n        \"temperature\"\n    ],\n    \"reference\": \"http://130.206.115.154:8666/notify\",\n    \"duration\": \"P1M\",\n    \"notifyConditions\": [\n        {\n            \"type\": \"ONCHANGE\",\n            \"condValues\": [\n                \"temperature\"\n            ]\n        }\n    ]\n}' \"http://\u003cIP of your FIWARE Lab Instance\u003e:1026/v1/subscribeContext\"\n```\n \nNow, you can send context information in the Ultralight 2.0 format through HTTP using the following sentence:\n\n```\ncurl \"http://\u003cIP of your FIWARE Lab Instance\u003e:7896/iot/d?k=4jggokgpepnvsb2uv4s40d59ov\u0026i=my_device_01\" \\ \n-d 't|37#l|1200' -H \"Content-type: text/plain\"\n```\n\nAnd you can recover the current context information from Orion Context Broker through the following command:\n\n```\ncurl http://\u003cIP of your FIWARE Lab Instance\u003e:1026/ngsi10/queryContext -H \"Content-type: application/json\" \\ \n-H \"Fiware-Service: openiot\" -d '{\n   \"entities\": [\n       {\n           \"type\": \"\", \n           \"id\": \"my_entity_01\", \n           \"isPattern\": \"false\"\n       }\n   ], \n   \"attributes\": []\n}'\n```\n\nJust send 2 more context information with similar senteces like:\n```\ncurl \"http://130.206.115.154:7896/iot/d?k=4jggokgpepnvsb2uv4s40d59ov\u0026i=my_device_01\" -d 't|38#l|1200' \\ \n-H \"Content-type: text/plain\"\n\ncurl \"http://130.206.115.154:7896/iot/d?k=4jggokgpepnvsb2uv4s40d59ov\u0026i=my_device_01\" -d 't|39#l|1200' \\ \n-H \"Content-type: text/plain\"\n```\n\nNow, you can get some aggregated data from temperature executing the following command:\n```\ncurl -X GET \\\n  'http://130.206.115.154:8666/STH/v1/contextEntities/type/thing/id/my_entity_01/attributes/temperature?aggrMethod=sum\u0026aggrPeriod=day\u0026dateFrom=2015-01-28T00%3A00%3A00\u0026dateTo=2018-01-01T23%3A59%3A59' \\\n  -H 'accept: application/json' \\\n  -H 'cache-control: no-cache' \\\n  -H 'content-type: application/json' \\\n  -H 'fiware-service: openiot' \\\n  -H 'fiware-servicepath: /' | jq .\n```  \n\n\n## License\n\nThese scripts are licensed under Apache License 2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflopezag%2Ffiware-iot-hackathon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflopezag%2Ffiware-iot-hackathon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflopezag%2Ffiware-iot-hackathon/lists"}