Apple homekit integration!

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

  1. ievolve

    admin_vb On Holiday

    Joined:
    Feb 23, 2007
    Messages:
    21
    Likes Received:
    0
    Location:
    Lhasa, Tibet
    Warning

    Just a note re door control using C-Bus.

    Back in the day... when I was on the dev team, this was all considered quite actively.

    Sensing a door state is quite trivial.

    The big deal is controlling the door strike - the open/entry latch. Back in the good ole days this used to be done with an electro-mechanical latch, controlled by the receptionist pushing a button. The latch would go "bzzzzzzzzzzzz" and you could open the door - for as long as the receptionist (of any gender) was holding the button.

    Wired up using a direct point-point arrangement, such things were "secure" in the sense that only the receptionist, or the person at the place where the button was wired up, could control the door entry. Further, the door usually had an old fashioned keyhole and you could lock them securely at night.

    A bus control system, on the other hand, allows the door to be opened by the sending of a bus command. That might result in a simple on=open / off=closed action, or it might be a pulsed response (on = open the door for X seconds and then release, as a fail-safe).

    The obvious downside of the bus control system is that injection of a command from anywhere opens the door.

    This is known in the trade as "A Bad Thing".

    Examples:
    - Anyone can tap into the bus and inject commands. When you can open secure areas or hotel rooms this is known in the trade as "A Very Bad Thing", possibly leading to all manner of repercussions. You do need physical access, which is not as hard as it sounds.

    (Note there are other articles as well showing the ease of removing a wall-switch and connecting to the cabling, not just use of IP networking.)

    - If that system is connected via a gateway to the internet (and many are); then the security you have is only as good as that gateway offers. Some gateways are well designed and well secured, and some are not.

    The determination of "well design and well secured" is possible, not trivial, and beyond coverage in a post here.

    IN GENERAL TERMS the best way to handle such things as door strikes is that:

    1. You do not ever directly control them from the bus (no wiring up to outputs of relays).

    2. They should be direct wired to a system that is designed for security purposes, and performs access control functions.

    "Access Control Functions" means that the device may accept input from some number of sources, check that input to ensure validity, include any suitable interlock functions, perform any needed timing operations, and so on.

    An example might be to check that a command originated from an approved source address; so that for example injection of commands from "just anywhere" sees them rejected. Interlocks might be to check that the door is present, closed, or that any overrides are set appropriately. A direct connect input might also be use (the button on the receptionists desk); or there might be interaction with a security system (no opening the door when the building is in secured mode), and so on.

    Without doing all those "access control functions" you have an insecure building, and this is not advisable.

    NOW FOR ALL THOSE POSTING the things they have done: That's very nice and I don't wish to discourage you. BUT PLEASE BE AWARE OF BUILDING SECURITY AND VULNERABILITY.

    IF ANYONE HAS THEIR BUILDING ACCESSED OR BROKEN INTO BECAUSE OF FOLLOWING WHAT IS ESSENTIALLY "HOBBYIST" or "MAKER" ADVICE ON THIS FORUM:

    - THESE PRACTICES ARE NOT ENCOURAGED OR CONDONED BY THE OPERATORS OF THIS SITE.

    - THESE PRACTICES ARE EXPLICITLY WARNED AGAINST AS BEING NOT GOOD.

    - THE OPERATORS OF THIS SITE ACCEPT NO LIABILITY FOR ANY HARM THAT MAY COME IN ANY FORM BASED ON INFORMATION USED FROM THIS SITE.
     
    Last edited by a moderator: Apr 11, 2017
    admin_vb, Apr 11, 2017
  2. ievolve

    mrees

    Joined:
    May 5, 2007
    Messages:
    25
    Likes Received:
    0
    Location:
    Sydney
    Out of curiosity, has anyone managed to get this c-bus plugin working with the people plugin on homebridge?

    I find that once homebridge-people is installed, this plugin ceases to load when initialising homebridge and then the clinker is that once I change the config.json file back again, homekit resets on the IOS devices and I lose all my room assignments, scenes etc.. :eek::mad:

    So it's not really a nice issue to troubleshoot

    I would love to hear if anyone has had any joy getting this going as the 'occupancy sensors' seem to be a worthwhile persistence in order of getting a more defined automation occurring with geofencing etc
     
    mrees, Apr 12, 2017
  3. ievolve

    mrees

    Joined:
    May 5, 2007
    Messages:
    25
    Likes Received:
    0
    Location:
    Sydney
    Nevermind, it was a config error on my end :)
     
    mrees, Apr 16, 2017
  4. ievolve

    simonhac

    Joined:
    Jan 8, 2017
    Messages:
    51
    Likes Received:
    0
    Location:
    Melbourne
    mrees, please file this as an issue and i'll look into it.
     
    Last edited by a moderator: Apr 22, 2017
    simonhac, Apr 22, 2017
  5. ievolve

    simonhac

    Joined:
    Jan 8, 2017
    Messages:
    51
    Likes Received:
    0
    Location:
    Melbourne
    daryl, if you could please list these steps i'll edit the documentation for homebridge-cbus accordingly.
     
    simonhac, Apr 22, 2017
  6. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Hello Simon

    I have attached a screenshot of the changes to config files.
    Is that suitable?
    Tested OK as a console or service.
    (edit I had some trouble with the service and Windows Firewall, I recommend using the console.)
    (The recommended way to change from service to console is to reinstall Toolkit and select CGate to run as a console.)

    To automate startup
    Use task sheduler to launch C:\Clipsal\C-Gate2\cgate.exe at logon, run with highest privileges, silent, 1 minute delay.
     

    Attached Files:

    Last edited by a moderator: Apr 22, 2017
    DarylMc, Apr 22, 2017
  7. ievolve

    simonhac

    Joined:
    Jan 8, 2017
    Messages:
    51
    Likes Received:
    0
    Location:
    Melbourne
    thanks daryl -- am i right that the only change you made is the `project.start` parameter?

    if so, i may as well make `homebridge-cbus` automatically open the project (specified in config.json) on startup iff it is not already open. that'd save a few headaches.
     
    simonhac, Apr 25, 2017
  8. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Hello Simon
    If the PC has Toolkit and all the Toolkit settings are right for the project then that is all you have to do to get cgate application to connect to the project when it opens.
    That and allowing access from the pi IP address.

    So just for you (not really) I zero wiped a Windows 10 PC last night.
    Installed Toolkit.
    Restored my project.
    Connected to the project in Toolkit to make sure that was all working OK.
    Modified the CGate access and config text files.
    Set up scheduled task to launch cgate.

    Started raspberry pi.
    Modified config.json for new cgate ip address
    Started Homebridge
    All good.

    What are you planning?
    To get raspberry pi to launch cgate on a PC?
    With admin rights?
     
    DarylMc, Apr 25, 2017
  9. ievolve

    tobex

    Joined:
    Nov 3, 2006
    Messages:
    728
    Likes Received:
    0
    Location:
    Sydney, Australia

    I am really interested in this project but i cant figure out the following.

    * How many Pi modules do I need ? Would 2 be more sound than operating all on one board ?

    * How do i start ?

    * Is there a dummies guide ?

    * Which operating system am I using ?

    * Do i need a touchscreen ? What am I using to validate ?

    I would like a kick start to overcome the inertia.


    DIN Rail mounting for Raspberry Pi.

    http://au.rs-online.com/web/p/produ...8g_dc|pcrid|99325694074|pkw||pmt||prd|7989818

    I went out and got myself the full monty of DIN rail attachments. Everything is DIN mounted including the power supply and Pi. I also scored a good deal on a CNI.
     
    Last edited by a moderator: May 1, 2017
    tobex, May 1, 2017
  10. ievolve

    simonhac

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

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

    new in this version:

    * when building the Unified Accessory List, use the unitType of the C-Bus units controlled by the group to make a semi-intelligent guess of the accessory's type
    * improved support for C-Bus installations with multiple networks

    as always, please raise an issue ticket if you encounter any problems or have suggestions on how to make homebridge-cbus even better.
     
    simonhac, May 1, 2017
  11. ievolve

    simonhac

    Joined:
    Jan 8, 2017
    Messages:
    51
    Likes Received:
    0
    Location:
    Melbourne
    tobex, i can't answer all of your questions in detail, but here are my brief thoughts:

    > * How many Pi modules do I need? Would 2 be more sound than operating all on one board?

    1 at most -- but i don't use one as my Synology NAS is the perfect hosting platform for both homebridge and cgate.

    > * How do i start?

    i'll leave that to others, but you'll need cgate running somewhere, plus nodejs, homebridge and homebridge-cbus somewhere (no reason why they can't be on the same box -- in fact i'd encourage it.)

    > * Is there a dummies guide ?

    good question...

    > * Which operating system am I using?

    i don't know what you are using, but i test on MacOS and run on my Synology NAS. many run it on the Raspberry Pi.

    > * Do i need a touchscreen? What am I using to validate?

    no touchscreen needed. what do you mean by validate?

    > I would like a kick start to overcome the inertia.

    i hope that's helped -- why not write up a HOWTO guide as you are working it out?
     
    simonhac, May 1, 2017
  12. ievolve

    simonhac

    Joined:
    Jan 8, 2017
    Messages:
    51
    Likes Received:
    0
    Location:
    Melbourne
    nope, i won't be touching a PC -- but am interested in putting together a CGate docker image for the Synology NAS. it's not for everyone, but those who have a Synology will probably agree that it makes a great home server.
     
    simonhac, May 1, 2017
  13. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Hi tobex
    The raspberry pi talks to for example a CNI and only needs a LAN connection.
    I wouldn't go putting it in an electrical switchboard.

    You only need one raspberry pi.

    The dummies guide is here.
    https://github.com/anthonywebb/homebridge-cbus

    If you PM me I maybe I can load a micro SD with a basic Homebridge setup for you.

    RS components sells raspberry pi 3, a reasonable case and power supply.
    http://au.rs-online.com/web/p/products/8968660/
    http://au.rs-online.com/web/p/products/9098132/
    http://au.rs-online.com/web/p/products/9098126/
    You will also need a suitable Micro SD card.
    An Apple device with IOS10.
    A Windows PC with CBus Toolkit, therefore CGate and already has your CBus project is handy for beginners rather than setting up CGate on the pi.

    If you want to use Homekit outside your local network you need to have an iPad setup which stays at home or Apple TV.
     
    Last edited by a moderator: May 1, 2017
    DarylMc, May 1, 2017
  14. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Hi simon
    The link for CGate setup guide seems to be broken.
    Oh just checked it is back again.
    http://addictedtopi.tumblr.com/post/96351714013/installing-c-gate-on-a-raspberry-pi

    In any case I have been scared to use a remote CGate on say raspberry pi for fear of having out of date project info on the Windows PC for Toolkit.
    Any thoughts how to best manage projects when using remote CGate?
    Anyone else is welcome to offer practical suggestions.
    I had in mind transfer all to database in Toolkit would be a good idea if switching CGate servers.
     
    Last edited by a moderator: May 1, 2017
    DarylMc, May 1, 2017
  15. ievolve

    simonhac

    Joined:
    Jan 8, 2017
    Messages:
    51
    Likes Received:
    0
    Location:
    Melbourne
    i run a VirtualBox instance of windoze for the occasional times that i need CBus Toolkit, but i don't run CGate on that (virtual) machine.

    i strongly recommend that you run CGate on the same host as homekit-cbus. when you need to load up Cbus Toolkit, make a remote connection to the host. that way you only have one server maintaining one version of your project file.
     
    simonhac, May 1, 2017
  16. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Thanks
    I think that makes sense.
    Now I just have to build the confidence to run CGate on something other than Windows.
     
    Last edited by a moderator: May 1, 2017
    DarylMc, May 1, 2017
  17. ievolve

    simonhac

    Joined:
    Jan 8, 2017
    Messages:
    51
    Likes Received:
    0
    Location:
    Melbourne
    C-Gate is written in java -- it wants to run on something other than windows. :)
     
    simonhac, May 1, 2017
  18. ievolve

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,319
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Hey that may well be true but I am a rusted on Windows user and have the Windows Vista t shirt to prove it :)
    It's actually a revelation to me that people can do stuff on another OS.
     
    Last edited by a moderator: May 1, 2017
    DarylMc, May 1, 2017
  19. ievolve

    tobex

    Joined:
    Nov 3, 2006
    Messages:
    728
    Likes Received:
    0
    Location:
    Sydney, Australia
    Thanks Simonhac and DarylMc,

    I had a role in some of the QNAP and Synology changes a few years ago. That is why I jumped on the idea of using a QNAP and was pleased when you said Synology.

    I have been using Meanwell power supplies and saw that I could include a CNI, R-Pi, power supplies and a CBUS PS all in the same box. This gives me the capacity to wall mount the working software environment some place in the data room. Alternately, you can probably source a rack-mountable DIN rail.

    I know little of the Raspberry environment at this stage and wont be in a position to learn this rabbit trick until a few months. Thanks for the advice to date. Helps enormously.

     
    Last edited by a moderator: May 1, 2017
    tobex, May 1, 2017
  20. ievolve

    tobex

    Joined:
    Nov 3, 2006
    Messages:
    728
    Likes Received:
    0
    Location:
    Sydney, Australia
    5000SM/2 is still available from Clipsal. Will allow direct attachment of the CBUS network to a Pi. Might need some additional board to isolate and so on.

    Is anyone going to offer a fully made up SD card ?
     
    Last edited by a moderator: May 2, 2017
    tobex, May 2, 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.