Skip to content

Commit

Permalink
v1.40
Browse files Browse the repository at this point in the history
  • Loading branch information
demel42 committed Nov 3, 2023
1 parent b2b34d4 commit b7e097d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 14 deletions.
44 changes: 32 additions & 12 deletions NetatmoWeatherDevice/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,8 @@ private function update_Wunderground($netatmo, $device)
}

// Messwerte für Wunderground bereitstellen
$last_measure = 0;
$pressure = '';
$time_utc = '';
$temp = '';
$humidity = '';
$rain = '';
Expand All @@ -1027,8 +1027,14 @@ private function update_Wunderground($netatmo, $device)
return;
}

if (isset($dashboard['time_utc'])) {
$last_measure = $dashboard['time_utc'];
} else {
$last_measure = time();
$this->SendDebug(__FUNCTION__, 'missing "time_utc", use current timestamp', 0);
}

$pressure = $this->GetArrayElem($dashboard, 'AbsolutePressure', 0);
$time_utc = $dashboard['time_utc'];

$modules = $this->GetArrayElem($device, 'modules', '');
if ($modules == '') {
Expand Down Expand Up @@ -1066,7 +1072,7 @@ private function update_Wunderground($netatmo, $device)
}
}

$param = '&dateutc=' . rawurlencode(date('Y-m-d G:i:s', $time_utc));
$param = '&dateutc=' . rawurlencode(date('Y-m-d G:i:s', $last_measure));
if ($temp > 0) {
$param .= '&tempf=' . rawurlencode($this->celsius2farenheit($temp));
}
Expand Down Expand Up @@ -1205,7 +1211,12 @@ private function eval_Station($netatmo, $device)
return $statuscode;
}

$last_measure = $dashboard['time_utc'];
if (isset($dashboard['time_utc'])) {
$last_measure = $dashboard['time_utc'];
} else {
$last_measure = time();
$this->SendDebug(__FUNCTION__, 'missing "time_utc", use current timestamp', 0);
}

// letzte Kommunikation der Station mit Netatmo
$last_contact = $device['last_status_store'];
Expand Down Expand Up @@ -1269,7 +1280,12 @@ private function eval_Station($netatmo, $device)

if (isset($module['dashboard_data'])) {
$dashboard = $module['dashboard_data'];
$last_measure = $dashboard['time_utc'];
if (isset($dashboard['time_utc'])) {
$last_measure = $dashboard['time_utc'];
} else {
$last_measure = time();
$this->SendDebug(__FUNCTION__, 'missing "time_utc", use current timestamp', 0);
}
} else {
$last_measure = 0;
}
Expand Down Expand Up @@ -1374,7 +1390,12 @@ private function eval_NAMain($netatmo, $device)
$temp_trend = $this->GetArrayElem($dashboard, 'temp_trend', '');
$pressure_trend = $this->GetArrayElem($dashboard, 'pressure_trend', '');

$last_measure = $dashboard['time_utc'];
if (isset($dashboard['time_utc'])) {
$last_measure = $dashboard['time_utc'];
} else {
$last_measure = time();
$this->SendDebug(__FUNCTION__, 'missing "time_utc", use current timestamp', 0);
}

$msg = "base-module \"$module_name\": Temperature=$Temperature, CO2=$CO2, Humidity=$Humidity, Noise=$Noise, Pressure=$Pressure, AbsolutePressure=$AbsolutePressure";
$this->SendDebug(__FUNCTION__, $msg, 0);
Expand Down Expand Up @@ -1488,13 +1509,12 @@ private function eval_NAModule($netatmo, $device)
break;
}

if (isset($dashboard['time_utc']) == false) {
$msg = "instance $this->InstanceID: defect dasboard=" . print_r($dashboard, true);
$this->LogMessage($msg, KL_NOTIFY);
$this->SendDebug(__FUNCTION__, $msg, 0);
if (isset($dashboard['time_utc'])) {
$last_measure = $dashboard['time_utc'];
} else {
$last_measure = time();
$this->SendDebug(__FUNCTION__, 'missing "time_utc", use current timestamp', 0);
}

$last_measure = $dashboard['time_utc'];
if ($with_last_measure) {
$this->SetValue('LastMeasure', $last_measure);
}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ GUIDs
- 1.40 @ 15.10.2023 13:51
- Neu: Ermittlung von Speicherbedarf und Laufzeit (aktuell und für 31 Tage) und Anzeige im Panel "Information"
- Fix: die Statistik der ApiCalls wird nicht mehr nach uri sondern nur noch host+cmd differenziert
- Fix: Fehler abgefangen, das unter unklaren Umständen "time_utc" manchmal nicht übermittelt wird
- update submodule CommonStubs

- 1.39 @ 15.08.2023 10:03
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
},
"version": "1.40",
"build": 0,
"date": 1697370675
"date": 1699005477
}
2 changes: 1 addition & 1 deletion libs/CommonStubs
Submodule CommonStubs updated 2 files
+1 −0 README.md
+19 −0 common.php

0 comments on commit b7e097d

Please sign in to comment.