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
On the status log from the device. Similar as status updates from z-wave devices.

INteresting. In the top part of the window you mean? Nothing appearing there...

Here's my (very basic and similar to above) script:

tcpSocket = Net.FTcpSocket("10.0.3.104", 62078)

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

if errorCode == 0

then

fibaro:setGlobal("RonaldThuis", "1");

fibaro:log("Ronald is thuis");

else

fibaro:setGlobal("RonaldThuis", "0");

fibaro:log("Ronald is niet thuis");

end

I also have a very basic block scripts which 'presses the virtual button' every minute. I sometimes DO see my global variable changing, but I see no log appear in the status window.

Also: does anyone know how long the tcpSocket:write() tries before it times out?

Thanks!

Ronald

Please login or register to see this attachment.

Link to comment
Share on other sites

  • 0
Guest deraaij

Example (just a test virtual device) Green text.

Please login or register to see this attachment.

Link to comment
Share on other sites

  • 0
Example (just a test virtual device) Green text.

Ach..... fibaro:log("Ronald is not yet awake...")

Please login or register to see this image.

/emoticons/default_laugh.png" alt=":lol:" />

Thank you. That works.

Link to comment
Share on other sites

  • 0
Guest deraaij
Example (just a test virtual device) Green text.

Ach..... fibaro:log("Ronald is not yet awake...")

Please login or register to see this image.

/emoticons/default_laugh.png" alt=":lol:" />

Thank you. That works.

you are welcome

Link to comment
Share on other sites

  • 0

Works perfectly thank you so much

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" />

BUT!

Please login or register to see this image.

/emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

anyone have any idea what port to use on an Android device eg Galaxy S3?

Link to comment
Share on other sites

  • 0
Guest deraaij
Works perfectly thank you so much

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" />

BUT!

Please login or register to see this image.

/emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

anyone have any idea what port to use on an Android device eg Galaxy S3?

I am not sure as I don't have one, you can check with a port scanner.

Link to comment
Share on other sites

  • 0

Port 55000 works with Samsung TV and Galaxy just for reference

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" />

Link to comment
Share on other sites

  • 0
Guest Lode
Works perfectly thank you so much

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" />

BUT!

Please login or register to see this image.

/emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

anyone have any idea what port to use on an Android device eg Galaxy S3?

Try to find out what port your phone uses for sync with other devices.

This one you can use.

On Ipad i use "fing" to scan ip's and port

There's also an android version of this app.

Link to comment
Share on other sites

  • 0

Need some help to make this code compleet.

Turn On desk light when computer Online else turn Off

Please login or register to see this code.

Link to comment
Share on other sites

  • 0
Guest deraaij
Need some help to make this code compleet.

Turn On desk light when computer Online else turn Off

Please login or register to see this code.

You want to use this as a virtual device button? (that has no triggers) in the current version (beta 3.506) NET library does not work yet in scene's.

You could make a scene which pushes the virtual device button every minute and use this code on a virtual device:

Please login or register to see this code.

Link to comment
Share on other sites

  • 0

@Mark,

The code need to be entered in the string to send field in the Virtual device button

Link to comment
Share on other sites

  • 0
Guest deraaij
@Mark,

The code need to be entered in the string to send field in the Virtual device button

check LUA code and then paste code.

Link to comment
Share on other sites

  • 0

thanks ...done that only getting the command ping faild

Desk light is turning 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" />

on my computer this is showing

localhost:631 (LISTEN)

I think 631 must be than okay..

Update

49315 is okay...

thanks.

Link to comment
Share on other sites

  • 0
Guest deraaij
thanks ...done that only getting the command ping faild

Desk light is turning 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" />

on my computer this is showing

localhost:631 (LISTEN)

I think 631 must be than okay..

Update

49315 is okay...

thanks.

you are welcome!

Link to comment
Share on other sites

  • 0

Tip:

If you are running dropbox on your PC/Mac poort 17500 is mostly open.

Link to comment
Share on other sites

  • 0

Ahh of course, I was opening the devices not virtual devices, thank you

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" />

Is there a way to adapt this for more than 1 iPhone? So if my girlfriend comes over and I pop to the shop all of the lights don't switch off when I leave ?

So it could say something like

If john_at_home = 0 and kat_at_home = 0 then switch off the lights

Link to comment
Share on other sites

  • 0

Make a separate button (on the same virtual device) for each phone. You don't need a Target IP in the General settings of the virtual device. The script will handle this

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