getNumSensors(); for ($i = 0; $i < $num; ++$i) { $id = $digitemp->getSensorId($i); $value = $digitemp->readSensor($i); $rrdtemp->addSensor($id); $now = time(); $rrdtemp->update($id, $now, $value); } foreach ($types = ['hour', 'day', 'week', 'month', 'year', '3year'] as $type) { $fpath = APPDIR.'/'.$config['images_dir'].'/graph-'.$type.'.png'; $rrdtemp->outputGraph($type, $fpath); }