Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Question

Posted

Hi 

 

I am trying to figure out how to send myself a push when the iron (connected to wall plug) is consuming power (say more than 2W) for more than 30 minutes. This will mean that I probably forgot to turn it off

Please login or register to see this image.

/emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> I would like to be notified after 30 mins and then every 5 minutes. But I just cannot figure that out in LUA. Can you help?

13 answers to this question

Recommended Posts

  • 0
Posted

Nice idea... Ok, I will code something

Please login or register to see this image.

/emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> 

  • 0
  • Inquirer
  • Posted

    thanks, appreciated

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> 

    • 0
    Posted

    So... Can you test it please? 

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> I only made a test with shorter times. It works for me. You have to change the trigger, the wallplug-ID and the ID's of your phone.

    Please login or register to see this code.

    • 0
    Posted

     

    So... Can you test it please? 

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> I only made a test with shorter times. It works for me. You have to change the trigger, the wallplug-ID and the ID's of your phone.

     

    How do I find the ID of my phone?

    Do have to add it as a virtual device?

    • 0
    Posted

    This is a scene, which is triggered by status-change of your wall plug.

     

    You can find your ID over

    Please login or register to see this link.

     Here you can search for your phone-name. It looks like that:

     

    {

    • "id": 68,
    • "name": "iPhone 6",
    • "roomID": 0,
    • "type": "iOS_device",
    • "baseType": "",
    • "enabled": true,
    • "visible": true,
    • "isPlugin": false,
    • "parentId": 0,
    • "remoteGatewayId": 0,
    • "viewXml": false,
    • "configXml": false,
    • "interfaces": [ ],
    • "properties": {
      • "DeviceToken": "d37ef4************************************",
      • "DeviceUID": "44606C04********",
      • "Push": "true",
      • "deviceIcon": "91"
      },
    • "actions": {
      • "sendDefinedPushNotification": 1,
      • "sendPush": 1
      },
    • "created": 1434562121,
    • "modified": 1434562121,
    • "sortOrder": 64

    },

    • 0
  • Inquirer
  • Posted

     

    So... Can you test it please? 

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> I only made a test with shorter times. It works for me. You have to change the trigger, the wallplug-ID and the ID's of your phone.

    Please login or register to see this code.

    thanks, testing now

    • 0
  • Inquirer
  • Posted

    code is very good thanks. You did not declare power though

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> Fixed that. And also modified your code to abort scene and used "power" rather than "value" so that i do not have to turn off the plug, just unplug the iron

    • 0
    Guest fat
    Posted

    Would you be able to post your modified code please?

    • 0
  • Inquirer
  • Posted

    Please login or register to see this code.

    --[[

    %% properties

    500 power

    %% globals

    --]]

    local power_socket = 500 -- wallplug

    if (fibaro:countScenes()>1)

    then

    fibaro:abort();

    end

    local run = 0

    local counter = 0

    local counter2 = 0

    local iron_on = 0

    local power=fibaro:getValue(power_socket, "power")

    if ( tonumber(fibaro:getValue(power_socket, "power")) > 2 ) and run == 0 then

    fibaro:debug("IRON IS ON...")

    fibaro:debug("consumption = "..power.." Watt")

    run = 1

    end

    while run == 1 do

    if (tonumber(fibaro:getValue(power_socket, "value")) == 1) then

    counter = counter + 1

    end

    if (tonumber(fibaro:getValue(power_socket, "power")) > 2) and counter > 360 then

    fibaro:debug("Iron is on after 30 mins")

    fibaro:debug("Send Push")

    fibaro:call(285, "sendPush", ">30 min. Iron is on!!!", "iron");

    iron_on = 1

    while (tonumber(fibaro:getValue(power_socket, "value")) == 1) do

    if (counter2 > 60) then

    fibaro:debug('Still on. Send Push');

    fibaro:call(68, "sendPush", "REMINDER >5 min. Iron is on!!!", "iron");

    counter2 = 0

    end

    fibaro:sleep(5*1000);

    end

    elseif (tonumber(fibaro:getValue(power_socket, "power")) == 0 and counter < 360) then

    fibaro:debug("Iron off < 30 min... Abort scene")

    run = 0

    counter = 0

    end

    fibaro:sleep(5*1000)

    end

    • 0
    Guest fat
    Posted

    Thanks

    • 0
    Posted

    Glad to have helped

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    • 0
    Posted

    This is a scene, which is triggered by status-change of your wall plug.

     

    You can find your ID over

    Please login or register to see this link.

     Here you can search for your phone-name. It looks like that:

     

    {

    • "id": 68,
    • "name": "iPhone 6",
    • "roomID": 0,
    • "type": "iOS_device",
    • "baseType": "",
    • "enabled": true,
    • "visible": true,
    • "isPlugin": false,
    • "parentId": 0,
    • "remoteGatewayId": 0,
    • "viewXml": false,
    • "configXml": false,
    • "interfaces": [ ],
    • "properties": {
      • "DeviceToken": "d37ef4************************************",
      • "DeviceUID": "44606C04********",
      • "Push": "true",
      • "deviceIcon": "91"
      },
    • "actions": {
      • "sendDefinedPushNotification": 1,
      • "sendPush": 1
      },
    • "created": 1434562121,
    • "modified": 1434562121,
    • "sortOrder": 64

    },

    Thank you, found it.

    Only thing what worries me that I've got an Android device and also I get:

    "type":"iOS_device"

    • 0
    Posted

    Android phones have the same type as apple's. That is documented nowhere, I know it from experience.

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...