sequence diagram source - ValleyCommunityWorkspace/weather-station-server GitHub Wiki

title Weather Station Setup

Sensor->Sensor: Idle

opt Both buttons pressed
  note over Sensor: Start Captive Config

  Phone->Sensor: Connect to Captive Config
  Sensor->Phone: Configure me!
  note over Phone: Pick AP, email, etc.
  Phone->Sensor: Settings
  
  note over Phone, Sensor: Stop Captive Config

  alt WiFi Picked
    note over Sensor: Connect to AP
    Sensor->Server: 123ABC belongs to [email protected]
    note over Server: Register 123ABC to [email protected]
    Server->Phone: Email to [email protected]
    Server->Sensor: Sweet
    note over Sensor: Store AP Info, disconnect
    
  else Stand Alone
    note over Sensor: Store email address for later
  end
  
end
title Weather Station Upload - time sync

note over Sensor: Note RTC time
Sensor->Server: Send weather data
note over Server: Note time POST was received
note over Server: Process data
Server->Sensor: Ack weather data, include receive and current time
note over Sensor: Adjust RTC