diff --git a/CHANGED b/CHANGED index 919e2cbec..7d24adb7c 100644 --- a/CHANGED +++ b/CHANGED @@ -1,5 +1,9 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix: 22_HOMEMODE: - fix illegal division by zero in HOMEMODE_Luminance + - renamed attribute name HomeYahooWeatherDevice to + HomeWeatherDevic + - changed characteristic AirPressure UUID to name - bugfix: 49_SSCam: no snapinfos when snap was done by SVS itself (Forum: #45671.msg914685.html#msg914685), minor fixes - feature: 59_Weather: use demo data up to start then apikey equevalent demo diff --git a/FHEM/22_HOMEMODE.pm b/FHEM/22_HOMEMODE.pm index a90335a86..2bec60cec 100644 --- a/FHEM/22_HOMEMODE.pm +++ b/FHEM/22_HOMEMODE.pm @@ -16,7 +16,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use vars qw{%attr %defs %modules $FW_CSRF}; -my $HOMEMODE_version = "1.4.6"; +my $HOMEMODE_version = "1.4.7"; my $HOMEMODE_Daytimes = "05:00|morning 10:00|day 14:00|afternoon 18:00|evening 23:00|night"; my $HOMEMODE_Seasons = "03.01|spring 06.01|summer 09.01|autumn 12.01|winter"; my $HOMEMODE_UserModes = "gotosleep,awoken,asleep"; @@ -39,6 +39,7 @@ sub HOMEMODE_Initialize($) $hash->{NotifyOrderPrefix} = "51-"; $hash->{FW_deviceOverview} = 1; $hash->{FW_addDetailToSummary} = 1; + $hash->{AttrRenameMap} = { "HomeYahooWeatherDevice" => "HomeWeatherDevice" }; } sub HOMEMODE_Define($$) @@ -185,7 +186,7 @@ sub HOMEMODE_Notify($$) { HOMEMODE_RESIDENTS($hash,$devname); } - elsif (AttrVal($name,"HomeYahooWeatherDevice",undef) && $devname eq AttrVal($name,"HomeYahooWeatherDevice","")) + elsif (AttrVal($name,"HomeWeatherDevice",undef) && $devname eq AttrVal($name,"HomeWeatherDevice","")) { HOMEMODE_Weather($hash,$devname); } @@ -657,7 +658,7 @@ sub HOMEMODE_updateInternals($;$$) } $hash->{SENSORSBATTERY} = join(",",sort @sensors) if (@sensors); } - my $weather = HOMEMODE_AttrCheck($hash,"HomeYahooWeatherDevice"); + my $weather = HOMEMODE_AttrCheck($hash,"HomeWeatherDevice"); push @allMonitoredDevices,$weather if ($weather && !grep /^$weather$/,@allMonitoredDevices); my $twilight = HOMEMODE_AttrCheck($hash,"HomeTwilightDevice"); push @allMonitoredDevices,$twilight if ($twilight && !grep /^$twilight$/,@allMonitoredDevices); @@ -762,7 +763,7 @@ sub HOMEMODE_Get($@) my $params = "mode:noArg modeAlarm:noArg publicIP:noArg devicesDisabled:noArg"; $params .= " contactsOpen:all,doorsinside,doorsoutside,doorsmain,outside,windows" if ($hash->{SENSORSCONTACT}); $params .= " sensorsTampered:noArg" if ($hash->{SENSORSCONTACT} || $hash->{SENSORSMOTION}); - if (AttrVal($name,"HomeYahooWeatherDevice",undef)) + if (AttrVal($name,"HomeWeatherDevice",undef)) { if (AttrVal($name,"HomeTextWeatherLong",undef) || AttrVal($name,"HomeTextWeatherShort",undef)) { @@ -1426,7 +1427,7 @@ sub HOMEMODE_Attributes($) push @attribs,"HomeTriggerPanic"; push @attribs,"HomeTwilightDevice"; push @attribs,"HomeUWZ"; - push @attribs,"HomeYahooWeatherDevice"; + push @attribs,"HomeWeatherDevice"; return join(" ",@attribs); } @@ -1809,7 +1810,7 @@ sub HOMEMODE_Attr(@) HOMEMODE_updateInternals($hash); } } - elsif ($attr_name eq "HomeYahooWeatherDevice" && $init_done) + elsif ($attr_name eq "HomeWeatherDevice" && $init_done) { $trans = $HOMEMODE_de? "$attr_value muss ein gültiges Gerät vom TYPE Weather sein!": @@ -1834,7 +1835,7 @@ sub HOMEMODE_Attr(@) CommandDeleteAttr(undef,"$name HomeSensorHumidityOutside") if (AttrVal($name,"HomeSensorHumidityOutside",undef) && $attr_value eq AttrVal($name,"HomeSensorHumidityOutside",undef)); if ($attr_value_old ne $attr_value) { - CommandDeleteReading(undef,"$name temperature") if (!AttrVal($name,"HomeYahooWeatherDevice",undef)); + CommandDeleteReading(undef,"$name temperature") if (!AttrVal($name,"HomeWeatherDevice",undef)); HOMEMODE_updateInternals($hash); } } @@ -1850,7 +1851,7 @@ sub HOMEMODE_Attr(@) return $trans if (!HOMEMODE_CheckIfIsValidDevspec($attr_value,"humidity")); if ($attr_value_old ne $attr_value) { - CommandDeleteReading(undef,"$name humidity") if (!AttrVal($name,"HomeYahooWeatherDevice",undef)); + CommandDeleteReading(undef,"$name humidity") if (!AttrVal($name,"HomeWeatherDevice",undef)); HOMEMODE_updateInternals($hash); } } @@ -2050,9 +2051,9 @@ sub HOMEMODE_Attr(@) { delete $hash->{".IP_TRIGGERTIME_NEXT"}; } - elsif ($attr_name =~ /^(HomeYahooWeatherDevice|HomeTwilightDevice)$/) + elsif ($attr_name =~ /^(HomeWeatherDevice|HomeTwilightDevice)$/) { - if ($attr_name eq "HomeYahooWeatherDevice") + if ($attr_name eq "HomeWeatherDevice") { CommandDeleteReading(undef,"$name pressure|condition|wind"); CommandDeleteReading(undef,"$name temperature") if (!AttrVal($name,"HomeSensorTemperatureOutside",undef)); @@ -2066,8 +2067,8 @@ sub HOMEMODE_Attr(@) } elsif ($attr_name =~ /^(HomeSensorTemperatureOutside|HomeSensorHumidityOutside)$/) { - CommandDeleteReading(undef,"$name .*temperature.*") if (!AttrVal($name,"HomeYahooWeatherDevice",undef) && $attr_name eq "HomeSensorTemperatureOutside"); - CommandDeleteReading(undef,"$name .*humidity.*") if (!AttrVal($name,"HomeYahooWeatherDevice",undef) && $attr_name eq "HomeSensorHumidityOutside"); + CommandDeleteReading(undef,"$name .*temperature.*") if (!AttrVal($name,"HomeWeatherDevice",undef) && $attr_name eq "HomeSensorTemperatureOutside"); + CommandDeleteReading(undef,"$name .*humidity.*") if (!AttrVal($name,"HomeWeatherDevice",undef) && $attr_name eq "HomeSensorHumidityOutside"); HOMEMODE_updateInternals($hash); } elsif ($attr_name =~ /^(HomeDaytimes|HomeSeasons|HomeSpecialLocations|HomeSpecialModes)$/ && $init_done) @@ -2088,7 +2089,7 @@ sub HOMEMODE_replacePlaceholders($$;$) { my ($hash,$cmd,$resident) = @_; my $name = $hash->{NAME}; - my $sensor = AttrVal($name,"HomeYahooWeatherDevice",""); + my $sensor = AttrVal($name,"HomeWeatherDevice",""); $resident = $resident ? $resident : ReadingsVal($name,"lastActivityByResident",""); my $alias = AttrVal($resident,"alias",""); my $audio = AttrVal($resident,"msgContactAudio",""); @@ -2347,7 +2348,7 @@ sub HOMEMODE_WeatherTXT($$) { my ($hash,$text) = @_; my $name = $hash->{NAME}; - my $weather = AttrVal($name,"HomeYahooWeatherDevice",""); + my $weather = AttrVal($name,"HomeWeatherDevice",""); my $condition = ReadingsVal($weather,"condition",""); my $conditionart = ReadingsVal($name,".be",""); my $pressure = ReadingsVal($name,"pressure",""); @@ -2372,7 +2373,7 @@ sub HOMEMODE_ForecastTXT($;$) my ($hash,$day) = @_; $day = 2 if (!$day); my $name = $hash->{NAME}; - my $weather = AttrVal($name,"HomeYahooWeatherDevice",""); + my $weather = AttrVal($name,"HomeWeatherDevice",""); my $cond = ReadingsVal($weather,"fc".$day."_condition",""); my $low = ReadingsVal($weather,"fc".$day."_low_c",""); my $high = ReadingsVal($weather,"fc".$day."_high_c",""); @@ -2658,6 +2659,7 @@ sub HOMEMODE_Luminance($;$$) next unless ($val > 0); $lum += $val if (!$dev || $dev ne $_); } + return if (!scalar @sensorsa); my $lumval = defined $lum ? int ($lum / scalar @sensorsa) : undef; if (defined $lumval && $lumval >= 0) { @@ -3182,7 +3184,7 @@ sub HOMEMODE_HomebridgeMapping($) $mapping .= "\nMotionDetected=motionsInside_ct,values=0:0;/.*/:1" if (HOMEMODE_ID($name,undef,"motionsInside_ct")); $mapping .= "\nStatusLowBattery=batteryLow_ct,values=0:0;/.*/:1" if (HOMEMODE_ID($name,undef,"batteryLow_ct")); $mapping .= "\nSmokeDetected=alarmSmoke_ct,values=0:0;/.*/:1" if (HOMEMODE_ID($name,undef,"alarmSmoke_ct")); - $mapping .= "\nE863F10F-079E-48FF-8F27-9C2605A29F52=pressure,name=AirPressure,format=UINT16" if (HOMEMODE_ID($name,undef,"wind")); + $mapping .= "\nAirPressure=pressure" if (HOMEMODE_ID($name,undef,"pressure")); addToDevAttrList($name,"genericDeviceType") if (!grep /^genericDeviceType/,split(" ",AttrVal("global","userattr",""))); addToDevAttrList($name,"homebridgeMapping:textField-long") if (!grep /^homebridgeMapping/,split(" ",AttrVal("global","userattr",""))); CommandAttr(undef,"$name genericDeviceType security"); @@ -3486,7 +3488,9 @@ sub HOMEMODE_Details($$$) $html .= ""; $html .= "
$info
"; $html .= ""; - if (AttrVal($name,"HomeYahooWeatherDevice","")) + if (AttrVal($name,"HomeWeatherDevice","") || + (AttrVal($name,"HomeSensorAirpressure","") && AttrVal($name,"HomeSensorHumidityOutside","") && AttrVal($name,"HomeSensorTemperatureOutside","")) || + (AttrVal($name,"HomeSensorAirpressure","") && AttrVal($name,"HomeSensorTemperatureOutside","") && HOMEMODE_ID(AttrVal($name,"HomeSensorTemperatureOutside",""),undef,"humidity"))) { $html .= ""; my $temp = $HOMEMODE_de ? "Temperatur" : "Temperature"; @@ -3523,8 +3527,7 @@ sub HOMEMODE_Details($$$) my $tamp = $HOMEMODE_de ? "Sabotiert" : "Tampered"; $html .= ""; $html .= ""; - my $alarms = $HOMEMODE_de ? "Alarme" : "Alarms"; - $html .= ""; + $html .= ""; $html .= ""; $html .= ""; } @@ -4377,8 +4380,8 @@ sub HOMEMODE_Details($$$) default:
  • - HomeYahooWeatherDevice
    - your local yahoo weather device
    + HomeWeatherDevice
    + your local weather device
    default:
  • $tamp:".ReadingsVal($name,"sensorsTampered_ct","")."".ReadingsVal($name,"sensorsTampered_hr","")."$alarms:Alarm:".ReadingsVal($name,"alarmTriggered_ct","")."".ReadingsVal($name,"alarmTriggered_hr","")."