Integrate Shelly 1 in Homematic - with the original firmware

There is 1 reply in this Thread which was already clicked 2,080 times. The last Post () by 66er.

    • Official Post

    ©2019-2020 Stefan K. (alias 66er)

    All rights reserved!

    Hello everybody,

    In order to integrate the Shelly1 in Homematic, you do not need any third-party firmware that you have to flash.

    Below I present my solution with the original firmware:


    • turn on
    • turn off
    • status display
    • Update in freely adjustable interval (important, if, for example, switched in parallel via Shelly-App or Shelly-Timer)
    • use in programs
    • optional monitoring of the accessibility of the Shelly in the network (online status)

    technically requirements:

    • compatible with the homematic systems CCU2, CCU3, Charly, as well as all offshoots like RaspberryMatic and piVCCU.
    • installed add-on CUxD in current version

    (The knowledge about the handling CUxD, such as devices create, I assume at this point, otherwise "exploded" this guide. Thank you for understanding.)


    (On the description of the creation of the CUxD devices I give up at this point, but there is the CUxD document!)

    If not yet available, please create a device (28) System Exec! Above that the commands are issued.

    Creating a CUxD (40) 16-channel universal control as a switch:

    CUxD Shelly.JPG

    Settings of the individual channels (1 channel = 1 Shelly)

    Setting for SWITCH | CMD_SHORT:

    wget -q -O - ''

    Setting for SWITCH|CMD_LONG

    wget -q -O - ''

    Adjust IP address of each to your own Shelly1

    Now,switching ON and OFF is working. :)

    For the status update you need a CUxD timer in addition to the CUxD-Exec.


    You can dispense with this since firmware 1.5.0, if you use the "Actions" in the Shelly to update the status. Pros and cons were discussed in this thread.

    Also the mechanism of the actions is described there. ;)

    The desired update time (here 30 seconds) is entered in the timer:


    Now you need 1 program that updates the switch status cyclically:

    Programm Shelly aktualisieren.JPG

    Of course, the additional IF-exams are optional and adapted to my setup. Functionally, only the 1st IF line must be in the program.;)

    And if the program does not trigger using "Timerevent", you can instead

    "at Timerget in the range smaller1 - when changed"


    The just missing script:


    To adapt are the adresses in the setup-area!

    With a refresh interval of 30 seconds and currently 3 Shelly1, there is no major change in CCU3 utilization. :)

    Optional monitoring of the online status of the Shelly1

    (Availability in the (W) LAN)

    Here's the result in advance:

    Onlinestatus des Shelly.JPG

    (So here everyone can decide for themselves whether the topic is relevant for individual and will be pursued;))

    Advantages of optional monitoring:

    • failure monitoring
    • Online status visible in the already created "CUxD Shelly device"
    • Possibility to individually respond to unavailability of a Shelly1, e.g. with e-mail notification, display or similar
    • Project-dependent additional influence on the switching state of the "CUxD-Shelly"

    What is needed in addition to the previous setup:

    • 1 CUxD device (28) Ping (1channel / Shelly1)
    • 1 system variable per Shelly1

    The system variable (s):

    For each Shelly, 1 system variable of type Logic is created:


    and linked to the corresponding channel of the "CUxD-Shelly".

    This makes the variable visible in the CUxD device (to be seen in the picture)

    The variable is controlled directly by the device "CUxD-Ping". (It makes sense to assign the channels 1: 1 to the Shellys as in the CUxD switch.;))

    Now there are 2 possibilities:

    1. Only display online status

    For each Shelly1, the assigned CUxD ping channel must be set as follows:


    The times can be changed. (As long as your system does not go to their knees. ^^)

    SWITCH | IP_DNS_ADR: Customize the Shelly's IP


    extra/timer.tcl Onlinestatus_Shelly_Fitnessraum 1


    extra/timer.tcl Onlinestatus_Shelly_Fitnessraum 0

    Attention: In both codes ...

    Replace "Onlinestatus_Shelly_Fitnessraum" with the name of your system variable! (Attention: do not use spaces in the name!)

    :) Now, the CUxD ping monitors the Shelly1 and updates the status online / offline in the system variable automatically. :)

    If the status of the system variable does not match the real online status after creation, then the real online status must be changed once (eg by switching off the Shelly). After waiting for the monitoring time, set in the PING, and switching on the Shelly, the state will be updated.

    2. additionally with "Offline" status, set the Shelly CUxD switch to the "OFF" position

    (without unnecessarily sending commands to the network)

    Meaning and purpose:

    Due to the lack of N-conductors in the switch boxes, I installed my Shelly1 in the lamps. If the light is switched off accidentally (or intentionally) via the conventional switch, not only is the light off, but also the Shelly1 (= offline). However, the CCU would not notice that, leaving the CUxD switch in state 1.

    A 2nd command in the SWITCH | CMD_EXEC_FALSE code allows the CUxD Shelly switch channel to be turned OFF without sending unnecessary commands to the network. Overall, the extended entry looks like this:

    extra/timer.tcl Onlinestatus_Shelly_Fitnessraum 0;  extra/timer.tcl CUxD.CUX4000005:1.SET_STATE 0

    Replace "Onlinestatus_Shelly_Fitnessraum" with the name of your system variable! (Attention: do not use spaces in the name!)

    In addition, please adjust the CUxD address of the Shelly switching channel!

    :) The extended command line now also sets the switch to OFF position in addition to the status in the system variable in OFFLINE.


    (SWITCH | CMD_EXEC_TRUE does not need to be extended, because with state ONLINE the switching state of the Shelly1 is updated anyway.);)

    Have fun with it


    The instructions including the scripts and pictures are subject to copyright. Anyone who infringes the copyright (for example, pictures or texts illegally copied and published on other websites), according to §§ 106 ff UrhG punishable, can also be warned for a fee and must pay damages (§ 97 UrhG).

    © 2019-2020 Stefan K. (aka 66er)

    All rights reserved


    Do you like the instructions? Would you like to reward the effort involved with a small "thank you"?

    I am happy about every thank you PayPal (send money to a friend):

    Many thanks.

    • Official Post

    I have just released the new V2.1 update script.


    simplified setup (completely at the beginning of the script)

    Have fun with it.:thumbup: