Page 1 of 1

[Script] Report devices online status

Posted: Wednesday 28 May 2014 22:11
by Chopper_Rob
I see a lot of topics from other users who are trying to create scripts for monitoring network devices, so i would like to share my python script. This way not everybody has to build the same thing and they can focus on some other cool scripts. ;)

This script uses ping to monitor a device on the network.
To reduce the number of false positives i added a 'cooldown' period.
So if a device goes offline it is not immediately reported back to domoticz, it waits to see if the device comes back online before the cooldown period expires.
This is very useful if you want to use your phone to determine if you are at home. For example, an iPhone is not always connected to the network when it is locked, especially at night it can be "offline" for 45 minutes before it returns on the network. Without the cooldown period domoticz will get a lot of fake reports and it could be switching devices off when your still at home.

Before reporting a change in the online/offline status, the script first checks the current status of the switch in Domoticz. If the switch already has the correct status it won't reset it, this prevents triggering domoticz events for a second time.

You can find the script here : http://www.chopperrob.nl/domoticz/5-rep ... o-domoticz

I hope you like it.

Re: [Script] Report devices online status

Posted: Thursday 29 May 2014 19:18
by Mince Inside
Nice script - have you read about the iBeacon and this bad boy? https://learn.adafruit.com/pibeacon-ibe ... i/overview. Dont know if it's just as prone to the iPhone going AWOL

Re: [Script] Report devices online status

Posted: Thursday 04 June 2015 13:50
by blackdog65
Hiya,

I've been using this script quite happily and it has been working fine, however I've had the password enabled

Code: Select all

# Settings for the domoticz server
domoticzserver="192.168.xx.xx:8080"
domoticzusername = "xxxxx"
domoticzpassword = "xxxxx"
A different script that I'm experimenting with currently doesn't run WITH password enabled...

so my question is... how do I disable check_device_online.py needing a password?
I tried leaving Un and Pw blank, commenting them out but no luck

Any ideas?

thanks
Sean

Re: [Script] Report devices online status

Posted: Thursday 04 June 2015 14:43
by simonrg
Why are you using a script for this?

When this functionality is built into Domoticz.

Re: [Script] Report devices online status

Posted: Thursday 04 June 2015 14:53
by blackdog65
I was using it before it was added to Domoticz. I did have a little play with the new system and it was a bit iffy. Telling me I wasn't there when I obviously was... as I was reading the screen :shock:

Although in honesty, I probably didn't have the time and patience to get the settings right. If you have something that's working it's a case of "If it ain't broke, don't fix it" ;)

I may have to rethink though order to use moshel's script

Re: [Script] Report devices online status

Posted: Tuesday 23 June 2015 23:01
by Chopper_Rob
When the script is running on the same machine as domoticz you can use the ip adress 127.0.0.1 in the settings. This way you don't need to enter the credentials.

Re: [Script] Report devices online status

Posted: Thursday 20 October 2016 18:04
by galadril
Script is not found anymore?

Re: [Script] Report devices online status

Posted: Thursday 20 October 2016 18:12
by tozzke
galadril wrote:Script is not found anymore?
I believe it's the same as the wiki (although the wiki has some minor tweaks)