Shelly Dimmer goes Homematic - with the original firmware - variant with CUxD-Dimmer

    • Offizieller Beitrag

    ©2019 Stefan K. (alias 66er)


    #1 Introduction

    #2 The coupling


    Hello everybody,


    As a variant of the Shelly Dimmer - Homematic coupling from SparkyMaster , I present my solution below with the original firmware based on the connection as a CUxD dimmer.

    From my point of view, both solutions have advantages and disadvantages. That it is a matter of individual taste, which coupling you ultimately choose.

    Functionally, they can ultimately do the same.


    How does coupling via dimmer differ from the solution from Axel:

    • only 1 CUxD device (dimmer)
    • fewer system variables (2 instead of 4)

    For users who, like me, hardly use the Shelly app, my variant does not really cause a disadvantage. For users who also use the app a lot in parallel to Homematic, note the following:


    If the dimmer was switched off by the Homematic, the dimmer controller in the APP is turned down completely and must first be pulled up again if using the app.

    The reason for this is that the state OFF is handled differently by the Shelly and Homematic systems:

    When OFF, the Homematic dimmer is at 0% brightness at the same time, however, the Shelly controller remains in its set dimming position when switched off.

    Since of course I wanted to achieve a synchronous state in both systems, I had to make this compromise, otherwise OFF in the APP does not correspond to OFF in Homematic.

    There are other differences in both systems, which is why the coupling took longer time. The famous cat literally bit its tail very often due to these differences.


    :thumbup: But now, ther'senough written, let's go:

    • Offizieller Beitrag

    #1 Introduction

    #2 The coupling


    View of the coupling as a dimmer:

    CUxD Dimmer.png


    to integrate the Shelly Dimmer in Homematic, you don't need any 3rd party firmware that you have to flash.


    techn. Requirements:

    • compatible with the Homematic systems CCU2, CCU3, Charly, as well as all offshoots such as RaspberryMatic and piVCCU.
    • installed addon CUxD in current version


    (At this point, I assume that you know how to use CUxD, e.g. how to create devices, otherwise this manual "explodes". Thank you for your understanding.)


    I have implemented the following functions on the Homematic page:

    • ON-OFF
    • Dimming using slider
    • Optional monitoring of the online status (accessibility in the WLAN)
    • Optional display of the power measurement


    Please note:

    Anyone who already knows my other Homematic couplings has to change a little. Due to the system differences described in # 1 between Homematic and Shelly, e.g. ON / OFF can be implemented in a completely new way. Therefore, please work through the instructions step by step from top to bottom, then it will work.:thumbup: Otherwise it can only go wrong. :D


    Contrary to the last couplings, the switching state ON or OFF can not be realized via actions!


    The implementation:


    (I do not describe the creation of the CUxD devices at this point, please use the CUxD documentation!)


    If not yet available, please create a device (28) System Exec! The commands are issued above this. (No entries are made in the CUxD-Exec!)


    Creation of a CUxD (28) Multi-DIM-Exec as dimming actuator 1-way:

    Bildschirmfoto vom 2020-01-05 19-28-31.png

    The device is set up as follows:

    Dimmereinstellungen.png

    Code for CMD_Exec:

    Code
    wget -q -O - 'http://192.168.1.147/light/0?brightness~3d$1$'

    Adapt the IP!

    Now the controller is able to regulate the brightness of the dimmer .:)

    For the cyclical updating of the switching status and power display, we need 1 channel of an existing CUxD timer or a timer to be created.


    CUxD-Timer.png

    We also need 2 system variables

    Systemvariablen.png

    These are linked to channel 2 of the CUxD dimmer so that they are displayed there.


    Of course, if you do not display the performance, you do not have to create the variable, but you must then delete the corresponding sections in the scripts.


    Online status display option:

    In order to monitor and display the online status, we need 1 channel of a CUxD ping device. (If you do not display, you do not need the variable in addition to the ping channel and can simply skip this section.)

    Ping.png

    Adjust the IP address of the dimmer!

    (Times can be adjusted)


    Switch CMD EXEC TRUE:

    Code
    extra/timer.tcl Shelly-Dimmer_Onlinestatus_WZ 1

    Switch CMD EXEC FALSE:

    Code
    extra/timer.tcl Shelly-Dimmer_Onlinestatus_WZ 0

    adjust name of the variable (here: Shelly-Dimmer_Onlinestatus_WZ)

    • Offizieller Beitrag

    To get the coupling up and running, we need the following programs and scripts:

    Pr EIN AUS.png

    Script for 1st THEN

    Code
    !Dimmer einschalten
    string url='http://192.168.1.147/light/0?turn=on';
    dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State("wget -q -O - '"#url#"'");

    Script for 2nd THEN

    Code
    !Dimmer ausschalten
    string url='http://192.168.1.147/light/0?turn=off';
    dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State("wget -q -O - '"#url#"'");

    Adjust the IP address of the dimmer and, if necessary, the CUxD Exec address!

    PR Aus von App.png

    script for THEN:

    Code
    !CUxD-Dimmer setzen
    string stdout; 
    string stderr;
    dom.GetObject("CUxD.CUX2802006:2.SET_STATE").State(0);

    Adjust the CUxD channel of the dimmer!

    (The following 2 pictures result in 1 program)

    Dimmer aktualisieren T1.pngDimmer aktualisieren T2.png


    (Please ignore and omit the IF line with "CCU3-Reboot", unless you also monitor the boot status of your CCU)

    Script for 1st THEN:

    The script for the 2nd THEN line (in the ELSEIF branch):

    Please work through both scripts from top to bottom and adapt the IP address, CUxD device addresses and variable names to your system as indicated!

    That's it. :)