Apple homekit integration!

Discussion in 'Voice Control' started by ievolve, Nov 7, 2016.

  1. ievolve

    Moricild

    Joined:
    Aug 12, 2010
    Messages:
    6
    Likes Received:
    0
    Location:
    Melb
    I don't think that's the issue.

    For completeness, here is a snippet from the CGate logs that appears to show a successful request from homebridge-cbus to CGate and provision of accessories data by CGate to homebridge-cbus.

    Will post to GitHub too (not sure whether here or there is the right place for this).

    Thanks.

    20170312-214659 803 cmd5 - Host:/127.0.0.1 opened command interface from port: 49962
    20170312-214659 899 sys Debug: New Command Context: cc013 = AccessContext Session /127.0.0.1#6
    20170312-214659 766 cmd5 - Response: 201 Service ready: Clipsal C-Gate Version: v2.10.6 (build 3145) #cmd-syntax=1.0
    20170312-214659 761 cmd5 - Command: [99] events e7s0c0
    20170312-214659 766 cmd5 - Response: [99] 200 OK.
    20170312-214659 761 cmd5 - Command: [100] dbgetxml //SWINN/254
    20170312-214659 766 cmd5 - Response: [100] 343-Begin XML snippet
    20170312-214659 766 cmd5 - Response: [100] 344 End XML snippet
    20170312-214659 804 cmd5 - Host:/127.0.0.1 closed command interface from port: 49962​
     
    Moricild, Mar 12, 2017
    #81
  2. ievolve

    simonhac

    Joined:
    Jan 8, 2017
    Messages:
    51
    Likes Received:
    0
    Location:
    Melbourne
    interesting question -- here is probably the best place for general support questions, with github being the right place for bug reports. i realise that in some cases it's very hard to know whether a problem is a bug or not. no-one will object to you opening a ticket on github if you are stumped.

    (for those interested, the issue here is that the field `accesories` is misspelt. the next version of homebridge-cbus will specifically look for this type of error and give the user an easier to understand error message.)
     
    simonhac, Mar 14, 2017
    #82
  3. ievolve

    Moricild

    Joined:
    Aug 12, 2010
    Messages:
    6
    Likes Received:
    0
    Location:
    Melb
    Thanks - really appreciate your help. All working perfectly now.
     
    Moricild, Mar 14, 2017
    #83
  4. ievolve

    simonhac

    Joined:
    Jan 8, 2017
    Messages:
    51
    Likes Received:
    0
    Location:
    Melbourne
    homebridge-cbus v0.5.9 released

    heads up! homebridge-cbus v0.5.9 has been released.

    this version provides support for 'rampDuration' parameter on dimmer accessories -- allowing you to optionally specify a ramp duration for all operations on a dimmer circuit.

    please raise an issue ticket if you encounter any problems or have suggestions on how to make homebridge-cbus even better.
     
    simonhac, Mar 18, 2017
    #84
  5. ievolve

    Ambro

    Joined:
    Nov 23, 2010
    Messages:
    104
    Likes Received:
    1
    Location:
    Adelaide
    Works a treat now, thanks again. Any chance to have door control (lock / unlock) added to the list of things to do, cheers.
     
    Ambro, Mar 18, 2017
    #85
  6. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Hello simonhac
    It looks like you have been putting a bit of work into Homebridge CBus.
    I think someone asked before but I also don't know how to go about upgrading the Homebridge CBus version.
    Could you give some tips.
    Thanks
    Daryl
     
    DarylMc, Mar 19, 2017
    #86
  7. ievolve

    simonhac

    Joined:
    Jan 8, 2017
    Messages:
    51
    Likes Received:
    0
    Location:
    Melbourne
    lock mechanism service

    hi ambro -- very happy that it is working for you. i'm loving homebridge-cbus: it enables the kind of integration that i dreamt of when i installed my system 10 years ago. it has future-proofed a significant investment.

    regarding the door control: if you can let me know the CGate commands you'd use to lock/unlock the door and determine the current state, please raise an issue on github and i'll have a crack at it.

    fyi, the HomeKit lock mechanism service has the following states:
    see https://github.com/KhaosT/HAP-NodeJS/blob/master/lib/gen/HomeKitTypes.js#L944

    would be great to be able to differentiate between these states.

    -s
     
    Last edited by a moderator: Mar 19, 2017
    simonhac, Mar 19, 2017
    #87
  8. ievolve

    simonhac

    Joined:
    Jan 8, 2017
    Messages:
    51
    Likes Received:
    0
    Location:
    Melbourne
    hi daryl -- yep, i've been enjoying hacking on homebridge-cbus. i'm very grateful to anthony for working out how to write the plugin. i've just extended it and worked on robustness.

    open you favourite terminal application, cd into your homebridge-cbus directory and type `npm update`.

    that should do it.
     
    simonhac, Mar 19, 2017
    #88
  9. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Simon
    Thanks for the update tip and work you have put in too.
     
    DarylMc, Mar 19, 2017
    #89
  10. ievolve

    barranak

    Joined:
    Apr 2, 2016
    Messages:
    17
    Likes Received:
    0
    Location:
    spalding
    Fantastic

    Hi,

    I would also like to express my gratitude fro a fantastic plugin. It has enabled me to fully explore the kind of automation I had in mind when I decided to install cbus in my eco home 2 years ago.
     

    Attached Files:

    barranak, Mar 19, 2017
    #90
  11. ievolve

    Ambro

    Joined:
    Nov 23, 2010
    Messages:
    104
    Likes Received:
    1
    Location:
    Adelaide
    What does everyone else think??

    Ohhh - all I am after is the simple lock/unlock; I believe that my locks can detect some states, such as jammed, because it beeps like crazy when the door hasn't closed properly...!!

    However I haven't wired it into cbus for the fact it would over complicate things (ie. need a separate cbus component (coupler/aux input) rather than just a simple relay)

    I believe that 99% of installed cbus door control wouldn't detect the doors state and thus nullifying the requirement for cbushomebridge to include this - but I could be wrong.....!!!

    Anyone else have thoughts on this matter?
     
    Ambro, Mar 20, 2017
    #91
  12. ievolve

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,420
    Likes Received:
    62
    Location:
    Adelaide
    Remember Homekit is built around standalone IoT type devices, in this case like the Kwikset KeVo door lock.

    Most C-Bus systems handling door control would do it though a security system or some other access control system.

    I would assume that most of these would have a reed switch on the door that gives you door state, which, coupled with the info about the strike state (if you can control it) gives you enough info fudge an approximation..

    Door closed + strike inactive = secure
    Any door state + strike active = unsecure
    Door open + strike inactive = jammed?


    Nick
     
    NickD, Mar 20, 2017
    #92
  13. ievolve

    GlenF

    Joined:
    Jan 22, 2006
    Messages:
    130
    Likes Received:
    0
    Hi all,

    I have set this up for a door reed using a cbus 5104 input sensor. I have it bellpress triggered to a virtual relay that I have setup as a security sensor in Homebridge. It works great except it reads in reverse, ie say triggered when it is shut.

    Would be keen to know if anyone can suggest a way to have the sensor input bellpress the relay in reverse in Toolkit or a different way to setup Homebridge so it reads as triggered when it is open.


    Glen
     
    GlenF, Mar 23, 2017
    #93
  14. ievolve

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,420
    Likes Received:
    62
    Location:
    Adelaide
    Depending on the version of your bus coupler, you should be able to set the input as connected to a bistable switch, and then set the key function to Off/On.

    This sets the "Short Press" (== Just closed) to OffKey and the "Long Press" (== Just Opened) to OnKey.

    Nick
     
    NickD, Mar 24, 2017
    #94
  15. ievolve

    GlenF

    Joined:
    Jan 22, 2006
    Messages:
    130
    Likes Received:
    0
    Thanks Nick, didn't quite work as I needed.

    I sorted it by just switching the functions of the switch around (probably should have thought of that myself)

    Either way, I now have a door reed status in Homekit using the input sensor that triggers when the door is open.
     
    GlenF, Mar 24, 2017
    #95
  16. ievolve

    Ambro

    Joined:
    Nov 23, 2010
    Messages:
    104
    Likes Received:
    1
    Location:
    Adelaide
    Spot On!!

    You're most likely correct that most cbus controlled door locks have to go through an alarm panel or some other access control system.

    That requires a Homebridge <insert module here> interface. Being this topic is solely concerned with a Homebridge cbus module (with cbus group addresses controlling things) then...



    For the limited ability as a stock cbus system can offer the cbus network would have as a minimum a relay to open and close a door. Lets say 'open door' & 'close door'.

    A second level of input would have two group addresses (lets say 'strike inactive' & 'strike active' as per your example).

    The combined two would be something that would be great (hint, hint clipsal dev team..... :D)

    It is fantastic that GlenF has done it this way (or similar) and is using the bellbress as a group address which ultimately does something. Can you let us know what you do with this (does it send a warning email via cbus or does it link into your security system??).



    Anyway, I would love for the plugin to be able to (in order of importance):

    1. control a relay with a gooey picture of a door. simple. ohh and SIRI understands the command,"open/close <name> door".
    2. have another set of abilities which are controlled by the observed states of cbus group addresses.

    I type this because most of my clients, and I have, cbus couplers next to our electric door locks for doorbell and fob inputs. These can have up to four input states being monitored - and maybe I should always set this up, but....

    'In the real world' the observing of the door status is a security matter which I definitely would not let the cbus side of inputs take as measurements. I've explained to clients the ability to do this via, for example, an alarm panel is the way to go.

    I explain the cost difference of just simply having a relay open/close and then gauge whether they would want the certain door(s) in question to be monitored.

    Without Homebridge in the equation either the ultra security conscious (industrial/commercial) would say yes and have the alarm panel control the monitored zones or ...;-

    (Once again - in my experience) Most residential applications don't require monitored door states. People can open the door in front of them & close the door behind them. People think it's cool to open the door remotely....

    roller door, gate door, etc....

    for the trades person, pool cleaner, etc....

    Whomever you want - However - When you're not at home....

    You need to remember it's a security issue - you or they need to disarm the alarm. Most people, in my experience, prefer this type of scenario and thus making door state monitoring of lesser importance.
    ......

    So after a lengthy post I hope that this "homebridge cbus door control proposal" could at least be open/close WITH the ability to register states - however the recognition of states fundamentally should not have an impact on it's development because state recognition is a security issue, yes, a nice to have known in the cbus network, but primarily security issue.

    always wanted to type it... <drops microphone>....
    crowd chants... cbus cbus cbus
    :D:D:D
     
    Ambro, Mar 28, 2017
    #96
  17. ievolve

    roguetrader

    Joined:
    Mar 29, 2017
    Messages:
    6
    Likes Received:
    0
    Location:
    Sydney
    Anthony, and more recently Simon

    Just wanted to thank you guys for the work you have put into homebridge-cbus.
    I now have cgate, homebridge, and the homebridge-cbus plugin running on a mac mini that lives in my basement as a media server and which is interfacing to C-bus through a wiser 2.
    I also have an apple TV 4th Gen on the network, as a home hub, so all the geofencing/automation etc is running. I got home tonight and my house was in "home" mode, because of the geofencing in my phone, without touching a button.

    This was a very very simple process to set up in the apple echo system. Probably took me less than 2-3 hours from start to finish, including install of Java JDK, cgate, Xcode, homebrew (for nodejs) homebridge, homebridge-cbus, editing of the config.json file (unified accessory list is awesome), assigning accessories to rooms in Home on the IOS and finally, confirming apple TV runs the home hub.

    I can now run my whole house with siri or with apple automation. And all my IOS devices updated over iCloud. Woohoo!!!!

    One question. Do you think you will be able to control cbus scenes through the bridge? I can create them again on the iPhone, but, would like to just activate those that are imported into homebridge-cbus from cgate.


    Note: The wiser 2 should really be updated to be a homekit bridge... Please Schneider Electric. Spend a little bit of money on homekit, and you will have the best home automation system ever.

    Thanks again guys.
     
    roguetrader, Mar 29, 2017
    #97
  18. ievolve

    simonhac

    Joined:
    Jan 8, 2017
    Messages:
    51
    Likes Received:
    0
    Location:
    Melbourne
    thanks everyone for the great ideas -- and your pleasing feedback. it makes it much more rewarding to develop when you know that others are benefitting from the work.

    my sincere gratitude goes out to anthony who worked out how to interface homebridge with C-Gate and structured a great package.

    i'm hoping that clipsal notice this project at some point -- it's made my aging C-Bus system feel brand spanking new again. finally my friends understand why we splurged for C-Bus.


    i like the idea of the door control. i have a NESS/ELK M1 on my network managing my front doorstrike and reed switch, so i can test it locally.

    i won't be able to get on to this until sometime in may, but plan to implement as suggested -- ie. strike control plus (if i can create a good user experience) optional open/close switch monitoring.

    after that i'm considering adding a configuration tool -- either command line or web based. i think we could get it to the point where you need to do nothing more than:
    ...and answer a few questions.

    it'd be great if someone could put together a raspberry pi distribution and a suitable enclosure with battery backup (as discussed in this topic last year). that'd dramatically lower the knowledge barrier of entry -- still way too high.
     
    Last edited by a moderator: Mar 30, 2017
    simonhac, Mar 30, 2017
    #98
  19. ievolve

    mrees

    Joined:
    May 5, 2007
    Messages:
    25
    Likes Received:
    0
    Location:
    Sydney
    Thankyou :)

    I wanted to chime in and give my thanks as well to @simonhac
    What an amazing piece of software

    My Wiser v1 was on its way out and the thought of investing in a $2k piece of hardware this late into its release seemed to be very impractical

    The native integration into IOS has allowed for much easier automation and incorporation of so many other technologies to complement setting much more practical scenes without needing all the expensive c-bus connectivity for a basic task such as turning on a lamp. Absolute brilliance. I will be getting a LOT more out of my automation because of this software. THANKYOU!

    Some quick Q's
    I don't seem to be able to just have cgate running for this to work. The project seems to also need to be open IN C-Bus Toolkit. Is there an easy way to automate the opening of the network to ensure this opens correctly on reboot?

    Also, there appear's to be multiple ways to startup homebridge automatically on a raspberry PI. What;s the preferred method?

    Has anyone been able to tap into an external weather source to not just pull in temperature information but instead rain forecast data?
    I'd love to be able to enable and disable sprinkler schedules based on forecasted rain

    A few suggestions:
    It would be fantastic if we could set timers on lights and dimmers as well as switches
     
    mrees, Apr 10, 2017
    #99
  20. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Hi mrees
    I also use Cgate on a Windows machine for now.
    Ideally I'd like to get it running on the pi in the future.

    I also have not setup Homebridge to start automatically so I'm keen to hear other answers.

    I have Cgate starting at login via Windows Task Scheduler.
    That works very well.
    There is a couple of files to edit in C:\Clipsal\C-Gate2\config
    In the "access" file you need to have the ip address of the pi allowed.
    In the Cgate config file you need to make some changes to get it to open the project at startup.
    I found how to do that by searching this forum.

    Once you have that setup you use task scheduler to launch the cgate application C:\Clipsal\C-Gate2\cgate.exe
     
    DarylMc, Apr 10, 2017
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.