['config_missing'], 'message' => 'config.php ontbreekt: kopieer config.example.php naar config.php']); exit; } try { $config = Config::load($configFile); $storage = rtrim((string) $config->get('storage_path'), '/'); $timezone = (string) $config->get('timezone'); $lat = $config->get('forecast_lat'); $lon = $config->get('forecast_lon'); $source = $config->get('data_source') === 'live' ? LiveSource::fromConfig($config) : new FixtureSource(null, $timezone); $service = new DashboardService( $source, new Cache($storage . '/cache'), $config->get('cache_ttl'), $timezone, is_numeric($lat) ? (float) $lat : null, is_numeric($lon) ? (float) $lon : null, is_array($config->get('indoor_modules')) ? $config->get('indoor_modules') : [], is_string($config->get('netatmo_device_id')) && $config->get('netatmo_device_id') !== '' ? $config->get('netatmo_device_id') : null, ); echo json_encode($service->build(), JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); } catch (Throwable $e) { error_log('weerscherm: ' . $e->getMessage()); http_response_code(500); echo json_encode(['errors' => ['server_error']]); }