#!/usr/bin/env php station_name, 30, ' ') . "| " . str_pad( $item->ts_value, 5, ' ', STR_PAD_RIGHT ) . " | " . str_pad( $item->station_no, 5, ' ', STR_PAD_RIGHT) . " | " . $item->river_name . "\n" ; continue; } if( ! in_array( $item->station_name, $station_names ) ) { continue; } // Generate data $station_topic = $topic.'/'.$item->station_name; // Delete unneeded properties from response unset( $item->gn_atr_stanr_hzb, $item->req_timestamp, $item->station_carteasting, $item->station_cartnorthing, $item->station_id, $item->ts_id, $item->ts_name, $item->ts_shortname, $item->tsinfo_precision, $item->web_gebiet, $item->web_information, $item->web_vorhersageurl, ); // Add human readable time $timestamp = strtotime( $item->timestamp ); $item->updatedHR = $xl->date( $timestamp ) . " " . $xl->time( $timestamp ); $item->updatedEpoch = $timestamp; $json_data = json_encode($item, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_LINE_TERMINATORS | JSON_PRETTY_PRINT ); $mqtt->retain( $station_topic, $json_data ); echo $json_data; } // END