{"openapi":"3.1.0","info":{"title":"Hydro Control System","description":"API for water environment monitoring and control system","version":"1.0.0"},"paths":{"/api/sensors/":{"get":{"tags":["sensors","sensors"],"summary":"Get Sensors","description":"Get all sensors","operationId":"get_sensors_api_sensors__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Sensor"},"type":"array","title":"Response Get Sensors Api Sensors Get"}}}},"404":{"description":"Not found"}}},"post":{"tags":["sensors","sensors"],"summary":"Create Sensor","description":"Create a new sensor with simplified input","operationId":"create_sensor_api_sensors__post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SensorCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sensor"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/sensors/available-drivers":{"get":{"tags":["sensors","sensors"],"summary":"Get Available Drivers","description":"Get all available sensor drivers","operationId":"get_available_drivers_api_sensors_available_drivers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"string"},"type":"array","title":"Response Get Available Drivers Api Sensors Available Drivers Get"}}}},"404":{"description":"Not found"}}}},"/api/sensors/{sensor_id}":{"get":{"tags":["sensors","sensors"],"summary":"Get Sensor","description":"Get a specific sensor by ID","operationId":"get_sensor_api_sensors__sensor_id__get","parameters":[{"name":"sensor_id","in":"path","required":true,"schema":{"type":"integer","title":"Sensor Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sensor"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["sensors","sensors"],"summary":"Update Sensor","description":"Update a sensor","operationId":"update_sensor_api_sensors__sensor_id__put","parameters":[{"name":"sensor_id","in":"path","required":true,"schema":{"type":"integer","title":"Sensor Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SensorCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sensor"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["sensors","sensors"],"summary":"Delete Sensor","description":"Delete a sensor","operationId":"delete_sensor_api_sensors__sensor_id__delete","parameters":[{"name":"sensor_id","in":"path","required":true,"schema":{"type":"integer","title":"Sensor Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Sensor Api Sensors Sensor Id Delete"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/sensors/{sensor_id}/measurements":{"get":{"tags":["sensors","sensors"],"summary":"Get Sensor Measurements","description":"Get measurements for a specific sensor","operationId":"get_sensor_measurements_api_sensors__sensor_id__measurements_get","parameters":[{"name":"sensor_id","in":"path","required":true,"schema":{"type":"integer","title":"Sensor Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"start_time","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Start Time"}},{"name":"end_time","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"End Time"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Measurement"},"title":"Response Get Sensor Measurements Api Sensors Sensor Id Measurements Get"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/controllers/":{"get":{"tags":["controllers","controllers"],"summary":"Get Controllers","description":"Get all controllers","operationId":"get_controllers_api_controllers__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Controller"},"type":"array","title":"Response Get Controllers Api Controllers Get"}}}},"404":{"description":"Not found"}}},"post":{"tags":["controllers","controllers"],"summary":"Create Controller","description":"Create a new controller","operationId":"create_controller_api_controllers__post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ControllerCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Controller"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/controllers/types":{"get":{"tags":["controllers","controllers"],"summary":"Get Controller Types","description":"Get all available controller types","operationId":"get_controller_types_api_controllers_types_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"string"},"type":"array","title":"Response Get Controller Types Api Controllers Types Get"}}}},"404":{"description":"Not found"}}}},"/api/controllers/schema/{controller_type}":{"get":{"tags":["controllers","controllers"],"summary":"Get Controller Config Schema","description":"Get the configuration schema for a specific controller type","operationId":"get_controller_config_schema_api_controllers_schema__controller_type__get","parameters":[{"name":"controller_type","in":"path","required":true,"schema":{"type":"string","title":"Controller Type"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/controllers/available-controllers":{"get":{"tags":["controllers","controllers"],"summary":"Get Available Controllers","description":"Get all available controller implementations","operationId":"get_available_controllers_api_controllers_available_controllers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"string"},"type":"array","title":"Response Get Available Controllers Api Controllers Available Controllers Get"}}}},"404":{"description":"Not found"}}}},"/api/controllers/{controller_id}":{"get":{"tags":["controllers","controllers"],"summary":"Get Controller","description":"Get a specific controller by ID","operationId":"get_controller_api_controllers__controller_id__get","parameters":[{"name":"controller_id","in":"path","required":true,"schema":{"type":"integer","title":"Controller Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Controller"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["controllers","controllers"],"summary":"Update Controller","description":"Update a controller","operationId":"update_controller_api_controllers__controller_id__put","parameters":[{"name":"controller_id","in":"path","required":true,"schema":{"type":"integer","title":"Controller Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ControllerCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Controller"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["controllers","controllers"],"summary":"Delete Controller","description":"Delete a controller","operationId":"delete_controller_api_controllers__controller_id__delete","parameters":[{"name":"controller_id","in":"path","required":true,"schema":{"type":"integer","title":"Controller Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Controller Api Controllers Controller Id Delete"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/controllers/{controller_id}/sensors":{"get":{"tags":["controllers","controllers"],"summary":"Get Controller Sensors","description":"Get all sensors associated with a controller","operationId":"get_controller_sensors_api_controllers__controller_id__sensors_get","parameters":[{"name":"controller_id","in":"path","required":true,"schema":{"type":"integer","title":"Controller Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Sensor"},"title":"Response Get Controller Sensors Api Controllers Controller Id Sensors Get"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/controllers/{controller_id}/sensors/{sensor_id}":{"post":{"tags":["controllers","controllers"],"summary":"Add Sensor To Controller","description":"Associate a sensor with a controller","operationId":"add_sensor_to_controller_api_controllers__controller_id__sensors__sensor_id__post","parameters":[{"name":"controller_id","in":"path","required":true,"schema":{"type":"integer","title":"Controller Id"}},{"name":"sensor_id","in":"path","required":true,"schema":{"type":"integer","title":"Sensor Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Add Sensor To Controller Api Controllers Controller Id Sensors Sensor Id Post"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["controllers","controllers"],"summary":"Remove Sensor From Controller","description":"Remove a sensor from a controller","operationId":"remove_sensor_from_controller_api_controllers__controller_id__sensors__sensor_id__delete","parameters":[{"name":"controller_id","in":"path","required":true,"schema":{"type":"integer","title":"Controller Id"}},{"name":"sensor_id","in":"path","required":true,"schema":{"type":"integer","title":"Sensor Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Remove Sensor From Controller Api Controllers Controller Id Sensors Sensor Id Delete"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/controllers/{controller_id}/process":{"post":{"tags":["controllers","controllers"],"summary":"Process Controller","description":"Manually trigger a controller to process its inputs","operationId":"process_controller_api_controllers__controller_id__process_post","parameters":[{"name":"controller_id","in":"path","required":true,"schema":{"type":"integer","title":"Controller Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Process Controller Api Controllers Controller Id Process Post"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/system/status":{"get":{"tags":["system","system"],"summary":"Get System Status","description":"Get the overall system status","operationId":"get_system_status_api_system_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get System Status Api System Status Get"}}}},"404":{"description":"Not found"}}}},"/api/system/scheduler/start":{"post":{"tags":["system","system"],"summary":"Start Scheduler","description":"Start the scheduler","operationId":"start_scheduler_api_system_scheduler_start_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Start Scheduler Api System Scheduler Start Post"}}}},"404":{"description":"Not found"}}}},"/api/system/scheduler/stop":{"post":{"tags":["system","system"],"summary":"Stop Scheduler","description":"Stop the scheduler","operationId":"stop_scheduler_api_system_scheduler_stop_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Stop Scheduler Api System Scheduler Stop Post"}}}},"404":{"description":"Not found"}}}},"/api/system/measurements/recent":{"get":{"tags":["system","system"],"summary":"Get Recent Measurements","description":"Get recent measurements from all sensors","operationId":"get_recent_measurements_api_system_measurements_recent_get","parameters":[{"name":"hours","in":"query","required":false,"schema":{"type":"integer","default":24,"title":"Hours"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response Get Recent Measurements Api System Measurements Recent Get"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/system/actions/recent":{"get":{"tags":["system","system"],"summary":"Get Recent Actions","description":"Get recent controller actions","operationId":"get_recent_actions_api_system_actions_recent_get","parameters":[{"name":"hours","in":"query","required":false,"schema":{"type":"integer","default":24,"title":"Hours"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response Get Recent Actions Api System Actions Recent Get"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/outputs/":{"get":{"tags":["outputs","outputs"],"summary":"Get Output Pins","operationId":"get_output_pins_api_outputs__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"integer"},"type":"object","title":"Response Get Output Pins Api Outputs Get"}}}},"404":{"description":"Not found"}}}},"/api/outputs/{pin_number}":{"get":{"tags":["outputs","outputs"],"summary":"Get Output Pin","description":"Get a specific output pin by ID","operationId":"get_output_pin_api_outputs__pin_number__get","parameters":[{"name":"pin_number","in":"path","required":true,"schema":{"type":"integer","title":"Pin Number"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"boolean","title":"Response Get Output Pin Api Outputs Pin Number Get"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/outputs/{pin_number}/set/{state}":{"post":{"tags":["outputs","outputs"],"summary":"Direct Set Pin","description":"Set a GPIO pin directly","operationId":"direct_set_pin_api_outputs__pin_number__set__state__post","parameters":[{"name":"pin_number","in":"path","required":true,"schema":{"type":"integer","title":"Pin Number"}},{"name":"state","in":"path","required":true,"schema":{"type":"boolean","title":"State"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Direct Set Pin Api Outputs Pin Number Set State Post"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Controller":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"enabled":{"type":"boolean","title":"Enabled","default":true},"controller_type":{"$ref":"#/components/schemas/ControllerType"},"config":{"type":"string","title":"Config","default":"{}"},"update_interval":{"type":"integer","title":"Update Interval","default":60},"last_run":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Run"}},"type":"object","required":["name","controller_type"],"title":"Controller"},"ControllerCreate":{"properties":{"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"controller_type":{"$ref":"#/components/schemas/ControllerType"},"config":{"additionalProperties":true,"type":"object","title":"Config","default":{}},"update_interval":{"type":"integer","title":"Update Interval","default":60},"enabled":{"type":"boolean","title":"Enabled","default":true}},"type":"object","required":["name","controller_type"],"title":"ControllerCreate"},"ControllerType":{"type":"string","enum":["ph_controller","ec_controller","pump_timer","temp_pump_timer"],"title":"ControllerType"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"Measurement":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"measurement_type":{"$ref":"#/components/schemas/MeasurementType"},"value":{"type":"number","title":"Value"},"unit":{"type":"string","title":"Unit"},"raw_value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Raw Value"},"sensor_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sensor Id"}},"type":"object","required":["measurement_type","value","unit"],"title":"Measurement"},"MeasurementType":{"type":"string","enum":["temperature","humidity","ph","orp","ec","pressure","water_level"],"title":"MeasurementType"},"Sensor":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"enabled":{"type":"boolean","title":"Enabled","default":true},"driver":{"type":"string","title":"Driver"},"config":{"type":"string","title":"Config","default":"{}"},"update_interval":{"type":"integer","title":"Update Interval","default":60},"last_measurement":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Measurement"},"calibration_data":{"type":"string","title":"Calibration Data","default":"{}"}},"type":"object","required":["name","driver"],"title":"Sensor"},"SensorCreate":{"properties":{"name":{"type":"string","title":"Name"},"driver":{"type":"string","title":"Driver"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"update_interval":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Update Interval","default":60},"config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Config","default":{}},"calibration_data":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Calibration Data","default":{}},"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled","default":true}},"type":"object","required":["name","driver"],"title":"SensorCreate"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}