[Script] Report devices online status

Moderator: leecollings

Post Reply
Chopper_Rob
Posts: 17
Joined: Wednesday 28 May 2014 21:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

[Script] Report devices online status

Post 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.
User avatar
Mince Inside
Posts: 20
Joined: Wednesday 02 April 2014 20:59
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Scotland
Contact:

Re: [Script] Report devices online status

Post 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
Domoticz V2.2259
Raspberry Pi (B) with PiFace
RFXtrx433 USB
LighwaveRF relays, dimmer bulbs and light switches
Siemens On/Off 13A adaptors
Marmitek MS13E Motion (and Dusk) sensors
User avatar
blackdog65
Posts: 311
Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Norfolk, UK
Contact:

Re: [Script] Report devices online status

Post 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
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: [Script] Report devices online status

Post by simonrg »

Why are you using a script for this?

When this functionality is built into Domoticz.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
User avatar
blackdog65
Posts: 311
Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Norfolk, UK
Contact:

Re: [Script] Report devices online status

Post 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
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E
Chopper_Rob
Posts: 17
Joined: Wednesday 28 May 2014 21:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: [Script] Report devices online status

Post 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.
User avatar
galadril
Posts: 828
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: [Script] Report devices online status

Post by galadril »

Script is not found anymore?
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: [Script] Report devices online status

Post 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)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest