Re: Plugin - Wan IP Checker
Posted: Saturday 02 September 2017 18:40
when this error pop up it also let crash other python scripts. Need to restart Domoticz to let it run ok again
Open source Home Automation System
https://forum.domoticz.com/
This depends on which type of devices/switches are allowed to be remotely transferred from Domoticz. This is not something that can be defined from plugin itself.poudenes wrote: Wednesday 30 August 2017 9:31 Works GREAT !!!!!
Only thing: You can not use it on a Slave Domoticz and read the info on the Master Domoticz. The Device is not shown in list of "not used"devices on the Master Domoticz.
Maybe thats it thing to look at. Rest briljant plugin. Now i can check if my VPN is on !!
Code: Select all
2017-09-15 22:11:30.547 Error: IP Check hardware (38) thread seems to have ended unexpectedly
Strage, did you change to new version (1.1.0)? or you still have the previous one?EdwinK wrote: Friday 15 September 2017 22:17 Used to work earlier today (no error seen), but by change I looked at the error-log tonight and noticed this
Code: Select all
2017-09-15 22:11:30.547 Error: IP Check hardware (38) thread seems to have ended unexpectedly
Code: Select all
pi@raspberrypi:~/domoticz/plugins $ sudo service domoticz.sh status
● domoticz.service - LSB: Home Automation System
Loaded: loaded (/etc/init.d/domoticz.sh)
Active: active (exited) since sø. 2017-10-29 21:37:23 CET; 3min 7s ago
Process: 576 ExecStart=/etc/init.d/domoticz.sh start (code=exited, status=0/SUCCESS)
okt. 29 21:37:23 raspberrypi sudo[861]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/sh -c echo 27 > /sys/class/gpio/export
okt. 29 21:37:23 raspberrypi sudo[861]: pam_unix(sudo:session): session opened for user root by (uid=0)
okt. 29 21:37:23 raspberrypi sudo[861]: pam_unix(sudo:session): session closed for user root
okt. 29 21:37:23 raspberrypi sudo[874]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/sh -c echo high > /sys/class/gpio/gpio27/direction
okt. 29 21:37:23 raspberrypi sudo[874]: pam_unix(sudo:session): session opened for user root by (uid=0)
okt. 29 21:37:23 raspberrypi sudo[874]: pam_unix(sudo:session): session closed for user root
okt. 29 21:37:23 raspberrypi sudo[886]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/sh -c echo 1 > /sys/class/gpio/gpio27/active_low
okt. 29 21:37:23 raspberrypi sudo[886]: pam_unix(sudo:session): session opened for user root by (uid=0)
okt. 29 21:37:23 raspberrypi sudo[886]: pam_unix(sudo:session): session closed for user root
okt. 29 21:37:23 raspberrypi systemd[1]: Started LSB: Home Automation System.
Hi there.manjh wrote: Sunday 28 January 2018 18:46 I installed this following the instructions. Logged in and then did sudo su.
Created the plugin.py in a new subdir under "plugins".
Restarted Domoticz. No errors, but I don't see the WAN checker in the hardware setup dropdown...
Code: Select all
# from https://www.domoticz.com/wiki/Using_Python_plugins
# install dependencies
sudo apt-get install -y python3
# Domoticz Beta versions since V3.6129 also require...
sudo apt-get install -y python3-dev
OK, this tells me how to install. But how can I check if it is already installed or not?ycahome wrote: Monday 29 January 2018 8:30Code: Select all
# from https://www.domoticz.com/wiki/Using_Python_plugins # install dependencies sudo apt-get install -y python3 # Domoticz Beta versions since V3.6129 also require... sudo apt-get install -y python3-dev
if you try to install, you will be prompted when the package is already installed.manjh wrote: Monday 29 January 2018 13:04
OK, this tells me how to install. But how can I check if it is already installed or not?
I have done exactly that today! Even made sure I only receive one e-mail per day. Otherwise you may wake up with a mailbox full of warnings..domoticzag wrote: Monday 29 January 2018 18:22 Thanks for the plugin, and thanks to the creatorworks great!
Now I would like to do one thing with this script, send myself an email when the WAN IP changes, of course, with the IP in the message.
Now I have created this script:
1.PNG
But this is the result:
2.PNG
Anyone know how I can get the correct utility value in the email/notification?
Thanks!
manjh wrote: Monday 29 January 2018 18:48I have done exactly that today! Even made sure I only receive one e-mail per day. Otherwise you may wake up with a mailbox full of warnings..domoticzag wrote: Monday 29 January 2018 18:22 Thanks for the plugin, and thanks to the creatorworks great!
Now I would like to do one thing with this script, send myself an email when the WAN IP changes, of course, with the IP in the message.
Now I have created this script:
1.PNG
But this is the result:
2.PNG
Anyone know how I can get the correct utility value in the email/notification?
Thanks!
The only thing is: It is not in Blockly, but in LUA. If you have the courage to get into LUA, I can post my small LUA script here...
Code: Select all
-- This script will periodically check if the WAN IP is changed
commandArray = {}
-- get stored WAN IP address
VAR_IP = uservariables['WAN IP']
-- get current WAN IP address
WAN_IP = otherdevices_svalues['WAN IP']
-- check if current WAN IP address has changed
if (VAR_IP ~= WAN_IP) then
-- check if warning was already sent today
curr_date = os.date('%Y-%m-%d')
sent_date = uservariables['WAN IP Warning sent']
if (sent_date ~= curr_date) then
print ("Warning! WAN IP has changed!")
-- compose text for warning e-mail
Subject = "WAP IP address has changed"
Body = " The WAN IP address in De Meern seems to have changed. Previous address was "..VAR_IP..". Current address is "..WAN_IP..". Please check, and change the DNS entry at Hostnet."
-- send warning e-mail to admin (address is stored in uservariable AdminMail)
commandArray['SendEmail'] = Subject .. "#" .. Body .. "#" .. uservariables['AdminMail']
-- store current date to indicate warning has been sent
commandArray['Variable:WAN IP Warning sent'] = curr_date
end
else
-- clear warning sent field, if necessary
if (uservariables['WAN IP Warning sent'] ~= ".") then
commandArray['Variable:WAN IP Warning sent'] = "."
end
end
return commandArray