{"id":15520730,"url":"https://github.com/proycon/lighthome","last_synced_at":"2026-06-28T19:31:18.979Z","repository":{"id":54354441,"uuid":"522222643","full_name":"proycon/lighthome","owner":"proycon","description":"Lightweight home automation scripts and programs, over MQTT (mirror of https://git.sr.ht/~proycon/lighthome)","archived":false,"fork":false,"pushed_at":"2026-05-21T18:30:00.000Z","size":281,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-05-22T03:37:45.452Z","etag":null,"topics":["home-automation"],"latest_commit_sha":null,"homepage":"https://git.sr.ht/~proycon/lighthome","language":"Shell","has_issues":false,"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/proycon.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-08-07T13:37:07.000Z","updated_at":"2026-05-21T18:30:06.000Z","dependencies_parsed_at":"2023-01-30T16:01:24.456Z","dependency_job_id":"128e0186-5342-44a6-91b7-057fe8319bc7","html_url":"https://github.com/proycon/lighthome","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/proycon/lighthome","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proycon%2Flighthome","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proycon%2Flighthome/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proycon%2Flighthome/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proycon%2Flighthome/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/proycon","download_url":"https://codeload.github.com/proycon/lighthome/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proycon%2Flighthome/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34901959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"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":["home-automation"],"created_at":"2024-10-02T10:29:08.695Z","updated_at":"2026-06-28T19:31:18.956Z","avatar_url":"https://github.com/proycon.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lighthome - Lightweight Home Automation\n\nThis repository contains part of my home automation configuration.\n\n## Introduction\n\nThough I'm using [Home Assistant](https://home-assistant.io) on the central\nserver at the heart of my home automation ([configuration\nhere](https://github.com/proycon/homeassistant-config)), I have various\nRaspberry Pis and other devices that are an integral part my home\nautomation system.\n\nTo keep things on the various devices as lightweight and as portable as\npossible, I wrote 'lighthome'. It consists of various shell scripts and some\nsimple programs to read/write several sensors. Central in the communication\nbetween all devices is the MQTT broker.\n\n## Architecture\n\n* `scripts/common/include.sh` - Defines common functions, including:\n    * ``mqtt_receiver *[handlers]*`` - Subscribes to MQTT and registers one or more handler scripts, takes care of reconnect logic in case of failures, parallelisation, and runs asynchronously\n    * ``mqtt_transmitter *[topic] [interval] [sender]* `` - Takes input and publishes it on MQTT, takes care of reconnect logic in case of failures, parallelisation, and runs asynchronously\n    * ``mqttpub *[topic]* *[payload]*``- Publish a single MQTT message\n* **handler scripts** (``scripts/mqtthandlers/*``) - Receives MQTT stream on standard input and should invoke scripts that perform the action by calling an action script. \n    * These scripts are sourced and everything inside should be run asynchronously!\n    * The script doesn't have to deal with MQTT itself, except if it wants to publish feedback (using ``mqttpub``)\n* **sender scripts** (``scripts/mqttsenders/*``) - Monitors some device/sensor (preferably via an independent action script or program) and then translates its output for MQTT (standard output) \n    * These scripts are run normally, either over and over at a specified interval or as a one-shot script that runs indefinitely by itself.\n    * Standard output serves as payload for MQTT (the script doesn't have to deal with MQTT itself)\n* **actions scripts and programs** (``scripts/``, ``programs/``) - Perform any action, completely MQTT unaware, can also be invoked independently from command line for low-level testing\n* `setup-raspberry-pi.sh` - Script to setup raspberry pi. For headless setup, first `sudo touch /boot/ssh` on the image, and add a `/boot/userconf.txt` with contents `homeautomation:$encryptedpw` where the password is encrypted with `openssl passwd -6`.\n    \n\nI decided on simple shell scripts to act as the glue between components and not\nopt for another layer in for example Python. In true UNIX-fashion each tool\nshould have a well defined task, be efficient, communicate over standard input\nand output, and not add any unnecessary complexity. I also tried to separate\nthe MQTT-logic from the logic addressing various sensors, so the latter can also be used independently.\n\nThe actual communication with MQTT is done via the excellent\n[mosquitto](https://mosquitto.org/) CLI clients (`mosquitto_sub` and\n`mosquitto_pub`) communicating with the mosquitto daemon running on the main server.\n\n## Devices\n\n### Raspberry Pi 1  (RaspiOS)\n\n* GPIO: 433.92Mhz Transmitter for lights (see also https://github.com/proycon/433mhzforrpi/)\n* GPIO: Door/doorbell sensors (wired, reed contacts)\n* GPIO: IR LED for remote control of TV/audio\n\n![GPIO wiring schematic](docs/pi1.svg)\n\n### Raspberry Pi 2 (RaspiOS) \n\n* GPIO: 433.92Mhz Transmitter for lights\n* GPIO: Door/window sensors (wired, reed contacts)\n* GPIO: Neopixels LED (WS2812B) for ambilight in living room\n* GPIO: IR LED for remote control of TV/audio\n* GPIO: IR Receiver\n* USB: [RFLink Transceiver](http://www.rflink.nl/), 433.92Mhz, based on Arduino Mega\n\n![GPIO wiring schematic](docs/pi2.svg)\n\n### Raspberry Pi 3 (RaspiOS)\n\n* GPIO: [DHT-22 temperature/humidity sensor](https://www.adafruit.com/product/385)\n* GPIO: Neopixels LED (WS2912B) fireplace ([video](https://www.youtube.com/watch?v=i18eXQIXzXg))\n* GPIO: [PIR sensor](https://www.adafruit.com/product/189)\n* GPIO: [MH-Z19 CO2 sensor](https://www.tinytronics.nl/shop/nl/winsen-mh-z19b-co2-sensor-met-kabel')\n* USB: [RFLink Transceiver](http://www.rflink.nl/), 868.3Mhz, based on Arduino Mega\n\n### Raspberry Pi 4 (RaspiOS)\n\n* GPIO: Neopixels LED (WS2912B)\n\n![GPIO wiring schematic](docs/pi4.svg)\n\n\n## History\n\nInitially I ran Home Assistant on these devices as well, but due to their\ndecision to remove GPIO support and the increased amount of unnecessary bloat\nwhich I don't need, I desired to go for a more lightweight approach and just\nwrite things from scratch.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproycon%2Flighthome","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproycon%2Flighthome","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproycon%2Flighthome/lists"}