{"id":17329151,"url":"https://github.com/jshiell/piwaverf","last_synced_at":"2025-02-25T19:30:50.256Z","repository":{"id":53520710,"uuid":"263031709","full_name":"jshiell/piwaverf","owner":"jshiell","description":"Building a LightwaveRF Hub with a Raspberry Pi","archived":true,"fork":false,"pushed_at":"2021-10-14T09:54:39.000Z","size":163,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-01T10:28:49.468Z","etag":null,"topics":["home-automation","lightwaverf","python3","raspberry-pi"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jshiell.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}},"created_at":"2020-05-11T12:09:34.000Z","updated_at":"2024-02-07T11:44:14.000Z","dependencies_parsed_at":"2022-09-03T12:00:29.548Z","dependency_job_id":null,"html_url":"https://github.com/jshiell/piwaverf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshiell%2Fpiwaverf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshiell%2Fpiwaverf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshiell%2Fpiwaverf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jshiell%2Fpiwaverf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jshiell","download_url":"https://codeload.github.com/jshiell/piwaverf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240732646,"owners_count":19848727,"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":["home-automation","lightwaverf","python3","raspberry-pi"],"created_at":"2024-10-15T14:26:20.939Z","updated_at":"2025-02-25T19:30:49.936Z","avatar_url":"https://github.com/jshiell.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PiWaveRF\n\nTurning a Raspberry Pi into a LightwaveRF hub.\n\nThis allows the Pi to partially emulate a first-generation [LightwaveRF](https://api.lightwaverf.com/introduction_basic_comms.html) hub. Essentially it takes UDP traffic and turns it into 433Mhz signals to the devices, allowing you to replace the Hub. The major goal with to get it working with [Homebridge](https://homebridge.io) via [the LightwaveRF plugin](https://github.com/rooi/homebridge-lightwaverf).\n\nThis is very much in debt to [Robert Tidey's LightwaveRF work](https://github.com/roberttidey/LightwaveRF), and uses his transmission logic.\n\n## Limitations\n\n* It only supports the dimmable light switches, as that's all I have to use or test with.\n* It doesn't support any over-internet functionality (e.g. the LightwaveRF app or the Alexa integration), as that depends on server-side functionality. However, the use of Homebridge to expose it to Apple's Homekit works around this for my use case.\n\n## Required hardware\n\n* A [433Mhz transmitter module](https://www.amazon.co.uk/gp/product/B07B9KV8D9/)\n* 3 x [Female-to-female jumper cables](https://www.amazon.co.uk/gp/product/B01EV70C78/)\n* A [Raspberry Pi](https://www.raspberrypi.org/products/), in my case a 3B+.\n\n## Wiring\n\nGiven the [GPIO port](https://www.raspberrypi.org/documentation/usage/gpio/):\n\n* Data to pin 12 (GPIO18)\n* 5V to pin 1 (5V)\n* Ground to pin 3 (Ground)\n\nIt's also worth adding on an antenna to the board - 170mm of wire should be about a quarter-wavelength.\n\n![Transmitter with pins highlighted](docs/transmitter.jpg)\n\n## Prerequisies\n\n* [Rasbpian](https://www.raspberrypi.org/downloads/) 10.3 (in this case, shouldn't be particularly tied to it)\n* Python 3\n  \n  ```bash\n  sudo apt install python3\n  ```\n* [Pigpio](http://abyz.me.uk/rpi/pigpio/):\n\n   ```bash\n   sudo apt install pigpio\n   sudo systemctl enable pigpiod\n   sudo systemctl start pigpiod\n   ```\n\n## Configuration\n\nFirstly, you'll need to set up your device mappings. This maps from the names used by the UDP protocol to the IDs used by the radio protocol. To do this we use a YAML file in a subset of the format used by Paul Clarke's popular [LightwaveRF Gem](https://github.com/pauly/lightwaverf).\n\n```yaml\nroom:\n- name: A Room\n  device:\n  - name: Telly Lights\n    id: D7\n  - name: Door Lights\n    id: D2\n- name: Another Room\n  device:\n  - name: Lights\n```\n\nThe IDs of the rooms and devices will be determined by the `id` attribute (only the numeric part will be used), or the index within the list if no `id` is present. e.g. `A Room`/`Telly Lights` would be `room_id=1` and `device_id=7`. `Another Room`/`Lights` would be `room_id=2` and `device_id=1`.\n\nYou can have up to 8 rooms, and up to 15 devices per room. The protocol allows for more rooms, but I believe this matches the limits imposed by the app.\n\n```bash\npip install -r requirements.txt\npywaverf/main.py --help # show usage info\n```\n\nYou'll need to ensure your devices are paired, or they'll ignore the messages from the hub. Make sure the device is in pairing mode before doing so, or the message will have no effect.\n\n```bash\npywaverf/main.py pair --room 'A Room' --device 'Door Lights'\n```\n\nOnce paired, you can test by sending messages directly:\n\n```bash\npywaverf/main.py on --room 'Another Room' --device 'Lights' # turn a paired unit on\npywaverf/main.py off --room 'Another Room' --device 'Lights' # and off again\n```\n\nYou can finally start the listener for UDP messages:\n\n```bash\npywaverf/main.py listen\n```\n\nYou can then send test messages with the [LightwaveRF Gem](https://github.com/pauly/lightwaverf), or via `netcat`:\n\n```bash\necho '666,!R1D5F1|ignored|ignored' | nc -w 1 -u \u003caddress-of-listening-host\u003e 9760 # turn room 1 device 5 on\necho '666,!R1D5F0|ignored|ignored' | nc -w 1 -u \u003caddress-of-listening-host\u003e 9760 # turn room 1 device 5 off\n```\n\n## Daemon installation\n\nOnce you have the pairing and the mappings file in place, you can install the listening daemon via the Makefile. This will run it via Systemd, and will install the required Python packages to your system environment.\n\n```bash\nsudo make install\nsudo systemctl start piwaverf\n```\n\n## References\n\n* [433Mhz protocol](https://github.com/roberttidey/LightwaveRF/blob/master/LightwaveRF433.pdf)\n* [Official Lightwave RF docs](https://api.lightwaverf.com/introduction_basic_comms.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjshiell%2Fpiwaverf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjshiell%2Fpiwaverf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjshiell%2Fpiwaverf/lists"}