{"id":18756149,"url":"https://github.com/maexled/mystrom-django-interface","last_synced_at":"2025-10-10T15:11:26.611Z","repository":{"id":37038584,"uuid":"502133483","full_name":"maexled/mystrom-django-interface","owner":"maexled","description":"The Django application is designed to help users view power usage charts for MyStrom and Shelly3EM devices.","archived":false,"fork":false,"pushed_at":"2025-05-29T19:48:51.000Z","size":628,"stargazers_count":0,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-29T20:43:18.819Z","etag":null,"topics":["django","django-rest-framework","mystrom","mystrom-switch","python","shelly-3em"],"latest_commit_sha":null,"homepage":"","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/maexled.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2022-06-10T17:51:18.000Z","updated_at":"2024-07-20T21:40:12.000Z","dependencies_parsed_at":"2024-11-07T17:52:34.363Z","dependency_job_id":null,"html_url":"https://github.com/maexled/mystrom-django-interface","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/maexled/mystrom-django-interface","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maexled%2Fmystrom-django-interface","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maexled%2Fmystrom-django-interface/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maexled%2Fmystrom-django-interface/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maexled%2Fmystrom-django-interface/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maexled","download_url":"https://codeload.github.com/maexled/mystrom-django-interface/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maexled%2Fmystrom-django-interface/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279004573,"owners_count":26083735,"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-10-10T02:00:06.843Z","response_time":62,"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":["django","django-rest-framework","mystrom","mystrom-switch","python","shelly-3em"],"created_at":"2024-11-07T17:35:28.541Z","updated_at":"2025-10-10T15:11:26.605Z","avatar_url":"https://github.com/maexled.png","language":"Python","readme":"## About the Project\n\nThe Django application is designed to allow users to view power usage charts for MyStrom and Shelly3EM devices. The application collects the current power usage data every 60 seconds, which is then used to calculate and present power usage charts to the user.\n\nThis project uses [TimeScaleDB](https://www.timescale.com/) as database. \nThe database is optimized for time-series data and this project uses queries which are only compatible with TimeScaleDB.\n\nThere are two main views: the Device view and the Result view. Here's what each view looks like:\n\n#### Device View\n\n![Device View](https://user-images.githubusercontent.com/39833217/219866064-89c24f07-c297-46cb-9003-b8dc2c2c39a0.png)\n\nIn the Device view, users can add new devices that they want to track. Once added, the device will be listed in the Devices table.\n\n#### Result View\n\n![Result View](https://user-images.githubusercontent.com/39833217/219866092-e4213690-3adf-4afd-a188-a7bbefdfc8fa.png)\n\nIn the Result view, users can view power usage charts for their devices. They can select the device they want to view data for, and then choose the date range they want to view data for.\n\n\n## Prerequisites\n\n* \\\u003e= python3.10 [Django Supported Python Versions](https://docs.djangoproject.com/en/5.0/releases/5.0/#python-compatibility)\n\n## Installation\n\n1. Clone the repo\n```sh\ngit clone https://github.com/maexled/mystrom-django-interface.git\ncd mystrom-django-interface/\n```\n2. Install needed python libraries\n```sh\npip install -r requirements.txt \n```\n\n## Environment Variables\n\nHere's a breakdown of all the environment variables that are being used in the Django application:\n\n- `DB_NAME`: Specifies the name of the database to use.\n- `DB_USER`: Specifies the username to use when connecting to the database.\n- `DB_PASSWORD`: Specifies the password to use when connecting to the database.\n- `DB_HOST`: Specifies the host to use when connecting to the database.\n- `DB_PORT`: Specifies the port to use when connecting to the database.\n- `SECRET_KEY`: Specifies the secret key to use for the Django application.\n- `ALLOWED_HOSTS`: Specifies a comma-separated list of hosts that are allowed to access the application.\n- `CORS_ORIGIN_ALLOW_ALL`: Specifies whether to allow all cross-origin requests.\n- `CORS_ORIGIN_WHITELIST`: Specifies a comma-separated list of whitelisted origins for cross-origin requests.\n- `CHART_TYPE`: Specifies the type of chart library to use, either `apexcharts` or `uplot`.\n- `TZ`: Specifies the timezone to use for the Django application.\n\nThe environment variables can be set in the `.env` file when running the application with docker-compose.\n\n### Chart Types\n\nThe `CHART_TYPE` environment variable specifies the type of chart library to use for the Django application. There are two options: `apexcharts` and `uplot`. Here are examples of what each chart type looks like:\n\n#### ApexCharts\n\n![ApexCharts Example](https://user-images.githubusercontent.com/39833217/219865603-48d5e207-5ba7-4d97-b784-579ec487aed4.png)\n\nApexCharts is a modern charting library that provides a wide range of chart types and features. However, it can have longer loading times when dealing with very large datasets.\n\n#### uPlot\n\n![uPlot Example](https://user-images.githubusercontent.com/39833217/219865544-9721bd75-73cb-40f4-8516-4a4ec52d21c1.png)\n\n\nuPlot is a lightweight and fast charting library that excels at handling large datasets with many data points. It's an ideal choice for applications that need to render charts with a lot of data, but with a smaller feature set.\n\n## Database migrations\n```sh\npython manage.py makemigrations\npython manage.py migrate\n```\n   \n## Run App\n```sh\npython manage.py collectstatic\npython manage.py runserver\n```\nStatic files are served with WhiteNoise.\n\n## Run with docker\n```sh\ndocker run \\\n   --name mystrom-interface \\\n   -p 8000:8000 \\\n   -e DB_NAME=db-name \\\n   -e DB_USER=username \\\n   -e DB_PASSWORD=password \\\n   -e DB_HOST=host \\\n   -e DB_PORT=port \\\n   -e SECRET_KEY=secretKey \\\n   -e ALLOWED_HOSTS=localhost,mysite.com \\\n   -e CORS_ORIGIN_ALLOW_ALL=False \\\n   -e CORS_ORIGIN_WHITELIST=http://localhost:8000,http://mysite.com \\\n   -e CHART_TYPE={apexcharts/uplot}\n   -e TZ=Europe/Berlin \\\n   ghcr.io/maexled/mystrom-django-interface\n```\nMake sure to replace the content in `{...}` with your variable of your choice.\n\n## Run with docker-compose and needed containers\n```sh\ndocker compose up\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaexled%2Fmystrom-django-interface","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaexled%2Fmystrom-django-interface","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaexled%2Fmystrom-django-interface/lists"}