Just made a short bash script to made it possible again to check if my wifes laptop was on or not. Before I used the Alive plugin but thats not working after one of those glorious windows updates
This script uses nmap. You first need to install this. I tested this on raspberry pi 3B
Code: Select all
sudo apt-get update
sudo apt-get install nmap
Code: Select all
nano devup.sh
Code: Select all
#!/bin/bash
adres=$1
# example hostdown=`nmap -sP 192.168.88.182 | grep "Host seems down" | wc -l`
hostdown=`sudo nmap -sP $adres | grep "Host seems down" | wc -l`
hostup=`sudo nmap -sP $adres | grep "Host is up" | wc -l`
if [[ "$adres" = "-help" ]]; then
echo "type ip-address as parameter"
fi
if [[ "$hostup" = "1" ]]; then
echo -n "up"
elif [[ "$hostup" = "0" ]]; then
if [[ "$hostdown" = "1" ]]; then
echo -n "down"
elif [[ "$hostdown" = "0" ]]; then
echo -n "error"
fi
fi
Code: Select all
sudo chmod +x ./devup.sh
sudo chown pi:pi ./devup.sh
Code: Select all
return {
on = {
devices = {},
timer = {'every 5 minutes'},
variables = {},
scenes = {},
groups = {},
security = {},
httpResponses = {},
shellCommandResponses = {},
customEvents = {},
system = {},
},
data = {},
logging = {},
execute = function(domoticz, triggeredItem)
local ltearnip='192.168.12.123'
local ltearn=domoticz.devices('LaptopEarn') -- laptop earn
local command = '/home/pi/domoticz/scripts/bashscrips/devup.sh '..ltearnip
local handle = io.popen(command)
local updated = handle:read("*a")
handle:close()
domoticz.log('ltearn: '..updated)
if (updated == 'up') then
ltearn.switchOn().checkFirst()
elseif (updated == 'down') then
ltearn.switchOff().checkFirst()
end --endif
end
}
if there is a way to change the current Alive checker I would gladly help