Cmd4 is a plugin for [Homebridge] that lets you see what Homebridge and Homekit are all about, without actually owning a single accessory! For the more advanced user, Cmd4 brings CLI support for all accessories.
- About the Cmd4 Plugin
- How the Cmd4 Plugin Works
- Features
- Screenshots
- Installation
- Developer
- Todo
- Contributing
- Inspiration and special thanks
- License
- FAQ / Troubleshooting
- Rationale
This plugin allows you see what Homebridge is all about, without having any home control accessories. If you can run Homebridge and then install this plugin, all the possible accessories are now available to you within HomeKit or Eve. (Except Camera Streaming).
Similiar to other command plugins, you can use Cmd4 to execute command line interface (CLI) scripts, but with CMD4 the devices don't just appear in HomeKit as a Switch or a Light, but now they can appear as a Garage Door openner, Air Purifier ... and you can cntrol all of their characteristics too.
Cmd4 comes with a fully populated and documented config.json file that points to a fully populated and configured State.js file that you put in a Cmd4Scripts subdirectory of your .homebridge directory. The Cmd4 Plugin reads and understands the config.json file containing every possible HomeKit type. When you point HomeKit to Homebridge, all the devices become populated, and between the homebridge-cmd4 plugin and the State.js command file, HomeKit acts and behaves if you actually have the Accessory you don't actually have.
Cmd4 supports, Lights, Garage Door Openners, Lights, Outlets, Switches, Lock Maintenance Systems, Lock Management Systems, Humidity Sensors, Doors, Light Sensors, Temperature Sensors, Contact Sensors, Motion Sensors, Thermostats, Security Systems, Battery Services, Filter Maintenance Systems, Air Purifiers ... everything but Camera Streaming since it is not pliable to a command line Interface.
Cmd4 also supports polling, though care was taken to make sure accessories get updated after an adjustable response time so that accessories like a garage door is updated in HomeKit after it was closed or openned.
Cmd4 can be configured to respond to actual devices directly or by modofying the script file it calls.
Install homebridge using npm install -g homebridge
.
Install this plugin using npm install -g homebridge-cmd4
.
mkdir .homebridge/Cmd4Scripts
cp State.js .homebridge/Cmd4Scripts/State.js
chmod 700 .homebridge/Cmd4Scripts/State.js
There is a copy of State.js in the Extras folder that comes with the homebridge-cmd4 plugin.
Use the provided config.json file or add it to your own.
There is a fully populated copy of both config.min.json and config.json in the Extras folder that comes with the homebridge-cmd4 plugin. You can use it, or copy from it as it is a lot of typing.
Start/Restart Homebridge as you normally would.
If you are not already familiar with Homekit, you may wish to look at the documentation for Homebridge and how to configure it with Homekit. The gist of it is that you entet the manual code defined in the config.json file. I chose 5555555 for simplicity.
If you installed and setup things correctly you should now see icons in the Homekit app for you to play with.
-
The provided jsmin differs from others in that the resulting file format is still readable. Only C and C++ comments are removed. The includ config.json is created via:
jsmin < config.min.json > config.json -
The parameters to the script pointed to by the 'state_cmd' in your config.json file (Default being the provided State.js file) are:
Get < Accessory Name > < Characteristic >
Set < Accessory Name > < Characteristic > < Value > -
Polling is supported, but even without polling, care was taken so that even after closing a garage door for instance, Homekit gets updated that the door was closed.
-
Using the provided jsmin tool to strip out the comments, your ready to go and try Fans, Switches, Garage Doors, Locks, Sensors ....Todo
- Referred devices, i.e. a smoke detectors battery is not yet linked.
- Support multi word device names.
-
Homebridge is expected to run from a users home directory. where it can find the .homebridge directory and indirectly the homebridge/Cmd4Scripts.State.js command file.
-
The State.js command file must be executable. it can be tested via:
cd $HOME
node .homebridge/Cmd4Scripts/State.js Get My_Fan On
this should output: 0 -
Have a look at the State.js file, all the settable characteristics are very well documented there.
4) You can also run: DEBUG=* homebridge -I
- Try executing the State.js script
cd $HOME node .homebridge/Cmd4Scripts/State.js Get My_Fan On
This should output '0' or '1'
Best ways to contribute
- Star it on GitHub - if you use it and like it please at least star it :)
- Promote
- Open issues/tickets
- Submit fixes and/or improvements with Pull Requests
Like the project? Please support to ensure continued development going forward:
- Star this repo on [GitHub][homebridge-cmd4-repo]
- Follow the repo on [GitHub][homebridge-cmd4-repo]
- Follow me
Contributions and Pull Requests are welcome.
After playing with homebridge-cmd and then homebridge-cmdswitch2, I really wanted to control as much as I could. I did not have all the devices, but I did have a light and a Sony Android TV. I wanted to control these and see what else I could do. If you were wondering what happenned to version 3, well I learned a lot, hence the working cmd4.
Based on the best of:
- [homebridge-cmd]https://github.com/senyoltw/homebridge-cmd.git
- [homebridge-cmdswitch2]https://github.com/luisiam/homebridge-cmdswitch2.git
- [homebridge-real-fake-garage-doors]https://github.com/plasticrake/homebridge-real-fake-garage-doors.git
- [homebridge-homeseer]https://github.com/jrhubott/homebridge-homeseer.git
See LICENSE