From b5a068e0387f34b9465175e2a4df3f1b8ef575bc Mon Sep 17 00:00:00 2001 From: rapster <> Date: Sun, 23 Aug 2015 22:14:04 +0000 Subject: [PATCH] 74_Unifi: Added alternative 'ip' and 'Unknown' if WLAN-Client has no hostname git-svn-id: https://svn.fhem.de/fhem/trunk@9122 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/74_Unifi.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fhem/FHEM/74_Unifi.pm b/fhem/FHEM/74_Unifi.pm index f53c6a77d..957c46346 100644 --- a/fhem/FHEM/74_Unifi.pm +++ b/fhem/FHEM/74_Unifi.pm @@ -1,5 +1,5 @@ ############################################################################### -# $Id: 74_Unifi.pm 2015-08-23 18:00 - rapster - rapster at x0e dot de $ +# $Id: 74_Unifi.pm 2015-08-23 23:00 - rapster - rapster at x0e dot de $ package main; use strict; @@ -19,7 +19,7 @@ sub Unifi_Initialize($$) { $hash->{NOTIFYDEV} = "global"; $hash->{NotifyFn} = "Unifi_Notify"; $hash->{AttrList} = "disable:1,0 " - .$readingFnAttributes; + .$readingFnAttributes; } ############################################################################### @@ -345,7 +345,7 @@ sub Unifi_GetClients_Receive($) { for my $h (@{$data->{data}}) { $hash->{clients}->{$h->{user_id}} = $h; $connectedClientIDs->{$h->{user_id}} = 1; - readingsBulkUpdate($hash,$h->{user_id}."_hostname",$h->{hostname}); + readingsBulkUpdate($hash,$h->{user_id}."_hostname",($h->{hostname}) ? $h->{hostname} : ($h->{ip}) ? $h->{ip} : 'Unknown'); readingsBulkUpdate($hash,$h->{user_id}."_last_seen",strftime "%Y-%m-%d %H:%M:%S",localtime($h->{last_seen})); readingsBulkUpdate($hash,$h->{user_id}."_uptime",$h->{uptime}); readingsBulkUpdate($hash,$h->{user_id},'connected'); @@ -490,13 +490,14 @@ The device will be still connected, even it is in PowerSave-Mode. (In this mode If set to 0 the automatic updating will performed.