{"id":29015313,"url":"https://github.com/rwbl/home-assistant-workbook-experiments","last_synced_at":"2026-05-11T07:48:45.765Z","repository":{"id":300789095,"uuid":"1004313519","full_name":"rwbl/Home-Assistant-Workbook-Experiments","owner":"rwbl","description":"Home Assistant Workbook Experiments","archived":false,"fork":false,"pushed_at":"2025-06-25T06:30:51.000Z","size":518,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-25T07:34:38.802Z","etag":null,"topics":["experiments","home-assistant","micropython","rpi-pico"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"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/rwbl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-06-18T12:41:09.000Z","updated_at":"2025-06-25T06:30:55.000Z","dependencies_parsed_at":"2025-06-25T07:36:29.954Z","dependency_job_id":"2f47bae9-6e0b-4612-98b8-96e25fd0439d","html_url":"https://github.com/rwbl/Home-Assistant-Workbook-Experiments","commit_stats":null,"previous_names":["rwbl/home-assistant-experiments-workbook","rwbl/home-assistant-workbook-experiments"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rwbl/Home-Assistant-Workbook-Experiments","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2FHome-Assistant-Workbook-Experiments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2FHome-Assistant-Workbook-Experiments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2FHome-Assistant-Workbook-Experiments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2FHome-Assistant-Workbook-Experiments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwbl","download_url":"https://codeload.github.com/rwbl/Home-Assistant-Workbook-Experiments/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwbl%2FHome-Assistant-Workbook-Experiments/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261953211,"owners_count":23235455,"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":["experiments","home-assistant","micropython","rpi-pico"],"created_at":"2025-06-25T21:05:45.935Z","updated_at":"2026-05-11T07:48:45.760Z","avatar_url":"https://github.com/rwbl.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Hawe – Home Assistant Workbook Experiments\n\n**Hawe** (short for **Home Assistant Workbook Experiments**) is an open, hands-on learning project designed to explore and experiment with micro-controllers and connected components — with a focus on learning **MicroPython**, **B4R**, and integrating with **Home Assistant**.\n\n\u003e 🛠️ **This is a Work in Progress**  \n\u003e I'm learning by doing — this project grows as I explore new hardware, tools, and ways to integrate with Home Assistant.  \n\u003e Expect things to change, get reorganized, or improved over time.  \n\u003e If you're experimenting too, feel free to fork and reuse!\n\nThis workbook is a practical guide for makers, tinkerers, and hobbyists who want to:\n\n- Build and simulate smart devices (e.g., environment sensors, LEDs, LCDs, switches)  \n- Integrate devices into **Home Assistant** using **MQTT** (manual or via MQTT Autodiscovery)  \n- Structure modular, reusable firmware using **MicroPython**, **B4R**, and other platforms  \n- Extend experiments across multiple platforms including Raspberry Pi Pico, ESP32, and desktop helpers  \n\n---\n\n## About This Project\n\nI created this project to deepen my understanding of **MicroPython**, **MQTT**, **Home Assistant**, and multi-platform embedded development — experimenting with microcontrollers such as the **Raspberry Pi Pico 1 \u0026 2 W** and **ESP32**, as well as desktop helpers using **B4J**.\n\nThe project combines:\n\n- Firmware examples in **MicroPython** (primarily for RP2040-based boards)  \n- ESP32 projects using **B4R** (Basic4Arduino) for expanded capabilities  \n- Java-based helper tools built with **B4J** to aid development and debugging  \n- Integration techniques for Home Assistant using MQTT and related automation  \n\n---\n\n## Repository Structure\n\nThis repository is organized to keep experiments and documentation clear across platforms:\n\n```\n/\n├── README.md             # This main overview and Home Assistant focused doc\n├── /MicroPython          # MicroPython-specific experiments and setup\n├── /B4R                  # B4R projects for ESP32 and similar MCUs\n├── /B4J                  # Java-based helper tools and utilities\n├── /Notes                # Additional docs, references, and design notes\n```\n\nExplore the subfolders for platform-specific instructions, examples, and libraries.\n\n---\n\n## Common Abbreviations\n\n| Abbreviation | Meaning                                         |\n|--------------|-------------------------------------------------|\n| Hawe         | Home Assistant Experiments Workbook             |\n| HA           | Home Assistant                                  |\n| MCU          | Microcontroller Unit (e.g., Pico2W, ESP32)      |\n| MQTT         | Message Queue Telemetry Transport               |\n| MQTTAD       | MQTT Autodiscovery (MQTT Discovery)             |\n| Pico         | Raspberry Pi Pico W H (RP2040) (version 1 or 2) |\n\n---\n\n## Available Experiments\n\n| Experiment                     | Description                                    | MicroPython | B4R |\n|-------------------------------|-------------------------------------------------|-------------|-----|\n| **HaWe_EnvSim**               | Simulates temperature, humidity, pressure       | ✅           | ✅   |\n| **HaWe_SHT20**                | Read SHT20 temperature, humidity, dewpoint      | ✅           | ✅   |\n| **HaWe_RotaryLight**          | Rotary Encoder with Push-Button                 | ✅           | ✅   |\n| **HaWe_WS2812B**              | Control a single LED                            | ✅           | ❌   |\n| **HaWe_WS2812B_TrafficLight** | Control 3 LEDs red, yellow, green               | ✅           | ❌   |\n| **HaWe_SolarInfo_OLED**       | Display Solar info on 0.96\" OLED display        | ✅           | ❌   |\n| **HaWe_SolarInfo_ePaper**     | Display Solar info on 2.66\" ePaper display      | ✅           | ❌   |\n| **HaWe_Pico_Status**          | Monitor your Raspberry Pi Pico W status         | ✅           | ❌   |\n| **HaWe_SolarInfo_LCD1602**    | Display Solar info on LCD1602 display           | ✅           | ❌   |\n| **HaWe_TM1637**               | 7-Segment Display                               | ❌           | 🕓   |\n| **HaWe_LCD2004**              | LCD 2004 Display                                | ❌           | 🕓   |\n| **HaWe_SR04**                 | Distance Sensor                                 | ❌           | 🕓   |\n| **HaWe_LegoTrain**            | Control LEGO® PowerFunctions train via Lovelace | ❌           | ✅   |\n| **HaWe_COSensor**             | Read DFRobot SEN0466 CO ppm, V, Temperature     | ❌           | ✅   |\n*(More experiments planned)*\n\n✅ = Completed, ❌ = Not planned, 🕓 = Planned, 🚧= In Progress\n\n---\n\n## Hardware\n\n- **Microcontrollers:** Raspberry Pi Pico 1 \u0026 2 W H (RP2040), ESP32  \n- **Example Modules:** SHT20 sensor, Rotary Encoder with Push-Button, WS2812B LEDs, various displays (LCD1602, OLED, ePaper)\n\n---\n\n## Software Stack\n\n- [MicroPython](https://micropython.org) v1.25.0  \n  - Includes modules like `neopixel`, `umqtt`  \n  - Custom modules:  \n    - `secrets.py`: Wi-Fi \u0026 MQTT credentials, base definitions  \n    - `connect.py`: Wi-Fi \u0026 MQTT connection logic  \n    - `utils.py`: Onboard LED control and utilities  \n- [B4R](https://www.b4x.com/b4r.html) for ESP32 projects  \n- [B4J](https://www.b4x.com/b4j.html) for Java helpers and tools  \n- [Thonny IDE](https://thonny.org) v4.1.7 for MicroPython development  \n- [Home Assistant](https://www.home-assistant.io) 2025.6.x  \n  - MQTT Integration  \n  - Mosquitto MQTT Broker  \n  - Node-RED (required by some experiments like Hawe_SolarInfo_OLED / ePaper)\n\n---\n\n## Structure and Naming Conventions\n\n### Experiments\n\nEach experiment resides in its own folder containing firmware, MQTT topic definitions, and optionally Home Assistant config files.\n\n**Example folder structure MicroPython experiment:**\n\n```\n14-Hawe_SHT20/\n├── main.py           # Experiment firmware code\n├── secrets.py        # Wi-Fi \u0026 MQTT credentials (user edited)\n├── connect.py        # Network \u0026 MQTT connect logic\n├── utils.py          # LED and utility functions\n├── README.md         # Experiment documentation\n```\n\n### Naming Conventions\n\n| Type                | Convention                       | Example                             |\n|---------------------|----------------------------------|-------------------------------------|\n| Project             | `Hawe`                           | Home Assistant Experiments Workbook |\n| Experiment          | `HaWe_Env`, `HaWe_SHT20`         | HaWeEnv (Env sensor), etc.          |\n| HA Entities         | `sensor.hawe_sht20_temperature`  | Follows experiment name             |\n| MQTT Topic Base     | `hawe_\u003cexp\u003e_\u003cproperty\u003e`          | `hawe/env/temperature`              |\n| Code Modules        | `HaWe_Env.py`, `HaWe_SHT20.py`   | Modular by design                   |\n\n---\n\n## MQTT Integration\n\nMQTT is the main communication protocol between devices and Home Assistant.\n\n### MQTT Autodiscovery\n\n**Example:** Create a switch called `testswitch`\n\nEntity configuration topic \u0026 payload.\n\n**Topic:**\n```\nhomeassistant/switch/hawe_testswitch/config\n```\n\n**Payload:**\n```json\n{\n    \"name\": \"Hawe Test Switch\",\n    \"default_entity_id\": \"testswitch\",\n    \"unique_id\": \"testswitch\",\n    \"state_topic\": \"hawe/testswitch/state\",\n    \"command_topic\": \"hawe/testswitch/set\",\n    \"payload_on\": \"1\",\n    \"payload_off\": \"0\",\n    \"device_class\": \"switch\",\n    \"device\": {\n        \"identifiers\": [\n            \"hawe_device_18\"\n        ],\n        \"name\": \"HaweDevice\"\n    }\n}\n```\n_Note:_ In older Home Assistant versions the `object_id` is used instead `default_entity_id`.\n\n**MQTT commands:**\n```bash\n# Publish auto-discovery config\nmosquitto_pub -h \u003cbroker_ip\u003e -u \u003cuser\u003e -P \u003cpass\u003e -t \"homeassistant/switch/hawe_testswitch/config\" -m '{...}' -r\n\n# Monitor switch state\nmosquitto_sub -h \u003cbroker_ip\u003e -u \u003cuser\u003e -P \u003cpass\u003e -t \"hawe/testswitch/state\" -v\n\n# Remove switch from HA\nmosquitto_pub -h \u003cbroker_ip\u003e -u \u003cuser\u003e -P \u003cpass\u003e -t \"homeassistant/switch/hawe/testswitch/config\" -n -r\n```\n\n### Manual MQTT Setup via YAML\n\nAdd to `hawe/mqtt/switches.yaml`:\n```yaml\n- name: \"Hawe Test Switch\"\n  default_entity_id: \"hawe_test_switch\"\n  unique_id: \"hawe_test_switch\"\n  state_topic: \"hawe/testswitch/state\"\n  command_topic: \"hawe/testswitch/set\"\n  payload_on: \"1\"\n  payload_off: \"0\"\n  device_class: \"switch\"\n  device:\n    identifiers: [\"hawe_device_18\"]\n    name: \"HaweDevice\"\n```\n\nThen reload MQTT and check your entities in Home Assistant.\n\n---\n\n## Future Topics\n\n- Custom MQTT-based Home Assistant devices and custom components  \n- BLE sensor integration (e.g., BMP280, VL53L0X)  \n- ESPHome integration options  \n- B4R and Arduino equivalents of Hawe experiments  \n\n---\n\n## Disclaimer\n\n- This project is developed for **personal, educational use only**.  \n- All experiments and code are provided _as-is_ and should be used **at your own risk**.\n- Any guides are provided _as-is_, without any guarantee or liability for errors, omissions, or misconfigurations.\n- Always test thoroughly and exercise caution when connecting hardware components or integrating with Home Assistant.\n\n**Trademarks**\n- LEGO® is a trademark of the LEGO Group of companies, which does not sponsor, authorize, or endorse this project.\n- The Bluetooth® word mark and logos are registered trademarks owned by Bluetooth SIG, Inc.\n- All trademarks are property of their respective owners.\n\n---\n\n## Credits\n\nSpecial thanks to:\n- The developers of **Home Assistant** — the open-source home automation platform\n- The creators and contributors of **MicroPython** and its ecosystem (e.g., umqtt, neopixel)\n- The **MicroPython** and **Home Assistant** communities for their knowledge sharing and tools\n- The team behind **B4X** (including **B4A**, **B4R** and **B4J**) for providing a powerful free development platform\n- All contributors of **B4X** libraries and community forums for their continued support and ideas\n\n---\n\n## License\n\nMIT License — use freely, adapt, and share.\n\n---\n\n## Author\n\nDeveloped by **Robert W.B. Linn** — powered by curiosity and AI assistance.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwbl%2Fhome-assistant-workbook-experiments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwbl%2Fhome-assistant-workbook-experiments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwbl%2Fhome-assistant-workbook-experiments/lists"}