Power draw controlled switch

  • Hi

    I have a Shelly mini PM "PMFan" connected to the kitchen fan, and I need it to turn on a relay "spjeld" if the powerdraw is >2W, and turn it of again if its below 2W.

    I have tried doing it via actions, but firstly the conditions available are "active power change", which wouldnt do it since the fan can draw 1-200W depending on setting, so a 1W increase or decrease wouldn't turn it of at the right time.

    So basicly it would be a simple If statement for functionality if I did this on a arduino etc. (If PmFan power > 2 , spjeld = on, else Spjeld = off.)

    But I am struggling to understand how to code this in shelly.

    Is there a simple way to do this? Are there any tutorials thats adequate to get this done?

    Thanks for any help

    Flytrapp.

  • Hello Flytrapp,

    yah thats possible, here is a Script for this:

    Preview:

    Screenshot 2023-11-28 22.14.26.png

    Instructions (only in German sry)

    _[Deleted]_
    2. Dezember 2023 um 00:16

    More Infos about Shelly.Call():

    Shelly Script Language Features | Shelly Technical Documentation
    Since version 0.9.0
    shelly-api-docs.shelly.cloud

    2 Mal editiert, zuletzt von _[Deleted]_ (2. Dezember 2023 um 00:35)

  • Thank you,

    If i understand this correctly all I would need to do is change variables for powerlimit and IP adress of the switch (Shelly 1 mini) ? and then run this as a script in the PM mini?

    entering http://192.168.68.64/relay/0/?turn=off / on i a browser works, and PM shows a powerdraw of 20W, but no action triggered from the script.

    Diagnostics from the PMmini:

    shelly_notification:163 Status change of pm1:0: {"id":0,"apower":15.4} 11:46:49

    shelly_notification:163 Status change of pm1:0: {"id":0,"current":0.155} 11:46:49

    shelly_notification:163 Status change of pm1:0: {"id":0,"apower":6.1} 11:46:50

    shelly_notification:163 Status change of pm1:0: {"id":0,"current":0.108} 11:46:50

    shelly_notification:163 Status change of pm1:0: {"id":0,"apower":0.0} 11:46:51

    shelly_notification:163 Status change of pm1:0: {"id":0,"current":0.000} 11:46:51

    shelly_notification:163 Status change of pm1:0: {"id":0,"apower":2.9} 11:46:56

    shelly_notification:163 Status change of pm1:0: {"id":0,"current":0.030} 11:46:56

    Einmal editiert, zuletzt von Flytrapp (2. Dezember 2023 um 11:57)

  • If it is a local IP (command) you need to use http://127.0.0.0/.... or http://localhost/.... as the ip or just use a Switch.set local method like ['Switch.set',{id:0, on:true},null,null,debug].

  • Dieses Thema enthält 30 weitere Beiträge, die nur für registrierte Benutzer sichtbar sind, bitte registrieren Sie sich oder melden Sie sich an um diese lesen zu können.