{"id":30140272,"url":"https://github.com/biotinker/viam-sensor-host","last_synced_at":"2025-08-11T03:35:52.021Z","repository":{"id":306477146,"uuid":"1026333367","full_name":"biotinker/viam-sensor-host","owner":"biotinker","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-25T17:56:34.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-26T00:17:12.168Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/biotinker.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,"zenodo":null}},"created_at":"2025-07-25T17:47:26.000Z","updated_at":"2025-07-25T17:56:38.000Z","dependencies_parsed_at":"2025-07-26T00:17:55.431Z","dependency_job_id":"a00dc715-123e-4818-8323-19a553bf5a46","html_url":"https://github.com/biotinker/viam-sensor-host","commit_stats":null,"previous_names":["biotinker/viam-sensor-host"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/biotinker/viam-sensor-host","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biotinker%2Fviam-sensor-host","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biotinker%2Fviam-sensor-host/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biotinker%2Fviam-sensor-host/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biotinker%2Fviam-sensor-host/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biotinker","download_url":"https://codeload.github.com/biotinker/viam-sensor-host/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biotinker%2Fviam-sensor-host/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269827158,"owners_count":24481483,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-08-11T03:35:51.279Z","updated_at":"2025-08-11T03:35:52.005Z","avatar_url":"https://github.com/biotinker.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Module sensor-host \n\nThis module hosts sensor readings on a web server, providing JSON data via HTTP. It periodically collects readings from configured sensors on the same robot and serves them as JSON files accessible through a simple HTTP server.\n\n## Model biotinker:sensor-host:sensor-host\n\nThe sensor-host component takes a list of sensors and exposes their readings via an HTTP server on a specified port. Each sensor's readings are stored in individual JSON files that are updated at regular intervals.\n\n### Configuration\nThe following attribute template can be used to configure this model:\n\n```json\n{\n  \"sensors\": [\"sensor1\", \"sensor2\"],\n  \"port\": 8080,\n  \"refresh\": 5.0\n}\n```\n\n#### Attributes\n\nThe following attributes are available for this model:\n\n| Name      | Type     | Inclusion | Description                                    |\n|-----------|----------|-----------|------------------------------------------------|\n| `sensors` | []string | Required  | List of sensor component names to monitor     |\n| `port`    | int      | Required  | HTTP port to serve JSON files (1-65535)       |\n| `refresh` | float    | Optional  | Refresh interval in seconds (default: 5.0)    |\n\n#### Example Configuration\n\n```json\n{\n  \"sensors\": [\"my-sensor\", \"temperature-sensor\", \"humidity-sensor\"],\n  \"port\": 8080,\n  \"refresh\": 3.0\n}\n```\n\n### Usage\n\nOnce configured, the sensor host will:\n\n1. Create temporary directories for each sensor in `/dev/shm/`\n2. Start an HTTP server on the specified port\n3. Periodically call `get_readings()` on each sensor\n4. Save readings to JSON files at `/{sensor_name}/current.json`\n\nYou can access sensor readings via HTTP:\n- `http://robot-address:8080/sensor1/current.json`\n- `http://robot-address:8080/sensor2/current.json`\n\n### DoCommand\n\nThe sensor host supports the following DoCommand operations:\n\n#### Status Command\n\nGet the current status of the sensor host:\n\n```json\n{\n  \"status\": true\n}\n```\n\nResponse:\n```json\n{\n  \"running\": true,\n  \"port\": 8080,\n  \"sensors\": [\"sensor1\", \"sensor2\"],\n  \"refresh_interval\": 5.0,\n  \"temp_dir\": \"/dev/shm/sensor_host_xxx\"\n}\n```\n\n#### Refresh Command\n\nForce an immediate refresh of all sensor readings:\n\n```json\n{\n  \"refresh_now\": true\n}\n```\n\nResponse:\n```json\n{\n  \"message\": \"Sensor readings refreshed\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiotinker%2Fviam-sensor-host","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiotinker%2Fviam-sensor-host","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiotinker%2Fviam-sensor-host/lists"}