Netatmo als Schnittstelle

Niedrig
Erledigt
Erweiterung Software
Server
4.099
Xsolution

Netatmo W-Lan Wetterstationen können nun per PHP als Virtuelle Datenpunkte sowie als auch als Schnittstelle hinzu gefügt werden.

 

Über Virtuelle Datenpunkte:

 

Als Schnittstelle (Gateway Lizenz erfoderlich):

 

Netatmo1

 

 

Netatmo2Netatmo2

 

Hierfür ist ein PHP Skript erforderlich. Das PHP Skript ist in diesem Beispiel unter „C:/xampp/htdocs/Netatmo/Netatmo.php“ gespeichert.

Als Status Adressen sind alle Variablen aus dem PHP Skript erlaubt z.B.

Innen Temperatur

$json_Array[‚Temperature‘] = Status Adresse:  Temperature

Außen Temperatur

$json_Array[‚M_Temperature‘] = Status Adresse: M_Temperature

 

 

<?php

require_once( 'inc' . DIRECTORY_SEPARATOR . 'global.inc.php' );

if ( is_array( $result ) ) {

	if ( count( $result ) > 0 ) {

		   foreach ( $result as $data ) {

		   	$json_Array = array();

		   	$json_Array['Temperature'] = $data['results']['Temperature'];

		   	 $json_Array['Co2'] = $data['results']['Co2'];
		   	 $json_Array['Humidity'] = $data['results']['Humidity'];
		   	 $json_Array['Noise'] = $data['results']['Noise'];
		   	 $json_Array['Pressure'] = $data['results']['Pressure'];

		//   	 $json_Array['name'] = $data['name'];
		//   	 $json_Array['station'] = $data['station'];

		   	 $json_Array['min_temp'] = $data['misc']['min_temp'];
		//   	 $json_Array['date_min_temp'] = getDate_($data['misc']['date_min_temp']);
		   	 $json_Array['max_temp'] = $data['misc']['max_temp'];
		//   	 $json_Array['date_max_temp'] =  getDate_($data['misc']['date_max_temp']);
		   	 $json_Array['min_hum'] =  $data['misc']['min_hum'];
		//   	 $json_Array['date_min_hum'] = getDate_($data['misc']['date_min_hum']);
		   	 $json_Array['max_hum'] = $data['misc']['max_hum'];
		//   	 $json_Array['date_max_hum'] = getDate_($data['misc']['date_max_hum']);
		   	 $json_Array['min_pressure'] = $data['misc']['min_pressure'];
		//   	 $json_Array['date_min_pressure'] = getDate_($data['misc']['date_min_pressure']);
		   	 $json_Array['max_pressure'] = $data['misc']['max_pressure'];
		//   	 $json_Array['date_max_pressure'] = getDate_($data['misc']['date_max_pressure']);

		   	 $json_Array['min_noise'] = $data['misc']['min_noise'];
  	        //	 $json_Array['date_min_noise'] = getDate_($data['misc']['date_min_noise']);
		   	 $json_Array['max_noise'] = $data['misc']['max_noise'];
		//   	 $json_Array['date_max_noise'] = getDate_($data['misc']['date_max_noise']);

		   	break;
		   }

		   foreach ( $data['m'] as $moduleid=>$datam ) {

		         $json_Array['M_Temperature'] =$datam['results']['Temperature'];
		         $json_Array['M_Humidity'] =$datam['results']['Humidity'];

		//   	$json_Array['M_name'] =	$datam['name'];
		//   	$json_Array['M_time'] =	$datam['time'];
		   	$json_Array['M_min_temp'] =	$datam['misc']['min_temp'];
		//   	$json_Array['M_date_min_temp'] = getDate_($datam['misc']['date_min_temp']);
		   	$json_Array['M_max_temp'] =	$datam['misc']['max_temp'];
		//   	$json_Array['M_date_max_temp'] = getDate_($datam['misc']['date_max_temp']);
		   	$json_Array['M_min_hum'] =	$datam['misc']['min_hum'];
		//   	$json_Array['M_date_min_hum'] =getDate_(	$datam['misc']['date_min_hum']);
		   	$json_Array['M_max_hum'] =	$datam['misc']['max_hum'];
		//   	$json_Array['M_date_max_hum'] =	getDate_($datam['misc']['date_max_hum']);

		   	break;
		   }

		   echo	json_encode($json_Array);

}

}

function getDate_($date_)
{
	    $when  = "".

		strftime( '%H' ,$date_ ).":".
		strftime( '%M' ,$date_ ).":".
		strftime( '%S' ,$date_ )." ".

		strftime( '%d' ,$date_ ).".".
		strftime('%m' ,$date_ ).".".
		strftime( '%Y' ,$date_ );

		return $when;
}

?>

 

WordPress-Datenbank-Fehler: [Unknown column '4311comments.comment_ID' in 'field list']
SELECT SQL_CALC_FOUND_ROWS 4311comments.comment_ID FROM 4311comments AS wp1 LEFT JOIN 4311posts AS wp3 ON wp1.comment_post_id = wp3.ID WHERE ( wp1.comment_approved = '1' ) AND wp1.comment_post_ID = 6934 AND wp3.post_status = 'publish' AND NOT EXISTS (SELECT * FROM 4311commentmeta AS wp2 WHERE wp1.comment_ID = wp2.comment_id AND wp2.meta_key = 'wats_internal_update' AND wp2.meta_value = 1) ORDER BY 4311comments.comment_date_gmt ASC, 4311comments.comment_ID ASC

Leave a Reply