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


  • 0

Ping iPhone instead of GPS localization


SDeath

Question

Instead of using the GPS localization which consumes enormous amounts of power from the iPhone, I want to let the HC2 ping every minute if it can find the iPhone on my local network.

And based on that set a value if somebody is home or not.

Since 3.486 os.execute doesn't work.

Anybody have an idea how to use that function?

This is what I want to do:

Please login or register to see this code.

Edit:forgot the while true do.

Link to comment
Share on other sites

  • Answers 102
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Posted Images

Recommended Posts

  • 0

+1

I would of course change that to "RonaldThuis"

Please login or register to see this image.

/emoticons/default_icon_smile.gif" alt=":-)" />

Link to comment
Share on other sites

  • 0

great I was locking for something like that..

When iMac online turn desk light on..

Link to comment
Share on other sites

  • 0
  • Inquirer
  • First we need to get this working.

    Anybody have any idea how to get this to work?

    Link to comment
    Share on other sites

    • 0
    Guest sztywniak

    look for any open port in your Iphone and try with NET library

    Please login or register to see this code.

    I haven't Iphone , I don't try this

    Please login or register to see this image.

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

    Link to comment
    Share on other sites

    • 0

    tcpSocket = Net.FTcpSocket("10.0.3.11", 80)

    bytes, errorCode = tcpSocket:write("test")

    if errorCode == 0

    then

    -- printing log under virtual device

    fibaro:log("IPHONE OK")

    else

    fibaro:log("IPHONE failed")

    end

    gives:

    [ERROR] 22:42:35: line 7: attempt to index global 'Net' (a nil value)

    And if I remove the " " signed around the IP number:

    tcpSocket = Net.FTcpSocket(10.0.3.11, 80)

    bytes, errorCode = tcpSocket:write("test")

    if errorCode == 0

    then

    -- printing log under virtual device

    fibaro:log("IPHONE OK")

    else

    fibaro:log("IPHONE failed")

    end

    gives:

    [ERROR] 22:44:48: line 7: malformed number near '10.0.3.11'

    Something tells me that I should not do this in LUA code, but use a Virtual Device...

    Link to comment
    Share on other sites

    • 0
    Guest deraaij

    You should use an open port (e.g. 62078), the following works:

    Please login or register to see this code.

    For now this only works in virtual device LUA so you should use a scene to press the button for now (if you want to schedule it).

    Link to comment
    Share on other sites

    • 0
    Guest sztywniak

    Thx Mark

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    Link to comment
    Share on other sites

    • 0
    Guest deraaij
    Thx Mark

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    Well thank you for this great idea

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Perfect this works!

    Thanks guys!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • You should use an open port (e.g. 62078), the following works:

    Please login or register to see this code.

    For now this only works in virtual device LUA so you should use a scene to press the button for now (if you want to schedule it).

    Just one more question how to change it so it will only change the variable value when the state changes.

    Using the above it will set the variable every minute to 0 and this will act as a change.

    This is what works right now in a virtual device button.

    When the value is 0 it will send a push message to me to confirm arming my alarm, and vice versa.

    But this message get's send now every minute as the value is set every minute.

    I'm new to LUA some help is appreciated.

    Please login or register to see this code.

    [ Added: 2013-03-12, 08:40 ]

    This seems to do what I want does it look correct?

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
    Guest deraaij

    Will work, I would do something like this though:

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Will work, I would do something like this though:

    Please login or register to see this code.

    Bedankt!

    Gona give that a try later on. Is a bit cleaner.

    Edit:

    You solution doesn't seem to work. So I'm going back to mine that does work.

    Thanks anyway for your help.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Have no idea how to implement this? as a virtual device? as a scene? do i need a variable?

    Create a variable, in my example named EdwinThuis.

    Create a virtual device and create a button with the LUA code above.

    Create a scene that "presses" this button every minute.

    Link to comment
    Share on other sites

    • 0
    Guest Lode

    Works great !!!

    Possibilities ? Endless.......

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Thx for this nice solution !!

    Link to comment
    Share on other sites

    • 0
    You should use an open port (e.g. 62078), the following works:

    Please login or register to see this code.

    For now this only works in virtual device LUA so you should use a scene to press the button for now (if you want to schedule it).

    Where does this logging output show up? The ping test actually does work but I do not see any logging in my 'Event Panel'. Am I overlooking something?

    Link to comment
    Share on other sites

    • 0
    Guest deraaij

    On the status log from the device. Similar as status updates from z-wave devices.

    Link to comment
    Share on other sites

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