Comments (4)
Answering myself...
The issue seems to be that using a 'set' command nearly always kills the ping timer associated with that network item, so killing the monitor for good, as it is only started once in 'new'. The timer is stored in the Network Item object as 'timer' here:
$self->{timer} = new Timer;
But Network Item inherits 'Generic_item' functions, so appears to conflict with an existing variable by the same name.
Working (proposed solution: rename the variable)
$self->{nw_ping_timer} = new Timer;
$self->{nw_ping_timer}->set( $interval, sub { Network_Item::ping_check($self); }, -1 );
While I'm here, the 'default_setstate' function isn't used, and this code in 'setstate_start' doesn't do anything useful, and if it did what was intended, I think not desirable as it assumes actual state which is not necessarily true (may be already 'up' when a start is actioned).
if ( $self->state eq "start" ) {
$state eq "down";
$self->set($state);
}
from misterhouse.
from misterhouse.
I think once-upon-a-time it might have made sense to change the network states to ON and OFF for uniformity, but probably not now as a) there's plenty of code out there that would need to be changed, b) ON and OFF may possibly have been used as well as 'up' and 'down' (by others, considering generic item inheritance), and c) there are many items that use special values in the state variable to indicate various conditions - it's not so unusual.
from misterhouse.
And one more for this item...
At least in Linux systems - this tiny change stops all the "Name or service not known" logspam on the terminal when network items are offline:
$self->{process} = new Process_Item( $ping_test_cmd . $address . " 2>&1 | grep ttl" );
from misterhouse.
Related Issues (20)
- Running master from zipfile gives fatal message HOT 2
- NOAA website changes broke lib/site/Geo/WeatherNOAA.pm and get_weather (see issue #631) HOT 2
- Stacked set not updating device state HOT 1
- High CPU usage when browsing in ia7 HOT 1
- Mh 4.3 ia7 floorplan icon placement still needs work HOT 1
- Ia7 browse types generates 6-10 json calls/s HOT 1
- ia7 slider does not work on android HOT 3
- ia7 floorplan slider HOT 8
- Can't Regexp::Common::FIRSTKEY at /opt/mh/bin/../lib/json_server.pl line 988. HOT 17
- server_startup('mqtt') undefined subroutine? HOT 2
- [SCHEDULE] logging every new minute HOT 6
- "Keys on Scalar" Syntax in json_server.pl Causes Fatal Error in Later Perl Versions
- Oops1: Variable "$xml" is not imported at (eval 640) line 718 HOT 1
- Perl errors with unescaped brace in regular expression
- perl issue - Generic item
- perl issue: code select and unselect HOT 1
- Need help with install HOT 3
- ia7 cannot display group when state value of a member is a number HOT 2
- Two Tasmota_HTTP_Item.pm async mode issues
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from misterhouse.