{"id":17551068,"url":"https://github.com/ttu/cubesensors-iot-azure","last_synced_at":"2026-04-29T16:04:43.284Z","repository":{"id":139968187,"uuid":"41727874","full_name":"ttu/cubesensors-iot-azure","owner":"ttu","description":"Processing for (Cube)Sensor data. Python processing, F# REST API, optional Azure Streaming.","archived":false,"fork":false,"pushed_at":"2017-02-20T23:11:16.000Z","size":3356,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-20T01:32:48.886Z","etag":null,"topics":["azure","fsharp","ifttt","python","sql"],"latest_commit_sha":null,"homepage":"","language":"F#","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/ttu.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":"2015-09-01T08:55:19.000Z","updated_at":"2016-12-23T06:57:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"ead94094-4aba-435f-9689-9df5590e4dd3","html_url":"https://github.com/ttu/cubesensors-iot-azure","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ttu/cubesensors-iot-azure","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttu%2Fcubesensors-iot-azure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttu%2Fcubesensors-iot-azure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttu%2Fcubesensors-iot-azure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttu%2Fcubesensors-iot-azure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttu","download_url":"https://codeload.github.com/ttu/cubesensors-iot-azure/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttu%2Fcubesensors-iot-azure/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32432919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"last_error":"SSL_read: 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":["azure","fsharp","ifttt","python","sql"],"created_at":"2024-10-21T04:44:46.361Z","updated_at":"2026-04-29T16:04:43.236Z","avatar_url":"https://github.com/ttu.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CubeSensors IoT Azure\n\n* src/python_parser\n  * Python Parser\n  * Gets data from CubeSensorsAPI, parses data to selected format and sends it to Event Hub or straight to database\n* src/python_checker\n  * Check sensor status from database\n  * Trigger IFTTT actions\n* src/CubeSensorsRestApi\n  * F# REST API (Suave)\n  * Gets data from database. Simple authentication.\n* Azure\n  * Stream Analytics fetches data from Event Hub and sends it to SQL Server.\n\n![Diagram](diagram.png)\n\n## Azure Deployment\n\n0. Create ServiceBus\n  1. Scale -\u003e Basic\n  1. Create Event Hub\n    1. Configure -\u003e Shared access policies\n      * cube_sender (Permissions: send)\n      * cube_receiver (Permissions: listen)\n      * Update sender private key to keys.py\n0. Create SQL Database\n  1. Create database\n0. Create Stream Analytics\n  1. Add input\n    * Event Hub Policy Name: cube_receiver\n  1. Add output\n  1. Add query\n0. Create WebApp\n  1. Scale -\u003e Basic\n  1. Configuration -\u003e Always on\n  1. Add Python script (data_parser) as a new Web Job\n    1. Add as a zip file. Pack whole module including env folder.\n\n### JSON\n\nSample files in sample_data folder.\n\n### Stream Analytics Query\n\nInput: cubesensors-event-hub\n\nOutput: cubesensors-sql-data (SQL), cubesensors-alert-blob (BLOB)\n\n```sql\nWITH data_query AS (\n  SELECT\n      id AS sensorid,\n      [time] AS measurementtime,\n      temp AS temperature,\n      pressure,\n      humidity,\n      voc,\n      light,\n      noisedba AS noise,\n      battery,\n      cable,\n      voc_resistance AS vocresistance,\n      rssi\n  FROM\n      [cubesensors-event-hub]\n)\n\n-- Addl all data to database\nSELECT * INTO [cubesensors-sql-data] FROM data_query\n\n-- Add alert data when battery is running low and cube is not plugged in\nSELECT sensorid, measurementtime, battery INTO [cubesensors-alert-blob]\nFROM data_query\nWHERE cable = false AND battery \u003c 10\n```\n\n### Database\n\nDatabase creation scripts are in .\\src\\database folder. Some configurations in the beginning of the create script are required by SQL Server LocalDB.\n\n## IFTTT\n\nStart charging sensors automatically when battery level is down. IFTTT Maker channel is used to send messages to connected to smart plugs.\n\n* Get latest measurement for each sensor from the db where it either requires charging or unplugging\n  * Requires charging if battery level under 15 and not plugged in. Start chargin only after 7PM (UTC).\n  * Unplug if battery level over 96 and plugged in\n* Send on or off message to IFTTT with sensorId an action (_on or _off) as event\n```\nhttps://maker.ifttt.com/trigger/EVENT_NAME/with/key/API_KEY\ne.g.\nhttps://maker.ifttt.com/trigger/000D6F000449287A_on/with/key/copx80nTQbGdfsPEXptkdd8dN1KobKyZiBlZezpoRKDFSD\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttu%2Fcubesensors-iot-azure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttu%2Fcubesensors-iot-azure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttu%2Fcubesensors-iot-azure/lists"}