Shelly EM goes Homematic - with original Firmware

    • Offizieller Beitrag

    By courtesy of 66er, i take over the text formatting with the technological routine. (Stefan, express thanks again at this point!))


    Hello Homematic Friends,


    to integrate the Shelly EM into Homematic, you do not need any third-party firmware, that you have to flash.

    Below my solution with the original firmware:

    techn. 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.)

    The advantages from my point of view:

    • all Shelly EM properties are preserved as I operate the actuators with the original manufacturer firmware
    • all future Shelly EM updates / updates will be usable
    • Full Shelly app usability in parallel with Homematic automation
    • Operation as local solution or via Shelly-Cloud, additionally Homematic


    I implemented the following functions on the Homematic page:

    • ON OFF
    • Update of the current switching state in a freely adjustable interval, regardless of whether the operation is via Homematic or Shelly app or button
    • Optional monitoring of the online status (accessibility via WLAN)
    • Optional monitoring of currently power
    • Optional monitoring of currently voltage
    • Optional monitoring of currently reactive power
    • Optional monitoring of currently Total consumed Energy
    • Optional monitoring of currently Total returned Energy   

    A view to the connection:

    Ansicht der Anbindung.png

    Picture 1

    I would like to recommend you to take a look at these threads before the implementation:

    At the appropriate place in the manual, everyone has to decide for themselves which route the switching status monitor wants to use. ;)


    The implementation:

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

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

    Creation of a CUxD (40) 16-channel universal control as a switch

    CUxD (40) als Schalter.png

    With each channel of the CUxD device, 1 Shelly EM can be mapped.


    The settings of the channels:

    The Shelly EM has two measuring channels to which two transducers can be connected.

    Attention !: However, only one relay / switching output is integrated to control an external relay. When creating scenes or actions, the correct channel selection must be observed!


    Einstellen der Kanäle.png

    SWITCH|CMD_EXEC: Check mark!

    Settings for SWITCH|CMD_SHORT:

    Code
    wget -q -O - 'http://192.168.178.33/relay/0?turn~3doff'

    Settings for SWITCH|CMD_LONG:

    Code
    wget -q -O - 'http://192.168.178.33/relay/0?turn~3don'

    Adapt the IP address of the Shelly EM in each case!


    This makes the PlugEM ready for use and can be switched on and off. :)

    ____________________________________________________________

    The instructions including the scripts and pictures are subject to copyright. Who violates the copyright (for example, images or texts illegally copied and published on other websites), makes itself gem. §§ 106 ff UrhG punishable, can also be warned with costs and must pay damages (§ 97 UrhG).

    © 2019 SparkyMaster

    • Offizieller Beitrag

    Update the switch-state


    The update is important, so that in Homematic the switching state is also correct, if e.g. via the Shelly app;) Pros and cons are described in # 1 linked thread.


    For the autom. Updating the switching status we need 1 timer ...

    CUxD Timer.png

    Update every 60 seconds (time variable)


    ... that triggers the update program:

    Programm Aktualisierung.png

    Alternatively, in the IF, it is also possible to trigger on the "Timerevent" of the timer.


    Missing only the script for the 1st THEN line:

    According to the instructions in the script have to be adapted:

    IP of the Shelly EM

    CUxD Exec channel

    CUxD channel of the Shelly EM


    Now, the switching state of the Shelly EM is also updated in Homematic when switching via the app or Shelly scenes.:)

    ____________________________________________________________

    The instructions including the scripts and pictures are subject to copyright. Who violates the copyright (for example, images or texts illegally copied and published on other websites), makes itself gem. §§ 106 ff UrhG punishable, can also be warned with costs and must pay damages (§ 97 UrhG).

    © 2019 SparkyMaster

    • Offizieller Beitrag

    Optional ads:

    1. currently power display:

    evaluates the power of the Shelly EM channels, displays it in the CUxD device and of course the value can also be used in programs.

    For this we need 2 system variable for the currently power value:

    Systemvariable Leistung.png

    The variables are assigned to the corresponding channel of the Shelly CUxD device. This makes it visible as shown in Figure 1 in # 1.

    In the status updating program (see picture in # 2) we add a 2nd THEN line to update the power data.

    Attention:

    The names of the system variables must not contain any "spaces" !

    The script for this:


    In the set interval of the timer, the currently power is now updated. :)


    2. Online Status:

    As with all other couplings, the opt. display of the online status is also made using the system variable and CUxD ping device (28).


    To display the online status, 1 system variable is required:

    Systemvariable Onlinestatus.png

    The variable is linked again to the corresponding channel of the CUxD device and thus displayed there.


    The online status is monitored and controlled by a CUxD ping channel. That, with 1 CUxd Ping device (28) up to 16 Shelly EM can be monitored. Of course, a free channel of an existing CUxD ping can be used.

    CUxD Ping.png

    Adjust IP!


    Settings for: SWITCH|CMD_EXEC_TRUE:

    Code
    extra/timer.tcl Onlinestatus_ShellyEM_Photovoltaik 1

    Settings for SWITCH|CMD_EXEC_FALSE:

    Code
    extra/timer.tcl Onlinestatus_ShellyEM_Photovoltaik 0


    Adapt the name of the system variable in each case! (here:Onlinestatus_ShellyEM_Photovoltaik)

    In the set interval of the timer, the online status is now updated. :)


    3. currently voltage display:

    evaluates the voltage of the Shelly EM, displays it in the CUxD device and of course the value can also be used in programs.


    For this we need 1 system variable for the currently voltage value:

    Systemvariable Spannung.png

    The variables are assigned to the corresponding channel of the Shelly CUxD device. This makes it visible as shown in Figure 1 in # 1.


    In the status updating program (see picture in # 2) we add a 3rd THEN line to update the voltage data.


    Attention:

    The names of the system variables must not contain any "spaces" !

    The script for this:


    In the set interval of the timer, the currently voltage is now updated. :)


    4. currently reactive power display:

    evaluates the reactive power of the Shelly EM channels, displays it in the CUxD device and of course the value can also be used in programs.


    For this we need 2 system variable for the currently reactive power value:

    Systemvariable Blindleistung.png

    The variables are assigned to the corresponding channel of the Shelly CUxD device. This makes it visible as shown in Figure 1 in # 1.


    In the status updating program (see picture in # 2) we add a 4th THEN line to update the reactive power data.


    Attention:

    The names of the system variables must not contain any "spaces" !

    The script for this:


    Adapt the name of the system variable in each case! (here:Shelly_EM_Photovoltaik_Blindleistung1 bzw. 2)


    In the set interval of the timer, the reactive power is now updated. :)


    5. currently total consumed energy display:

    evaluates the total consumed energy of the Shelly EM channels, displays it in the CUxD device and of course the value can also be used in programs.

    For this we need 2 system variable for the currently total consumed energy:

    ShellyEM_SYS Bezug.png

    The variables are assigned to the corresponding channel of the Shelly CUxD device. This makes it visible as shown in Figure 1 in # 1.

    In the status updating program (see picture in # 2) we add a 5th THEN line to update the total consumed energy data.

    Attention:

    The names of the system variables must not contain any "spaces" !

    The script for this:


    Adapt the name of the system variable in each case! (here:Shelly_EM_Photovoltaik_Energie_Bezug1 bzw. 2)

    In the set interval of the timer, the total consumed energy is now updated. :)


    6. currently total returned energy display:

    evaluates the total returned Energy of the Shelly EM channels, displays it in the CUxD device and of course the value can also be used in programs.

    For this we need 2 system variable for the currently total returned energy value:

    ShellyEM_SYS Einspeisung.png

    The variables are assigned to the corresponding channel of the Shelly CUxD device. This makes it visible as shown in Figure 1 in # 1.

    In the status updating program (see picture in # 2) we add a 6th THEN line to update the total returned energy data.

    Attention:

    The names of the system variables must not contain any "spaces" !

    The script for this:


    Adapt the name of the system variable in each case! (here:Shelly_EM_Photovoltaik_Energie_Einspeisung1 bzw. 2)

    In the set interval of the timer, the total returned energy is now updated. :)

    ____________________________________________________________

    The instructions including the scripts and pictures are subject to copyright. Who violates the copyright (for example, images or texts illegally copied and published on other websites), makes itself gem. §§ 106 ff UrhG punishable, can also be warned with costs and must pay damages (§ 97 UrhG).

    © 2019 SparkyMaster

  • SparkyMaster 8. August 2019 um 21:00

    Hat das Thema freigeschaltet.
  • SparkyMaster 3. April 2024 um 12:51

    Hat das Thema geschlossen.