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

davidneale

Question

is there a way to make home or away Variables by using your wifi at home so the Fibaro system nows when I ip dress comes into the area it know someone is home

Link to comment
Share on other sites

Recommended Posts

  • 0

Thanks @10der for this 

 

I hope you don't mind but I made 2 minor changes to your Unifi_Checker.lua to enable this code to check for the Unifi Devices (USG, AP) instead of the Clients

The LAN Checker VD didn't work to check if the AP is offline as there are no open ports

 

Within the function getDevices(cookie)

 

Change

Please login or register to see this code.

to 

Please login or register to see this code.

 

 

Within the function has_mac(tab, val) 

 

Change 

Please login or register to see this code.

to 

Please login or register to see this code.

 

I also tweaked the text to show as being offline/online as opposed to being present

 

Please login or register to see this image.

/monthly_2020_01/image.png.2db7a4ac1e0c35907504eeca02aba77a.png" />

 

I suppose the changes to check both the Unifi devices and clients could be incorporated into one scene

 

anyway, I hope this helps someone 

 

 

 

Edited by AutoFrank
  • Thanks 1
Link to comment
Share on other sites

  • 0

@10der thanks for the scenes and VD, this was exactly what I was looking for.

 

I have a Unifi Cloudkey Gen2 Plus on my network, so implemented your Presence state VD and Unifi checker scene. Followed your instructions for setting up the Global variables.

 

I'm seeing some strange behaviour: when I switch off Wifi on my iphone I can see the Unifi checker debug change from "Presence yes: MyName" to "Presence no: MyName", but after a couple of scene loops it changes back to "Presence yes: MyName".

 

Any ideas what might be wrong?

 

Thanks,

 

 

Link to comment
Share on other sites

  • 0
Quote

Any ideas what might be wrong?

You can turn on debugging 

and we can look what happened 

Link to comment
Share on other sites

  • 0

 

This is a cut and paste of the debug from the unifi checker scene:

Please login or register to see this image.

/monthly_2020_01/image.png.588deb608ac84dc059ebf66f23790366.png" />

 

Turned of my wifi at 21:52:50 and kept it off, 45 secs later the scene turns presence on again (while in my Unifi dashboard I am not present). The time between re-appearance seems random, sometimes 10-15 sec, sometimes longer, sometime it will not set presence to "no".

 

Thanks,

 

 

 

 

 

 

 

Edited by 6Blok
Link to comment
Share on other sites

  • 0

I would like to ask for advice:

 

- "Unifi checker" cannot be used because I do not have a HW controller and therefore I do not have a controller IP address but only an address that starts with "localhost ..."

 

- so I wanted to use "wifi-presence", everything is set up according to the instructions, but continuous detection of MAC presence on WIFI. Do I still have to start the scene?

 

Please login or register to see this spoiler.


- last I installed "presence-state", which should evaluate the status of "wifi-presence", but also misrepresenting, because "wifi-presence" seems not to run periodically for initial detection.

 

Where am I making mistake?

Link to comment
Share on other sites

  • 0

@10der thank you so much for the share. I used it dor a while.

Just migrated to Dream Machine Pro

any idea on how to adapt it?

I tried

local unifiController = "IP/network";

without success...

thx in advance!

Link to comment
Share on other sites

  • 0
12 minutes ago, Brunanchon said:

@10der

any idea on how to adapt it?

 

in fibaro srore somebody cretae QA for UniFi. you can try it

Please login or register to see this link.

Link to comment
Share on other sites

  • 0

@10der, unfortunately I'm on a HC2 without QA...

 

On PostMan I can easily login:

Please login or register to see this attachment.

 

 

But the following scene on HC2 returns an 401 ERROR.....

 

local credential = {username = "Fibaro", password = "XXXXXX"}
credential = json.encode(credential)

    local httpClient = net.HTTPClient()
    httpClient:request("https://192.168.0.254/api/auth/login", {
        success = function(response)
        print(json.encode(response.status))
        end,
        error = function(err)
        end,
        options = {
            method = 'POST',
            checkCertificate = false,
            data = credential
         }
          
    })


 

 

 

Link to comment
Share on other sites

  • 0

Ок I have backup of my Scene for HC2 and will send you  here

Link to comment
Share on other sites

  • 0

@10der 

can I also ask you to send your functional version?
I would also like to ask about the FW version of the unifi controller and other unifi elements in the network.
My network indicates that all devices are connected even though they are gone. It is a mistake unifi, resp. some specific FW or there is an error elsewhere.

Thank you very much and have a nice day

Link to comment
Share on other sites

  • 0

Anyone got this working still?

 

I use the Scene and VD provided by @10der . But i got an error. Not sure if that was the latest version i have.

 

Please login or register to see this spoiler.

 

Anyone know how to solve this, or want to share their working scene and VD with me?

 

I have a Cloudkey Gen2 Plus.

Made the variables as documented

Created a local user account on my CK2.

My URL is: https://192.168.0.5/network/site/default/v2/clients/properties/5e6fcc6e7551630526b8982a/about

I use "default" as site name.

 

Greets,

Remi

 

 

Edited by Remi
Link to comment
Share on other sites

  • 0

@hater Thank you for your reply :-)

 

I gues your right,

I was hoping someone else who use @10der code could help me maybe.

 

Seems i need to continue my quest for a working geofencing solution.

 

Thanks anyway!

Remi

Link to comment
Share on other sites

  • 0

@Remi: If there is any comfort I am facing the exact same issue. Have you managed to sort it out?

 

The problem is appearing on this row below in the doLogin() function:

local jsonTable = json.decode(response.data)

 

I am running my HC2 with 4.600 firmware and my Unifi Cloud Key G2 with 6.1.71 network controller.

 

Is there anyone out there who has managed to get a CloudKey G2 with a similiar setup as above to be working?

Link to comment
Share on other sites

  • 0

@erik.simonson : Hi Erik,

 

No, i never managed to get it work, it was a dead end for me.

 

Having tried alot other geofencing solutions which never worked great i eventually found a reliable mechanism for geofencing.

I use Google assistant home/away function now.

Based on my location it run's a routine "First person at home" or "Last person left home".

Those routine's push the buttons of  a on/off switch in the Google Home app.

This switch in the Google Home app is a VD in the Fibaro which is presented to the Google home app via a Automation Bridge.

The VD in the Fibaro change the variable "PresentState" to Home or Away.

 

I am using this for some weeks now and its working flawless to be honest.

 

One minor thing compared to other geofencing solutions is i cant track individually persons.

I have one Home/away variable now, while i had Home/away variables for each person in a past solution (which isnt working anymore...)

Being able to add specific actions for each person. For example my son who always forget to turn off the light in his bedroom.

I had a scene running when he left home (to school for example) it checked his bedroom if any light was left on, his TV was on still, or his rollershutter wasnt open.

 

But overall i am happy with the solution i have now, as its reliable and i can use the home and away  function again.

Edited by Remi
Link to comment
Share on other sites

  • 0
8 hours ago, morsink said:

Did someone get a version of this working on HC3 ?

 

Yes

Geofencing and WiFi. Both are not the perfect solution, but it works.

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