Coder Social home page Coder Social logo

adyanth / homebridge-plugin-command Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 20 KB

This Homebridge plugin enables you to create virtual switches that can run any custom command when it is turned on or off.

License: Apache License 2.0

JavaScript 99.53% Dockerfile 0.47%

homebridge-plugin-command's Introduction

homebridge-plugin-command

This Homebridge plugin enables you to create virtual switches that can run any custom command when it is turned on or off.

How to use

Under Plugins > Homebridge Plugin Command > Settings, add an accessory and fill in the form!

By default, check_status assumes turned on if the exit code of the command is 0. Set invert_status to true to flip it. check_status command is optional, and if not provided, it just alternates as you turn it on and off. You can enable polling the check status and automatically pushing the change by setting the poll_check to number of seconds or in this format 1d2h3m4s.

If you like a JSON config, see the sample below.

{
  "accessory": "Command Accessory",
  "name": "File switch",
  "turn_on": "touch /tmp/testFile",
  "turn_off": "rm /tmp/testFile",
  "check_status": "ls /tmp/testFile",
  "poll_check": "5",
  "invert_status": false
}

homebridge-plugin-command's People

Contributors

adyanth avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

homebridge-plugin-command's Issues

Great!!!! Could it build a sensor, too?

It is great the idea and the way it is implemented, thanks!! Another way to trigger an action in homekit, perhaps even more subtle and more appropriate to simply tell HK something happened, could be a Sensor. A presence sensor, for example, so you wouldn't need to reset it after receiving and triggering something on HK

Button state not automatically updated in Home

If the button state gets changed from another device or an automation, the button state doesn't get updated in Apple Home without reloading that page. Once I switch pages and come back the button state is correct, but it seems there is no "push" of the button's status to Homekit once it's changed.

Characteristic 'On': SET handler returned write response value, though the characteristic doesn't support write response. See https://homebridge.io/w/JtMGR for more info.

Used to work perfectly and without changing anything in the config, automations stopped working.

Log:

| [6/15/2023, 5:53:53 PM] [Climate Automations] Setting Climate Automations switch state to:  false
homebridge    | [6/15/2023, 5:53:53 PM] [Climate Automations] Running: rm /tmp/climateAutomations 2> /dev/null
homebridge    | [6/15/2023, 5:53:53 PM] [Climate Automations] Returning: 0}
homebridge    | [6/15/2023, 5:53:53 PM] [homebridge-plugin-command-dev] Characteristic 'On': SET handler returned write response value, though the characteristic doesn't support write response. See https://homebridge.io/w/JtMGR for more info.
homebridge    | [6/15/2023, 5:53:53 PM] [homebridge-plugin-command-dev] Error: 
homebridge    |     at On.Characteristic.characteristicWarning (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:3011:105)
homebridge    |     at On.<anonymous> (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2557:18)
homebridge    |     at step (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:193:27)
homebridge    |     at Object.next (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:174:57)
homebridge    |     at fulfilled (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:164:62)
homebridge    |     at processTicksAndRejections (node:internal/process/task_queues:95:5)
homebridge    | [6/15/2023, 5:53:54 PM] [Climate Automations] Setting Climate Automations switch state to:  true
homebridge    | [6/15/2023, 5:53:54 PM] [Climate Automations] Running: touch /tmp/climateAutomations
homebridge    | [6/15/2023, 5:53:54 PM] [Climate Automations] Returning: 1}
homebridge    | [6/15/2023, 5:53:54 PM] [homebridge-plugin-command-dev] Characteristic 'On': SET handler returned write response value, though the characteristic doesn't support write response. See https://homebridge.io/w/JtMGR for more info.
homebridge    | [6/15/2023, 5:53:54 PM] [homebridge-plugin-command-dev] Error: 
homebridge    |     at On.Characteristic.characteristicWarning (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:3011:105)
homebridge    |     at On.<anonymous> (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2557:18)
homebridge    |     at step (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:193:27)
homebridge    |     at Object.next (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:174:57)
homebridge    |     at fulfilled (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:164:62)
homebridge    |     at processTicksAndRejections (node:internal/process/task_queues:95:5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.