{"id":26628324,"url":"https://github.com/bbartling/bacnet-web-weather-linux","last_synced_at":"2025-03-24T12:30:13.161Z","repository":{"id":282584350,"uuid":"948604663","full_name":"bbartling/bacnet-web-weather-linux","owner":"bbartling","description":"This is a Python based BACnet app on embedded for giving the BAS web weather data...","archived":false,"fork":false,"pushed_at":"2025-03-18T13:52:54.000Z","size":80,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-03-18T14:42:57.984Z","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/bbartling.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":"2025-03-14T16:19:15.000Z","updated_at":"2025-03-18T13:52:59.000Z","dependencies_parsed_at":"2025-03-18T14:43:01.869Z","dependency_job_id":null,"html_url":"https://github.com/bbartling/bacnet-web-weather-linux","commit_stats":null,"previous_names":["bbartling/bacnet-weather-station","bbartling/bacnet-web-weather-linux"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbartling%2Fbacnet-web-weather-linux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbartling%2Fbacnet-web-weather-linux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbartling%2Fbacnet-web-weather-linux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbartling%2Fbacnet-web-weather-linux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbartling","download_url":"https://codeload.github.com/bbartling/bacnet-web-weather-linux/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245269576,"owners_count":20587805,"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":[],"created_at":"2025-03-24T12:30:12.576Z","updated_at":"2025-03-24T12:30:13.154Z","avatar_url":"https://github.com/bbartling.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 **BACnet Weather Station Setup Guide**\n\nThis is a Python-based BACnet app optimized for embedded systems to provide BAS web weather data using OpenWeatherMap API.\n\n---\n\n## 🛠️ **Prerequisites**\n- Raspberry Pi with Armbian Minimal / IoT image\n- Python 3, `pip`, and virtual environment support\n- SSH access\n\n---\n\n📖 **Skip right to the Docker Documentation:**  \n[🐳 Docker README](https://github.com/bbartling/bacnet-web-weather-linux/blob/develop/docker_readme.md)\n\n---\n\n## 🔄 **Step 1: Download and Install Armbian**\n\n1. Download the latest Armbian Minimal / IoT image:\n   - [Armbian Raspberry Pi 4B](https://www.armbian.com/rpi4b/)\n\n2. Burn the image to an SD card using Raspberry Pi Imager.\n\n---\n\n## ⚙️ **Step 2: Initial Setup**\n\n1. Insert the SD card into the Raspberry Pi and power it up.\n2. Connect to the Pi via SSH:\n\n```bash\nssh root@192.168.1.224\n```\n\n- Default username: `root`\n- Default password: `1234`\n\n3. Complete the Armbian setup and create a new user (e.g., `ben`).\n\n---\n\n### 📦 **Step 3: Install Required Packages**\n\n```bash\nsudo apt update\nsudo apt install vim git python3 python3-venv python3-pip -y\n```\n\n---\n\n### 🔐 **Step 4: Setup Secure SSH Access**\n\n1. On your Windows machine, generate an SSH key:\n\n```powershell\nssh-keygen -t rsa -b 4096 -C \"ben.bartling@gmail.com\"\n```\n\n2. Retrieve and copy the public key:\n\n```powershell\nGet-Content ~\\.ssh\\id_rsa.pub\n```\n\n3. On the Raspberry Pi, set up the SSH keys:\n\n```bash\nmkdir -p ~/.ssh\nnano ~/.ssh/authorized_keys\n```\n\n4. Paste the public key, save, and set permissions:\n\n```bash\nchmod 600 ~/.ssh/authorized_keys\nchmod 700 ~/.ssh\n```\n\n5. Disable root SSH login:\n\n```bash\nsudo nano /etc/ssh/sshd_config\n```\n- Set `PermitRootLogin no`.\n- Restart SSH:\n\n```bash\nsudo systemctl restart sshd\n```\n\n---\n\n### 🧪 **Step 5: Test SSH Login**\n\n```bash\nssh ben@192.168.1.224\n```\n\nEnsure root login is disabled by attempting:\n\n```bash\nssh root@192.168.1.224\n```\n\nYou should receive a \"permission denied\" message.\n\n---\n\n### 🛠️ **Step 6: Clone the Repository \u0026 Set Up Python Environment**  \n\n#### 📥 **Clone the Repository**\n```bash\ngit clone https://github.com/your-repo/bacnet-weather-station.git\ncd bacnet-weather-station\n```\n\n#### 🐍 **Create \u0026 Activate a Virtual Environment**\n```bash\npython3 -m venv env\nsource env/bin/activate\n```\n\n#### 📦 **Install Required Dependencies**\n```bash\npip install -r requirements.txt\n```\n\n🔹 *This ensures the BACnet weather app runs in an isolated environment with all necessary dependencies installed.*\n\n#### 🐳 **Prefer Docker?**  \nIf you'd rather run this in a container, check out the **[Docker Setup Guide](https://github.com/bbartling/bacnet-web-weather-linux/blob/develop/docker_readme.md)**. 🚀\n\n---\n\n### ⚙️ **Step 7: Create `.env` File for API Key**\n\n```bash\nnano .env\n```\n\nAdd the following:\n\n```env\nOPENWEATHER_API_KEY=your_api_key_here\n```\n\n### ⚙️ **Step 7.1: Configure `config.py` for API Settings**  \n\nAfter setting up your `.env` file, you need to configure the **weather API settings** inside `config.py`.  \n\n#### ✏️ **Edit the Configuration File**\n```bash\nnano config.py\n```\n\n#### 🛠 **Update the Following Variables**\nMake sure the following settings are set inside `config.py`:\n\n```python\nLAT = 38.6246\nLON = -76.9391\nAPI_URL = \"https://api.openweathermap.org/data/2.5/weather\"\n\n# Weather Data Update interval in seconds (20 minutes)\nINTERVAL = 1200  \n\n# OpenWeather API Configurations\nUNITS = \"imperial\"  # Options: 'standard', 'metric', 'imperial'\nLANG = \"en\"         # Language code for API responses\n```\n\n#### 🔍 **What Each Setting Does**\n- `LAT` / `LON` → Set the **latitude** and **longitude** for your weather data.  \n- `API_URL` → The **endpoint** for fetching weather data from OpenWeather.  \n- `INTERVAL` → How often (in **seconds**) the app fetches weather data (default: **20 minutes**).  \n- `UNITS` → Choose between `'standard'`, `'metric'`, or `'imperial'` for temperature units.  \n- `LANG` → Set the **language** for API responses (e.g., `\"en\"` for English).  \n\nAfter updating, **save and exit**:  \n- **For Nano**: Press `CTRL + X`, then `Y`, then `Enter`.  \n\n---\n\n\n### ⚙️ **Step 8: Running the BACnet Weather App**\n\n```bash\npython main.py --name BacnetWeatherStation --instance 3456789 --debug\n```\n\n* If you need to assign a static IP or unique port number, **bacpypes3** also supports assigning hard-coded [addresses](https://bacpypes3.readthedocs.io/en/stable/gettingstarted/addresses.html) which would be useful if your BACnet network is running on a unique port number.\n\n```bash\npython main.py --name BacnetWeatherStation --address 192.168.0.21/24:47809 --instance 3456789 --debug\n```\n\n---\n\n### 🖼️ **Step 9: BACnet Weather Station Screenshot**\n\nHere's a sample screenshot of the BACnet Weather Station in action:\n\n[![BACnet Weather Station Screenshot](https://github.com/bbartling/bacnet-weather-station/blob/develop/images/snip.png)](https://github.com/bbartling/bacnet-weather-station/blob/develop/images/snip.png)\n\n---\n\n\n### ⚡ **Step 10: Accessing the Microdot REST API**\nThe BACnet Weather Station also provides a **REST API endpoint** using **Microdot**.  \nThis allows external applications to retrieve **real-time weather data** in JSON format.\n\n#### 🔌 **API Endpoint**\n```http\nGET http://\u003cyour-device-ip\u003e:8080/status\n```\n\n#### 📡 **Example Request**\nChange `localhost` to the IP address of your Pi...\n```bash\ncurl http://localhost:8080/status\n```\n\n#### 🔍 **Example JSON Response**\n```json\n{\n  \"temperature\": 40.78,\n  \"humidity\": 32,\n  \"dew_point\": 13.23,\n  \"error\": \"inactive\",\n  \"wet_bulb\": 31.13,\n  \"timestamp\": \"2025-03-22T18:49:14.725541\",\n  \"lat\": 43.555,\n  \"lon\": -89.927\n}\n```\n\n#### 🛠️ **How It Works**\n- The API continuously updates weather data from OpenWeather.\n- You can **fetch current temperature, humidity, and dew point**.\n- The `error` field indicates if there were **issues fetching the data**.\n- The `timestamp` is updated every **INTERVAL** (default: 20 minutes).\n\n---\n\n### ✅ **You're All Set!**\nThe BACnet Weather Station now **broadcasts data** over BACnet **and** provides an easy-to-use REST API! 🚀🔥\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbartling%2Fbacnet-web-weather-linux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbartling%2Fbacnet-web-weather-linux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbartling%2Fbacnet-web-weather-linux/lists"}