Is it possible to program units via C-Gate commands?

Discussion in 'C-Bus Toolkit and C-Gate Software' started by more-solutions, Jan 27, 2026.

  1. more-solutions

    more-solutions

    Joined:
    Apr 23, 2006
    Messages:
    289
    Likes Received:
    4
    Location:
    Peterborough, UK
    As per subject, is it possible to program a unit via commands to C-Gate? Ie to transfer the database config of a unit to the live unit (or vice versa, for that matter)?

    I'm looking at how to implement a simple "this unit has failed, transfer the programming to a replacement unit" process which doesn't require TK/SLCC (with all the potential to really mess things up if you don't know those tools).
     
    more-solutions, Jan 27, 2026
    #1
  2. more-solutions

    glen_m

    Joined:
    Jun 26, 2016
    Messages:
    24
    Likes Received:
    9
    Location:
    NZ
    I don't specifically know the answer to your question, and if it is completely possible (and personally I feel there is more potential to mess this up by bypassing toolkit!! ).....

    However, if you don't really get an answer from someone in the know, if I were looking to 'reverse engineer this' in the absence of any specific command documentation, I would just jam C-Gate logging to max level (9?), and monitor the sequence of commands which toolkit sends to C-Gate when you are programming a unit, and pick through those for clues. The below is just from event level 5, and already contains some reasonable information in there (I have removed C-BUS events from there, for clarity).

    Code:
    # Global event reporting level (events <= event level will be reported (range 0-9)
    global-event-level=5
    e.g. changing a single key on a input unit. I'm guessing the lower set of commands are those used to sync the DB to the network unit, once the unit change has been made in the DB? There may be a few spurious commands below, as my home automation is also talking to C-Gate at the same time as toolkit, but you get the idea...

    Code:
    20260128-075633 761 cmd9 - Command: &4[3538]project use HOMENW
    20260128-075633 766 cmd9 - Response: [3538] 200 OK.
    20260128-075633 761 cmd9 - Command: &4[3539]dbget //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/TagName
    20260128-075633 766 cmd9 - Response: [3539] 342 !b3820e30-c0e8-103c-ab10-880c0572ee7e/TagName=Toilet - Main
    20260128-075633 761 cmd9 - Command: &4[3540]dbget //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/UnitName
    20260128-075633 766 cmd9 - Response: [3540] 342 !b3820e30-c0e8-103c-ab10-880c0572ee7e/UnitName=TOILET
    20260128-075633 761 cmd9 - Command: &4[3541]dbget //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/Description
    20260128-075633 766 cmd9 - Response: [3541] 342 !b3820e30-c0e8-103c-ab10-880c0572ee7e/Description=
    20260128-075633 761 cmd9 - Command: &4[3542]dbget //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/SerialNumber
    20260128-075633 766 cmd9 - Response: [3542] 342 !b3820e30-c0e8-103c-ab10-880c0572ee7e/SerialNumber=100129.3637
    20260128-075633 761 cmd9 - Command: &4[3543]dbget //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/CatalogNumber
    20260128-075633 766 cmd9 - Response: [3543] 342 !b3820e30-c0e8-103c-ab10-880c0572ee7e/CatalogNumber=5032N
    20260128-075633 761 cmd9 - Command: &4[3544]project use HOMENW
    20260128-075633 766 cmd9 - Response: [3544] 200 OK.
    20260128-075633 761 cmd9 - Command: &4[3546]project use HOMENW
    20260128-075633 766 cmd9 - Response: [3546] 200 OK.
    20260128-075633 787 sys Signed unit specification: KEY2.xml.es is being used.
    20260128-075633 787 sys Signed unit specification: I_KEY.xml.es is being used.
    20260128-075633 761 cmd9 - Command: &4[3551]get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e InterfaceState
    20260128-075633 766 cmd9 - Response: [3551] 300 //HOMENW/254: InterfaceState=running
    20260128-075633 761 cmd9 - Command: &4[3552]get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e State
    20260128-075633 766 cmd9 - Response: [3552] 300 //HOMENW/254: State=ok
    20260128-075633 761 cmd9 - Command: &4[3553]get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e SyncState
    20260128-075633 766 cmd9 - Response: [3553] 300 //HOMENW/254: SyncState=idle
    20260128-075633 761 cmd9 - Command: &4[3554]get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e OriginateInProject
    20260128-075633 766 cmd9 - Response: [3554] 300 //HOMENW/254: OriginateInProject=yes
    20260128-075649 761 cmd9 - Command: &4[3555]project use HOMENW
    20260128-075649 766 cmd9 - Response: [3555] 200 OK.
    20260128-075649 761 cmd9 - Command: &4[3584]dbset //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/UnitName "TOILET"
    20260128-075649 766 cmd9 - Response: [3584] 200 OK.
    20260128-075649 761 cmd9 - Command: &4[3586]get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e InterfaceState
    20260128-075649 766 cmd9 - Response: [3586] 300 //HOMENW/254: InterfaceState=running
    20260128-075649 761 cmd9 - Command: &4[3587]get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e State
    20260128-075649 766 cmd9 - Response: [3587] 300 //HOMENW/254: State=ok
    20260128-075649 761 cmd9 - Command: &4[3588]get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e SyncState
    20260128-075649 766 cmd9 - Response: [3588] 300 //HOMENW/254: SyncState=idle
    20260128-075649 761 cmd9 - Command: &4[3589]get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e OriginateInProject
    20260128-075649 766 cmd9 - Response: [3589] 300 //HOMENW/254: OriginateInProject=yes
    20260128-075649 761 cmd9 - Command: &4[3590]dbset //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/SerialNumber "100129.3637"
    20260128-075649 766 cmd9 - Response: [3590] 200 OK.
    20260128-075649 761 cmd9 - Command: &4[3591]dbset //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/Description ""
    20260128-075649 766 cmd9 - Response: [3591] 200 OK.
    20260128-075649 761 cmd9 - Command: &4[3592]dbset //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/CatalogNumber "5032N"
    20260128-075649 766 cmd9 - Response: [3592] 200 OK.
    20260128-075649 761 cmd9 - Command: &4[3593]dbset //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/TagName "Toilet - Main"
    20260128-075649 766 cmd9 - Response: [3593] 200 OK.
    20260128-075649 761 cmd9 - Command: &4[3594]dbset //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/UnitType "KEY2"
    20260128-075649 766 cmd9 - Response: [3594] 200 OK.
    20260128-075649 761 cmd9 - Command: &4[3596]project use HOMENW
    20260128-075649 766 cmd9 - Response: [3596] 200 OK.
    20260128-075649 761 cmd9 - Command: &4[3597]ID //HOMENW/p/254/108 type
    20260128-075650 766 cmd9 - Response: [3597] 300 p/254/108 type=KEY2
    20260128-075650 761 cmd9 - Command: &4[3598]ID //HOMENW/p/254/108 version
    20260128-075650 766 cmd9 - Response: [3598] 300 p/254/108 version=1.2.67
    20260128-075650 761 cmd9 - Command: &4[3599]project use HOMENW
    20260128-075650 766 cmd9 - Response: [3599] 200 OK.
    20260128-075650 761 cmd9 - Command: &4[3601]project use HOMENW
    20260128-075650 766 cmd9 - Response: [3601] 200 OK.
    20260128-075650 787 sys Signed unit specification: KEY2.xml.es is being used.
    20260128-075650 787 sys Signed unit specification: I_KEY.xml.es is being used.
    20260128-075652 761 cmd9 - Command: &4[3634]get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e InterfaceState
    20260128-075652 766 cmd9 - Response: [3634] 300 //HOMENW/254: InterfaceState=running
    20260128-075652 761 cmd9 - Command: &4[3635]get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e State
    20260128-075652 766 cmd9 - Response: [3635] 300 //HOMENW/254: State=ok
    20260128-075652 761 cmd9 - Command: &4[3636]get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e SyncState
    20260128-075652 766 cmd9 - Response: [3636] 300 //HOMENW/254: SyncState=idle
    20260128-075652 761 cmd9 - Command: &4[3637]get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e OriginateInProject
    20260128-075652 766 cmd9 - Response: [3637] 300 //HOMENW/254: OriginateInProject=yes
    20260128-075652 761 cmd9 - Command: &4[3640]do //HOMENW/p/254/108 qsync
    20260128-075652 766 cmd9 - Response: [3640] 202 Done: //HOMENW/254/p/108
    So when you take out the responses, and strip out the timestamps, you are left with the following commands:

    Code:
    project use HOMENW
    dbget //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/TagName
    dbget //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/UnitName
    dbget //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/Description
    dbget //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/SerialNumber
    dbget //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/CatalogNumber
    project use HOMENW
    get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e InterfaceState
    get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e State
    get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e SyncState
    get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e OriginateInProject
    project use HOMENW
    dbset //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/UnitName "TOILET"
    get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e InterfaceState
    get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e State
    get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e SyncState
    get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e OriginateInProject
    dbset //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/SerialNumber "100129.3637"
    dbset //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/Description ""
    dbset //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/CatalogNumber "5032N"
    dbset //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/TagName "Toilet - Main"
    dbset //HOMENW/!b3820e30-c0e8-103c-ab10-880c0572ee7e/UnitType "KEY2"
    project use HOMENW
    ID //HOMENW/p/254/108 type
    ID //HOMENW/p/254/108 version
    project use HOMENW
    get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e InterfaceState
    get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e State
    get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e SyncState
    get //HOMENW/!b379f7e0-c0e8-103c-aa35-880c0572ee7e OriginateInProject
    do //HOMENW/p/254/108 qsync
    It's probably the last 'qsync' command which actually sends the DB config to the unit (Perhaps 'sync' will run in the other direction')

    I hope this helps, but again, I'm not suggesting that its a good idea:
    • I would prefer to let Clipsal handle any underlying command/structure/DB changes, and have those abstracted from me by toolkit, avoiding any regressions to a 'homebrew' process in a future C-Gate release
    • I would suggest that anyone capable of unpicking the above, and creating a scripted process to semi-automate a unit replacement, is more than capable of using the Toolkit GUI with their eyes closed ;)
    • And lastly, if you have a circumstance which is leading you to constantly replace faulty units, it's not automating the process of reprogramming the units, where I would be looking!! (Unless you are a C-Bus installer, and this applies across multiple sites, but then your script user already needs to know the Network Name, Network ID, and Unit ID to run the script.
    Cheers
     
    glen_m, Jan 27, 2026
    #2
    more-solutions likes this.
  3. more-solutions

    ashleigh Moderator

    Joined:
    Aug 4, 2004
    Messages:
    2,422
    Likes Received:
    37
    Location:
    Adelaide, South Australia
    I think the short and simple answer is no.

    Once upon a time the idea was that C-Gate would do all this, and TK would tell C-Gate "go do this high level thing", and C-Gate would do the gnarly bits.

    That got a bit overtaken by events a long long time ago, and so some of the save is done by C-Gate and some by TK, and which parts are done by what, and when, and why is a thing lost in the mists of time.
     
    ashleigh, Jan 28, 2026
    #3
    more-solutions and Conformist like this.
  4. more-solutions

    more-solutions

    Joined:
    Apr 23, 2006
    Messages:
    289
    Likes Received:
    4
    Location:
    Peterborough, UK
    I don't disagree, if I'm driving TK. However the potential for chaos if end users drive TK for trivial actions is "a concern"...

    I thought about doing something similar but concluded it would be unlikely to be logged (and never got around to testing). I am very grateful for your efforts to do that!

    [...]
    Unfortunately I don't think this is the case; QSYNC is documented:

    (Sorry for the slow response, for some reason notifications aren't coming through.)
     
    more-solutions, Feb 10, 2026 at 1:56 PM
    #4
  5. more-solutions

    more-solutions

    Joined:
    Apr 23, 2006
    Messages:
    289
    Likes Received:
    4
    Location:
    Peterborough, UK
    I figured it would likely be something like this, thanks for confirming though.

    It would be great if TK (and the newer replacements) had some form of scripting capability for jobs like this, like some of its modern competitors do!
     
    more-solutions, Feb 10, 2026 at 2:11 PM
    #5
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.