{"id":15018234,"url":"https://github.com/menahishayan/homescript","last_synced_at":"2025-10-23T17:31:15.944Z","repository":{"id":36076499,"uuid":"197956677","full_name":"menahishayan/HomeScript","owner":"menahishayan","description":"Python script for command line control of HomeBridge (HomeKit)","archived":false,"fork":false,"pushed_at":"2023-12-23T20:56:55.000Z","size":108,"stargazers_count":94,"open_issues_count":10,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-29T21:24:49.930Z","etag":null,"topics":["cli","command-line","home-automation","homebridge","homebridge-interface","homebridge-plugin","homekit","ios","lights","linux","modularity","python","python-script"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/menahishayan.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":"2019-07-20T16:39:16.000Z","updated_at":"2024-07-11T08:54:56.000Z","dependencies_parsed_at":"2024-08-01T16:42:35.007Z","dependency_job_id":null,"html_url":"https://github.com/menahishayan/HomeScript","commit_stats":{"total_commits":62,"total_committers":4,"mean_commits":15.5,"dds":"0.33870967741935487","last_synced_commit":"954335fe396e9863ee5cda922990b4bde1a1f014"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/menahishayan%2FHomeScript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/menahishayan%2FHomeScript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/menahishayan%2FHomeScript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/menahishayan%2FHomeScript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/menahishayan","download_url":"https://codeload.github.com/menahishayan/HomeScript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237861807,"owners_count":19378066,"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":["cli","command-line","home-automation","homebridge","homebridge-interface","homebridge-plugin","homekit","ios","lights","linux","modularity","python","python-script"],"created_at":"2024-09-24T19:51:42.856Z","updated_at":"2025-10-23T17:31:15.555Z","avatar_url":"https://github.com/menahishayan.png","language":"Python","readme":"# HomeScript\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/menahishayan)  \n\nPython script for command line control of [HomeBridge](https://github.com/nfarina/homebridge) (HomeKit)\n\nUsed to toggle Homebridge accessories On or Off via python script, no Home app required. You can set up a cronjob to enable automation, scripting and mimic other HomeKit functionalities\n\n**Note:** as of HomeScript 4.1 the minimum requirement is Python3+ and HomeBridge 1.x.x+\n\n## Examples\n`hs.py -s MainLight 0`  | Switch off  \n`hs.py -s MainLight 1`  | Switch on  \n`hs.py -s MainLight`   | Toggle  \n`hs.py -s lifx -hue 140` | RGB Lights Support  (brightness, hue, saturation, temperature)  \n`hs.py -s desk -b +10` | Increment/Decrement values\n\n## Easy Match\nThe script doesn't require full names of the accessories.  \n\n**For example**, if your light is called \"MainLight\", you can run:  \n`hs.py -s MainLight 0` or  \n`hs.py -s main 0`  \nThe script will automatically search for matching substrings and set the accessory value\n\n## Group Actions\nYou can set multiple accessories (of the same type) in a single command:  \n`hs.py -s all lights 1`  \n`hs.py -s all switches 0`  \n\n**Looking for maintainers: If you are interested in maintaining this project, feel free to reach out.** \n\n## Setup\n  Important: HomeBridge **must** be run in insecure mode for this script to work!\n\n#### Running HomeBridge in Insecure Mode\n - via Command Line\n```\nhomebridge -I\n```\n\n - via Systemd\n```\nHOMEBRIDGE_OPTS=-U /var/lib/homebridge -I\n```\n\n - via pm2\n```\npm2 stop homebridge; pm2 delete homebridge; pm2 start homebridge -- -I\n```\n\n## Installation\n  - Install the HomeScript API `pip install homescript` or `pip3 install homescript`\n  - On your client computer: Download **hs.py** and move it to a convenient location\n    - Edit the script to include your homebridge URL, port and authorization key\n    - Change permissions `chmod +x /path/to/hs.py` (on linux)\n\n## Usage\nUsage: `hs.py [option] [value]`\n### Options:\n - -l, --list    : Lists all available HomeKit accessories\n  - Usage: `hs.py -l [argument]`\n  - Arguments:\n    - \\\u003cnone\\\u003e : lists accessory names\n    - aid : lists accessory names with AID value\n    - iid : lists accessory names with IID value\n    - id : lists accessory names with AID and IID\n    - type : lists accessory names with type\n    - value : lists accessory names current state\n - -g, --get     :  [EasyMatch] gets current value of accessory\n   - Usage: `hs.py -g \u003caccessory-name\u003e`\n - -s, --set     :  [EasyMatch] toggles the accessory On or Off, or sets to the specified value\n   - Usage: `hs.py -s \u003caccessory-name\u003e [value]`\n   - Arguments:\n     - \\\u003caccessory-name\\\u003e : accessory that you want to change\n     - -b : adjusts accessory brightness\n     - -hue : adjusts accessory hue\n     - -sat : adjusts accessory saturation\n     - -t : adjusts accessory color temperature\n     - [value] : value that you want to set it to. Prefix +/- to inc/dec\n - all     :  Gets or sets value of multiple HomeKit accessories\n   - Usage: `hs.py -g all \u003caccessory-type\u003e`\nhs.py -s all \\\u003caccessory-type\\\u003e value\n - -d, --debug   : generates debug log file.\n   - Usage: `hs.py -d \u003ccommand\u003e`\n   - Eg: `hs.py -d -s all lights 0`\n - -h, --help    : prints usage info\n - -v, --version : prints HomeScript version\n\n## API\nAs of v5.1+ HomeScript is now a fully importable API\n```python\nimport homescript\n\n# Initialize with hostname, port and auth code. Debug and sys.argv are optional\nhs = homescript.HomeScript(hostname, port, auth, [debug], [sys.argv])\n\n# Select an accessory or group of accessories. Any get/set/print operation requires accessories to be selected first.\nhs.selectAccessory('mainlight')\nhs.selectGroup('lights')\n\nhs.printSelectedItems()\n\n# Operates on all selected items\nhs.setStates(1)\nhs.setValues('Brightness',250)\n```\n| Function | Description |\n| ----- | ----------------|\n| HomeScript( hostname: str, port: str, auth: str, debug: Boolean, argv: list ) | Constructor to initialize HomeBridge Connection. Debug: Set to `True` if you want to create debug and exception logfile. Default: None. argv: Only required if debug is `True` |\n| getAccessories() | Returns raw list of all available accessories on the Bridge |\n| selectAccessories( searchString: str ) | Saves matching accessory into selectedAccessories and returns them |\n| selectGroup( searchString: str ) | Saves all matching accessories into selectedAccessories and returns them |\n| printAccessories() | Prints all available accessories on the Bridge |\n| printSelectedItems() | Prints selectedAccessories |\n| getSelectedItems() | Returns selectedAccessories |\n| setStates(state: Boolean) | Sets `state` as the on/off value of all item(s) in selectedAccessories. If no argument is specified it toggles the state of all selectedAccessories |\n| setValues(attribute: str, value: int) | Sets numeric `value` to attribute of the item(s) in selectedAccessories. Attrubute: Brightness/Hue/Saturation/Color Temperature |\n| getVersion() | Does what it says on the can... |\n\n## Troubleshooting/Error Reporting/Contributing\nThe `debug` option helps generate a logfile for troubleshooting and error detection.  \n - If you face an error, open a new issue on this repo prefixed by [Error] describing the error and attach your **both** your debug log and your exception log, along with any other outputs you receive.\n - If you would like to help improve the tool or request features, open an issue prefixed by [Feature Request] describing the functionality.\n - You **must** attach your debug log or else your issue will be closed. A simple debug log can be obtained from `hs.py -d -l`\n\n## PRs and Commit Template\nPRs and commits that you make to this repo must include the following:  \n- Type: bug-fix or enhancement\n- Description: Brief description about what the commit achieves\n- Notes: (heads ups/pointers to other developers if necessary)\n\n\u003chr/\u003e\n\n## To Do\n☑️ Color control for RGB and Hue Lights  \n⬜️ Control for PositionOpeners, GarageDoorOpener, LockMechanism  \n⬜️ WebColors  \n☑️ Increment/Decrement values  \n☑️ Querying API interface to return status of devices to `stdout`  \n☑️ Automation creation, viewing and monitoring without Home Hub  \n\n\u003chr/\u003e\n\n## Changelog\n### v5.2\n - Added support for Increment/Decrement values\n - HS Automations and HS Apps are now deprecated\n\n### v5.1.1\n - Fixed import bug\n\n### v5.1\n - Rewritten from the ground up to be object oriented\n - Now features an importable API\n\n### v5.0\n- Support for RGB lights! Now lets you control brightness, hue, saturation and color temperature of your lights!\n- Added additional value format recognition\n- Device type detection\n- Updated accessory structure\n- Added smart toggle support for integer values\n- Added validity checks for integer values\n- Ignore bridge in accessory list\n- Updated listing format\n- Finer control over listing parameters for devices with multiple interfaces\n- Updated exclusive value-only listing for easier interfacing in programs\n- Cleaned up accessory name recognition\n- Backward compatibility with v4.x syntax for all devices\n\n### v4.1\n- Update to python 3\n- Update to support HomeBridge v1.0+\n\n### v4.0\n- Syntax update to be POSIX compliant\n- Get option to return item status\n- Introducing Automation and scripting support\n- Modularity and Third-party HomeScript Apps\n- Version logging\n- Improved Debugging\nNote: Some parts of release withheld until the next minor release\n\n### v3.0.2\n- Bug fix: HomeBridge was displayed as \"0\"\n\n### v3.0.1\n- Added debug support\n\n### v3.0\n- Added group actions. You can now set values for all matching accessory types\n\n### v2.2\n- Added json listing support\n\n### v2.1\n- Added type support to identify accessory type\n- Updated help doc\n\n### v2.0\n- List of accessories are now automatically fetched from the homebridge, instead of having to manually set them up in the script\n\n### v1.3\n- Added easy name matching\n\n### v1.2\n- Added help doc\n- Added listing\n\n### v1.1\n- Added toggling\n\n### v1.0\n- Initial release\n\n\u003chr/\u003e\n","funding_links":["https://www.paypal.me/menahishayan"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmenahishayan%2Fhomescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmenahishayan%2Fhomescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmenahishayan%2Fhomescript/lists"}