dubocr / homebridge-gpio-device

Homebridge GPIO device expose several HomeKit accessories interacting with GPIO
Apache License 2.0
65 stars 22 forks source link

Push button request #46

Closed toshibochan closed 5 years ago

toshibochan commented 5 years ago

I have request if possible to do push button for trigger other devices or senes?

Thank you

dubocr commented 5 years ago

You have 2 options depending on what you want to do :

  1. Use a DigitalInput sensor like ContactSensor

    {
    "accessory": "GPIODevice",
    "name": "Push Button",
    "type": "ContactSensor",
    "pin": 4
    }

    Then create an HomeKit automation to trigger devices or scenes when the sensor is "triggered". You will have one physical input (pin 4), which will trigger other HomeKit devices/scenes (via automation).

  2. Use a DigitalOutput sensor like Switch and add inputPin mirror

    {
    "accessory": "GPIODevice",
    "name": "Push Button",
    "type": "Switch",
    "pin": 5,
    "inputPin": 4,
    }

    Then create an HomeKit automation to trigger devices or scenes when the switch is "under control". You will have one physical input (pin 4) which will trigger the switch (which triggers the physical output (pin 5)) and other HomeKit devices/scenes (via automation).

Best is tell me what you want to do and I'll tell you what to configure as I don't know if "push button" is a physical push button (plugged to RPI) or a logical one (visible in HomeKit).

dubocr commented 5 years ago

Ho, there is also a third option I think it's what you need but it's not ready yet. It's only an input and you will configure what devices/scenes to trigger when pressed, long pressed or double pressed. Is it what you're looking for ?

dubocr commented 5 years ago

It's now ready. You can update the plugin sudo npm update -g homebridge-gpio-device and try this config

{
    "accessory": "GPIODevice",
    "name": "Push Button",
    "type": "StatelessProgrammableSwitch",
    "pin": 5
}

You'll then have a switch to configure for press, double press and long press action.

toshibochan commented 5 years ago

Thank you very much!!!!! I will try when I back home!!!!

gioz73 commented 5 years ago

Hi, after update plugin I have this error: homebridge.service - Node.js HomeKit Server Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Mon 2019-03-11 09:43:23 UTC; 6s ago Process: 29389 ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE) Main PID: 29389 (code=exited, status=1/FAILURE)

Mar 11 09:43:23 raspberrypi systemd[1]: homebridge.service: Unit entered failed state. Mar 11 09:43:23 raspberry systemd[1]: homebridge.service: Failed with result 'exit-code'.

Could you help me?

gioz73 commented 5 years ago

after reboot, I have this message (all home bridge accessory in app home are not responding):

● homebridge.service - Node.js HomeKit Server Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2019-03-11 09:52:01 UTC; 1s ago Main PID: 747 (homebridge) CGroup: /system.slice/homebridge.service ├─747 homebridge ├─753 /bin/sh -c /bin/echo -n "$(npm --no-update-notifier -g prefix)/lib/node_modules" └─754 npm

Mar 11 09:52:01 raspberrypi systemd[1]: Started Node.js HomeKit Server.

dubocr commented 5 years ago

Hi @gioz73,

You have to get logs with the command sudo journalctl | grep homebridge as the one provided are incomplete. You'll have to scroll back until error concerning this plugin.

gioz73 commented 5 years ago

Hi, solved. There was a problem in the config.json ..sorry. Removed this line work but now I have a problem with sensor in garage door, I have open sensor pin but plugin don't read status. As soon as I give the opening command, the icon shows open

dubocr commented 5 years ago

Can you update the plugin and retry please. sudo npm update -g homebridge-gpio-device

toshibochan commented 5 years ago

This is my config and is working great! Thanks

"accessory": "GPIODevice", "name": "Gate", "type": "GarageDoorOpener", "pin": 5, "inverted": "false", "pulseDuration": 500, "closeSensorPin": 3

dubocr commented 5 years ago

Perfect, just be careful of the inverted parameter. I am not certain it’s considered as false. Are you using a normally open contact sensor for the closed position ?

Thanks