{"id":22004849,"url":"https://github.com/cybrox/cloud-cloud-api","last_synced_at":"2025-06-13T17:34:38.656Z","repository":{"id":73481221,"uuid":"95882078","full_name":"cybrox/cloud-cloud-api","owner":"cybrox","description":"Elixir state server for controlling our cloud-cloud. (100% not TDD)","archived":false,"fork":false,"pushed_at":"2018-05-16T11:00:53.000Z","size":110,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T06:27:52.857Z","etag":null,"topics":["api","cloud","cloud-cloud","elixir","untested"],"latest_commit_sha":null,"homepage":"https://learn.sparkfun.com/tutorials/led-cloud-connected-cloud","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cybrox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-30T11:22:04.000Z","updated_at":"2018-05-16T11:00:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"9872f2b9-d0bf-4522-b8d6-10f38ff4a43a","html_url":"https://github.com/cybrox/cloud-cloud-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cybrox/cloud-cloud-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybrox%2Fcloud-cloud-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybrox%2Fcloud-cloud-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybrox%2Fcloud-cloud-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybrox%2Fcloud-cloud-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cybrox","download_url":"https://codeload.github.com/cybrox/cloud-cloud-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybrox%2Fcloud-cloud-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259688701,"owners_count":22896465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["api","cloud","cloud-cloud","elixir","untested"],"created_at":"2024-11-30T00:17:21.895Z","updated_at":"2025-06-13T17:34:38.648Z","avatar_url":"https://github.com/cybrox.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cloud-cloud-api\nThis is the server side api implementation for our cloud connected cloud, a project inspired by Sparkfun's [cloud-cloud](https://learn.sparkfun.com/tutorials/led-cloud-connected-cloud) but reimagined to using a custom server software that potentially allows implementing a lot more features in the future.\n\nBasically, instead of handling everything on the ESP32 and adding an app for manual control via a third party service, we control data abstraction and manual control on the server side, providing a mobile-friendly webinterface. The weather data used is coming from [openweathermap](https://openweathermap.org/)\n\nA note on the state of this project:\n* The software is fully functional, at least as far as we are aware of\n* The software will be deployed in-house, so security is not a factor\n* The software is completely untested. - Because I'm lazy.\n\n### The idea\nThe server is running constantly, its state is reset when it is restarted. The _cloud-cloud_ will connect to the server via a websocket connection, perform a pseudo-handshake and will receive display information broadcasted from the server from then on. Currently supported operation modes are `off`, `weather` and `manual`.\n\nIf you want to run this on a server somewhere out in the open, you might want to proxy the `http` endpoint behind nginx, serving it via `https` and use `wss` for the socket connection.\n\n### Protocol flow\n* The cloud-cloud connects to the cloud-cloud API via `ws://` on `device_port`\n* The cloud-cloud is expected to send the `auth_secret` to the server\n* When this \"handshake\" has been successful, the cloud-cloud API will send `ok`\n* Right after sending the `ok` packet, the server will also send its current state\n* After this, the API will send information to the cloud-cloud, whenever changes occur. The device only needs to ensure that connection is established, all display information will be broadcasted as packets from the server.\n\nHere is an example protocol flow of a client registering, performing a valid handshake, receiving initial state information, sending a ping and then receiving some further state information:\n```\n\u003cconnection established\u003e\nC \u003e auth-secret\nS \u003e ok\nS \u003e [cc:0:?:?]\nC \u003e ping\nS \u003e pong\nS \u003e [cc:2:255,65,174:0]\nS \u003e [cc:2:255,162,174:0]\nS \u003e [cc:2:69,162,174:0]\nS \u003e [cc:2:69,162,245:0]\nC \u003e d:This is a Debug-Message\n```\n\n### Protocol packets\nThe display packets transmitted from the server contain the following information:\n* `mode` Mode `0` is for off, this is the default when the server is started\n\n* `mode` Mode `1` is for weather information\n  * `weather` The current weather code, `1 - 9`\n  * `intensity` The current weather intensity `1 - 9` (can be float for _sunrise_/_sunset_)\n\n* `mode` Mode `2` is for manual color setting\n  * `color` The RGB value of the custom color to set `r,g,b`\n  * `pulse` Light pulsing intensity `1 - 9`\n\n* `command` Command `r` is for device reset\n* `command` Command `u` is for device firmware update\n* `command` Command `d` is for Debug-Messages. \n  * `State` The state of the Debug-Messages. 1 = On / 0 = Off.\n\n### Protocol format\nAside the text ping packets described below (not the ping layer ping packets), all packets sent will have the following format: `[cc:\u003cmode\u003e:\u003cparam1\u003e:\u003cparam2\u003e]`. Color information will be sent as `r,g,b`. Unknown or unused parameters will be filled with `?`.    \n\nExample off packet: `[cc:0:?:?]`   \nExample weather packet: `[cc:1:2:0]`   \nExample color packet: `[cc:2:255,255,255:0]`     \nExample reset packet: `[cc:r:?:?]`       \nExample update packet: `[cc:u:?:?]`   \nExample debug message: `[cc:d:1:?]` \n\n### Ensuring connection\nThe Server offers a permanent ping/pong handler in order for the client to check its connection. The client can send a ping via websocket with an arbitrary cookie at any time and should receive a pong from the server immediately, if it is still connected.    \nThe client can either send a proper websocket ping frame with an appropriate cookie, or just send a text packet with the content `ping` and should receive a text packet with the content `pong`.\n\n### Debug-messages\nWhen debug-messages ar enabled, the client sends all `ESP_LOGx(TAG, Message);` over Websocket connection.\nDebug messages are leaded by `d:`.\n\n### Weather states\n* `1` - Sunrise\n* `2` - Sunset\n* `3` - Clear Sky\n* `4` - Cloudy Sky\n* `5` - Rainy\n* `6` - Storm\n* `7` - Snow\n* `8` - Mist/Smoke/Sand/Dust\n* `9` - Windy\n\n### Webinterface\nYes, the whole [cloud-to-butt](https://github.com/panicsteve/cloud-to-butt) thing is still funny. No, we're not immature!\n\n![screen](http://s.cybrox.eu/s/20170707084638.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcybrox%2Fcloud-cloud-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcybrox%2Fcloud-cloud-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcybrox%2Fcloud-cloud-api/lists"}