File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ The received data can also be saved as JSON (sofar_realtime.json).
2626
2727
2828## Changelog
29+
30+ ### ** WORK IN PROGRESS**
31+
32+ - Added query to check whether valid station ID is available
33+
2934### 3.2.4 (2025-10-07)
3035
3136- package.json edited
Original file line number Diff line number Diff line change @@ -398,6 +398,13 @@ class SofarCloud extends utils.Adapter {
398398 const allRealtime = [ ] ;
399399 for ( const station of stations ) {
400400 const station_id = name2id ( station . id ) ;
401+
402+ // Prüfen, ob station_id zu kurz ist
403+ if ( ! station_id || station_id . length < 18 ) {
404+ this . log . info ( `Station with invalid ID (${ station_id } ) skipped.` ) ;
405+ continue ;
406+ }
407+
401408 const url_detail = `${ URL } device/stationInfo/selectStationDetail?stationId=${ station_id } ` ;
402409 const resp_detail = await axios . post ( url_detail , { } , { headers } ) ;
403410 if (
@@ -408,6 +415,13 @@ class SofarCloud extends utils.Adapter {
408415 allRealtime . push ( resp_detail . data . data . stationRealTimeVo ) ;
409416 }
410417 }
418+
419+ // Wenn keine gültigen Stationen gefunden wurden
420+ if ( allRealtime . length === 0 ) {
421+ this . log . warn ( "No valid station found." ) ;
422+ return null ;
423+ }
424+
411425 return allRealtime ;
412426 } catch ( e ) {
413427 this . log . error ( `Error retrieving stations: ${ e . message } ` ) ;
You can’t perform that action at this time.
0 commit comments