anthonywebb / homebridge-cbus

CBus plugin for homebridge
MIT License
35 stars 20 forks source link

Bell Press Function #4

Closed xrsprint closed 7 years ago

xrsprint commented 7 years ago

Hello guys

just wondering if there is any way to enable the lighting group to act as a bell press or timer? i need something like this to be able to control shutter relays and also integration to my alarm system,

currently these groups are set as a lighting group however when turned on they turn off after a second. is there any way to specify this in the config.json file?

thanks

anthonywebb commented 7 years ago

This can be programmed directly into your devices. Right now I dont have a rules processor integrated yet, but it is something I am considering.

anthonywebb commented 7 years ago

I've got rules and tasks already built in this project, contemplating adding support for them here? Guess you could argue that this project isnt the right place for them. https://github.com/anthonywebb/node-cbus

gbrooker commented 7 years ago

You could use HomeKit. If you have an Apple TV on the network, you can add an "Automation" in the Home app. Create 'New Automation' then 'An accessory is controlled', and then as an action you can trigger another device, or a scene.

poldim commented 7 years ago

+1 on this. Use it to do momentary contacts that can be used to open front door, garage, shades, irrigation, and HVAC. Would be awesome if this could be added.

simonhac commented 7 years ago

+1

simonhac commented 7 years ago

@poldim @xrsprint i can now see how this wouldn't be difficult to add. can you please give add some more detail to your use cases? i just want to be sire there's not a better way.

what would it look like? the switch accessory looks like this on the main home app screen:

…and this when you go for details:

to define the accessory, i'd imagine that it'd look like this: { "type": "switch", "id": 28, "name": "My Switch", "duration":"1.5s" },

when clicked, the C-Bus device would be switched on, and then automatically be switched off after duration period.

are we happy to go with the 'switch' accessory? any other ideas? sound good?

(@xrsprint what's your alarm integration? i'm interested to understand how this feature would help.)

xrsprint commented 7 years ago

Hello Simon, thanks for your interest in this and looking at making this possible

Within C-Bus switches and DLT's when a group is added to it you have some options that can be done. the main Four are On/off, Dimmer, Bell Press and Timer

the advantage of using Bell press is its ability to control many other devices that aren't lights. the examples i run at my house are;

Roller door and Electric Gate: both of these operate on an OPEN/STOP/CLOSE scenario when there is a pulse trigger, when i set this up to be used on a cbus button the first press opens the roller door and if i don't press it again, the door will open fully. if i press the button again while the door is in motion it will stop the door midway and pressing again will close it.

Shutters: even though you have a shutter command in homebridge, you can also setup these to operate the same as above using the open/stop/close triggers.

with your question , "switch" to me is fine, however i have referred to it as Bell Press as this is what Clipsal use in their terminology, also Trigger and Pulse could also be used as switch could interpreted and on/off like a normal light.

With Regards to my alarm integration, i have a High level interface like homebridge, that Maps cbus groups to Virtual Relays on an Inner Range Integrity Alarm System. so basically when a Cbus group turns on a virtual relay also follows the group state. which then can perform things like arm the alarm and perform other functions.

the reason why i have mentioned my alarm panel is my roller door and Gate are actually connected to my alarm system. so this means when i press the gate or roller door groups in cbus which are setup as bell press, it pulses the virtual group in my alarm which controls the device using the open/stop/close method.

the interesting thing with this is i had a hard time getting my alarm to work with Homebridge as i was not aware that with homebridge the groups HAVE to be assigned to a cbus relay for homekit to work, in my system i have groups that are assigned to switches that are not assigned to a relay but work as virtual groups to the alarm panel, so for now to get functions working to my alarm i had to install a cbus 8ch low voltage relay and assign the alarm groups to the relay just so homekit would work, off topic, if there was a way this could be changed in some way the possibilities would be unbelievable for the work i do

so adding features to homebridge for the Alarm is not what i'm after, just more adding the Bell Press to assist in performing functions in the alarm from C-bus

if there is anything else i can assist with id be more than happy to help

thanks again

simonhac commented 7 years ago

@xrsprint thanks for your detailed response. i'll break it down:

1. bell press

it seems like homekit doesn't support momentary push button behaviour. i've looked through HomeKitTypes.js and the HomeKit Accessory Simulator and the best i can come up with is to use a switch that automagically turns itself off after a configurable period.

i tried to explain that above -- see images. i'd use a HomeKit switch, but call it a bell press accessory. do you think would that work?

2. virtual groups

i'd like to understand this issue better. how familiar are you C-Gate? if there's a C-Gate command that can control your virtual groups then it would be easy to address this.

let me know...

xrsprint commented 7 years ago

@simonhac Cheers mate, any way i can help

Bell Press, Calling it a switch is fine, and how you described will work where it turns off after a second or programmable time, this will also allow groups to be timed, e.g garden light on for 3 minutes

with the virtual groups, yes i can control groups that are not assinged to any cbus relay by using the on/of //PROCJECT/254/56/XX in cgate

any other info you need im glad to help

thanks

simonhac commented 7 years ago

@xrsprint if on //PROJECT/254/56/XX works for you in C-Gate (where XX is a 'virtual group address) then the light accessory should 'just work'.

if it doesn't then we might both be a bit confused here.

xrsprint commented 7 years ago

Hello Simon

what i have found is that if a group in CBUS is not assigned to a physical Relay or dimmer, when homekit is opened, it basically locks up and doesn't work

also i found that when when a Cbus group is not assigned to a relay, this message appears in homebridge log CBusStatusPacket { raw: '401 Bad object or device ID. ' , Channel: 'controlStream', type: 'unknown', source: 'cbus' }

if you need any more assistance, please let me know

simonhac commented 7 years ago

thanks @xrsprint -- one question: does C-Gate know about the group? ie. can you see it in the database with the C-Bus Toolkit?

i think this could be easy to fix. can i ask you to please write this up as a separate issue and i'll look into it?

simonhac commented 7 years ago

bell press functionality added (as switch with activeDuration) in v0.5.7.

xrsprint commented 7 years ago

thanks for your great work

to confirm i see the code is the following; "type": "switch", "id": "9", "name": "Garden Lights", "activeDuration": "2.5 hrs"

if you wanted it to run for seconds do you change "hrs" to "sec"?? or do you need to add more decimals?

simonhac commented 7 years ago

@xrsprint it's clearly too subtle, but i put a link to the ms library that i'm using -- see https://github.com/zeit/ms

valid units are:

if you omit units it'll assume milliseconds.

note that for the id you can remove the quotes around the number -- eg "id": 9. (but for the sake of backward compatibility we still allow "id": "9" format)