Python Plugin: Wan IP Checker
Moderator: leecollings
-
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: Plugin - Wan IP Checker
when this error pop up it also let crash other python scripts. Need to restart Domoticz to let it run ok again
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Plugin - Wan IP Checker
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 !!
br,
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Plugin - Wan IP Checker
#1st Post Updated with the new version.
-Improve: Timeout added to prevent stale url requests.
-Improve: Timeout added to prevent stale url requests.
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Plugin - Wan IP Checker
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
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Plugin - Wan IP Checker
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
Can you give more details?
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Plugin - Wan IP Checker
Used the latest version, running on Synology.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Plugin - Wan IP Checker
@EdwinK,
You will see this in the log if the plugin Heartbeat is ever greater than (or equal to) 30 seconds because Domotoicz doesn't like it.
The plugin will work just fine, that is just a warning.
You will see this in the log if the plugin Heartbeat is ever greater than (or equal to) 30 seconds because Domotoicz doesn't like it.
The plugin will work just fine, that is just a warning.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Plugin - Wan IP Checker
Thanks. Will ignore it then.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- Teknor
- Posts: 30
- Joined: Monday 08 February 2016 13:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.48
- Location: Norway
- Contact:
Re: Plugin - Wan IP Checker
When installing the plugin I get the following error and Domoticz will not start. Kind of strange that my GPIO export settings will make the script fail?
All help is appreciated. Thanks.
All help is appreciated. Thanks.
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.
Raspberry Pi 3 | EasyESP NodeMCU v3 | RFXTRX433e | Mysensors NRF24L01 | MotionEYE | PikrellCam
-
- Posts: 748
- Joined: Saturday 27 February 2016 12:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: NL
- Contact:
Re: Plugin - Wan IP Checker
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...
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...
Hans
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Plugin - Wan IP Checker
Hi there.
Do you have any other python plugins?
D you have python properly installed?
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Plugin - Wan IP Checker
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
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
-
- Posts: 748
- Joined: Saturday 27 February 2016 12:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: NL
- Contact:
Re: Plugin - Wan IP Checker
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
Hans
- ycahome
- Posts: 248
- Joined: Sunday 12 February 2017 10:55
- Target OS: Linux
- Domoticz version: lat Beta
- Contact:
Re: Plugin - Wan IP Checker
if you try to install, you will be prompted when the package is already installed.
--------
https://www.youtube.com/siakavelisgr
https://www.youtube.com/siakavelisgr
-
- Posts: 748
- Joined: Saturday 27 February 2016 12:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: NL
- Contact:
Re: Plugin - Wan IP Checker
Sure enough: that second install did it. I can now add the IP checker in the HW tab. Thanks!
Hans
-
- Posts: 24
- Joined: Tuesday 13 September 2016 19:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Plugin - Wan IP Checker
Thanks for the plugin, and thanks to the creator
works 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: But this is the result: Anyone know how I can get the correct utility value in the email/notification?
Thanks!

Now I would like to do one thing with this script, send myself an email when the WAN IP changes

Now I have created this script: But this is the result: Anyone know how I can get the correct utility value in the email/notification?
Thanks!
RPi 3
Domoticz Béta
RFLink Gateway dipool antenna
Many kaku devices
P1 smart meter
Custom made ESP8266 devices
Hue lights / Milight ligts and strips
Domoticz Béta
RFLink Gateway dipool antenna
Many kaku devices
P1 smart meter
Custom made ESP8266 devices
Hue lights / Milight ligts and strips
-
- Posts: 748
- Joined: Saturday 27 February 2016 12:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: NL
- Contact:
Re: Plugin - Wan IP Checker
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!
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...
Hans
-
- Posts: 24
- Joined: Tuesday 13 September 2016 19:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Plugin - Wan IP Checker
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...
It may post several times an hour, but only if the WAN does actually change, thats why I made the user variable. But I dont understand why this doesnt work, even when I email the utility it just saids utility(358) instead of the actual value.
But if you could post it, I would much appreciate !
Thanks!
It would actually be smoother to integrate this functionality into the Plugin itself. I would need to do some Python exercises first, I am an experienced C programmer but this is just a little bit different.
RPi 3
Domoticz Béta
RFLink Gateway dipool antenna
Many kaku devices
P1 smart meter
Custom made ESP8266 devices
Hue lights / Milight ligts and strips
Domoticz Béta
RFLink Gateway dipool antenna
Many kaku devices
P1 smart meter
Custom made ESP8266 devices
Hue lights / Milight ligts and strips
-
- Posts: 748
- Joined: Saturday 27 February 2016 12:49
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: NL
- Contact:
Re: Plugin - Wan IP Checker
You could have the e-mail script triggered by a change in the text device: once the WAN address changes, the plugin will change the text and it would then trigger the mail. Probably. It makes the whole mechanism somewhat easier, and it will result in one single e-mail after a change of the WAN address. But I want to have one mail per day, in case I miss a warning mail. It will keep sending the daily mail, until I have changed my DNS entry and also stored the new IP address in my user variable.
My script works like this: I store the currently known WAN address in a user variable, and check that. If it changes, I compose and send an e-mail, and store the date in another user variable. The next time I want to send an email, I check the date: if it is the same I donot send. This way I only get one single warning message per day.
Code dependency:
two user variables (type string):
"WAN IP" contains the last known WAN IP address
"WAN IP Warning sent" contains the date on which a warning was sent (to make sure one warning is sent per day, not more/less)
one text device, as created by the plugin, named "WAN IP".
My script works like this: I store the currently known WAN address in a user variable, and check that. If it changes, I compose and send an e-mail, and store the date in another user variable. The next time I want to send an email, I check the date: if it is the same I donot send. This way I only get one single warning message per day.
Code dependency:
two user variables (type string):
"WAN IP" contains the last known WAN IP address
"WAN IP Warning sent" contains the date on which a warning was sent (to make sure one warning is sent per day, not more/less)
one text device, as created by the plugin, named "WAN IP".
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
Last edited by manjh on Monday 29 January 2018 23:05, edited 3 times in total.
Hans
Who is online
Users browsing this forum: Bing [Bot] and 1 guest