{"components":{"responses":{"bad_request":{"content":{"application/json":{"example":{"errors":{"details":"Bad Request"}},"schema":{"type":"object"}}},"description":"Bad Request"},"forbidden":{"content":{"application/json":{"example":{"errors":{"details":"Forbidden"}},"schema":{"type":"object"}}},"description":"Forbidden"},"no_content":{"description":"No Content"},"unauthorised":{"content":{"application/json":{"example":{"errors":{"details":"Unauthorised"}},"schema":{"type":"object"}}},"description":"Unauthorised"},"unprocessable_entity":{"content":{"application/json":{"example":{"errors":{"details":"Unprocessable Entity"}},"schema":{"type":"object"}}},"description":"Unprocessable Entity"}},"schemas":{"AuthResponse":{"description":"Successful authentication response","example":{"token":"vW4sIvFvqkw6iogdhNyyFXa2nKg4LlsVobOTR721hbs","token_type":"bearer"},"properties":{"token":{"description":"Token","type":"string"},"token_type":{"description":"Token Type","type":"string"}},"required":["token","token_type"],"title":"AuthResponse","type":"object"},"Device":{"description":"A device","example":{"address":0,"channel":0,"description":"Description-1058","enabled":true,"id":"1ef18297-7ced-6d7c-a0df-224529ec9b67","name":"Sensor-1026","protocol":"modbus"},"properties":{"address":{"description":"Address","type":"integer"},"channel":{"description":"Channel","type":"integer"},"description":{"description":"Description","type":"string"},"enabled":{"description":"Enabled state","type":"boolean"},"id":{"description":"Device ID","type":"string"},"name":{"description":"Name","type":"string"},"protocol":{"description":"Device protocol","enum":["modbus","generic16"],"type":"string"}},"title":"Device","type":"object"},"Device Enable":{"description":"Enable/Disable a device","example":{"enable":"enable"},"properties":{"enable":{"description":"Device enablement","enum":["enable","disable"],"type":"string"}},"required":["enable"],"title":"Device Enable","type":"object"},"Devices":{"description":"List devices for an organisation","example":[{"address":0,"channel":0,"description":"Description-1058","enabled":true,"id":"1ef18297-7ced-6d7c-a0df-224529ec9b67","name":"Sensor-1026","protocol":"modbus"}],"items":{"description":"Device","type":"object"},"title":"Devices","type":"array"},"Generic 16 bit read request":{"description":"Query a device via a generic packet","example":{"address":500,"channel":1,"device":2,"length":2},"properties":{"address":{"description":"The register address to start the read operation","type":"integer"},"channel":{"description":"Channel for the request","type":"integer"},"device":{"description":"The device address","type":"integer"},"length":{"description":"The number of registers to read","type":"integer"}},"required":["channel","device","address","length"],"title":"Generic 16 bit read request","type":"object"},"Generic 16 bit read response":{"description":"Response from a device read via generic packet","example":{"data":[2,4,2,0]},"properties":{"data":{"description":"Response data packet","format":"int16","items":{"type":"integer"},"type":"array"}},"title":"Generic 16 bit read response","type":"object"},"Generic 16 bit write request":{"description":"Query a device via a generic packet","example":{"address":500,"channel":1,"data":[2,4,2,0]},"properties":{"address":{"description":"The address to start the write operation","type":"integer"},"channel":{"description":"Channel for the request","type":"integer"},"data":{"description":"Data packet","format":"int16","items":{"type":"integer"},"type":"array"},"device":{"description":"The device address","type":"integer"}},"required":["channel","device","address","data"],"title":"Generic 16 bit write request","type":"object"},"Generic 16 bit write response":{"description":"Response from a device write via a generic packet","example":{"length":2},"properties":{"length":{"description":"Number of bytes written","type":"integer"}},"title":"Generic 16 bit write response","type":"object"},"Modbus request":{"description":"Query a device via Modbus packet","example":{"channel":1,"data":[2,4,2,0,200,252,166]},"properties":{"channel":{"description":"Channel for the Modbus request","type":"integer"},"data":{"description":"Modbus data packet","format":"int8","items":{"type":"integer"},"type":"array"},"modbus_type":{"description":"Modbus request type RTU or TCP","enum":["rtu","tcp"],"type":"string"}},"required":["channel","data","modbus_type"],"title":"Modbus request","type":"object"},"Modbus response":{"description":"Response from a device query via Modbus packet","example":{"data":[2,4,2,0,200,252,166]},"properties":{"data":{"description":"Modbus data packet","format":"int8","items":{"type":"integer"},"type":"array"}},"title":"Modbus response","type":"object"},"Organisations":{"description":"List of organisations for a user","items":{"description":"Organisation","type":"object"},"title":"Organisations","type":"array"},"Register":{"description":"A register","example":{"data_type":"int16","description":"Description-2274","end_address":500,"id":"1ef19d43-4854-69a0-bf45-7f9fc0f87590","length":1,"name":"Register-2242","register_type":"holding","start_address":500,"value":2513},"properties":{"data_type":{"description":"Type of the data held by the register","type":"string"},"description":{"description":"Description","type":"string"},"end_address":{"description":"End address","type":"integer"},"id":{"description":"Register ID","type":"string"},"length":{"description":"Number of addresses use for this register","type":"integer"},"name":{"description":"Name","type":"string"},"register_type":{"description":"Type of the register. E.G. Generic or a Modbus register type","type":"string"},"start_address":{"description":"Start address","type":"integer"},"value":{"description":"Current value of the register","type":"any"}},"title":"Register","type":"object"},"RegisterValue":{"description":"Change register value body","example":{"value":123},"properties":{"value":{"description":"Register value","type":"any"}},"required":["value"],"title":"RegisterValue","type":"object"},"Registers":{"description":"List registers for a device","example":[{"data_type":"int16","description":"Description-2274","end_address":500,"id":"1ef19d43-4854-69a0-bf45-7f9fc0f87590","length":1,"name":"Register-2242","register_type":"holding","start_address":500,"value":2513}],"items":{"description":"Register","type":"object"},"title":"Registers","type":"array"},"UserCredentials":{"description":"Request body for user credentials","example":{"email":"admin@example.com","password":"password"},"properties":{"email":{"description":"Email address","format":"email","type":"string"},"password":{"description":"Password","format":"password","type":"string"}},"required":["password","email"],"title":"UserCredentials","type":"object"}},"securitySchemes":{"authorization":{"scheme":"bearer","type":"http"}}},"info":{"title":"Devices API","version":"1.0"},"openapi":"3.0.0","paths":{"/api/orgs/{org_slug}/device/{device_id}":{"get":{"callbacks":{},"description":"Show device","operationId":"PetalProApi.DevicesController.show","parameters":[{"description":"","in":"path","name":"org_slug","required":true,"schema":{"type":"string"}},{"description":"","in":"path","name":"device_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Device"}}},"description":"devices"},"401":{"$ref":"#/components/responses/unauthorised"},"403":{"$ref":"#/components/responses/forbidden"}},"security":[{"authorization":[]}],"summary":"Show device","tags":["devices"]}},"/api/orgs/{org_slug}/device/{device_id}/enable":{"put":{"callbacks":{},"description":"Device enablement","operationId":"PetalProApi.DevicesController.enable","parameters":[{"description":"","in":"path","name":"org_slug","required":true,"schema":{"type":"string"}},{"description":"","in":"path","name":"device_id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Device Enable"}}},"description":"Register value","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Device"}}},"description":"devices"},"401":{"$ref":"#/components/responses/unauthorised"},"403":{"$ref":"#/components/responses/forbidden"}},"security":[{"authorization":[]}],"summary":"Enable/Disable a device","tags":["devices"]}},"/api/orgs/{org_slug}/device/{device_id}/register/{reg_id}":{"get":{"callbacks":{},"description":"Show a register","operationId":"PetalProApi.DevicesController.show_register","parameters":[{"description":"","in":"path","name":"org_slug","required":true,"schema":{"type":"string"}},{"description":"","in":"path","name":"device_id","required":true,"schema":{"type":"string"}},{"description":"","in":"path","name":"register_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Register"}}},"description":"registers"},"401":{"$ref":"#/components/responses/unauthorised"},"403":{"$ref":"#/components/responses/forbidden"}},"security":[{"authorization":[]}],"summary":"Show a register","tags":["devices"]},"put":{"callbacks":{},"description":"Update a registers value","operationId":"PetalProApi.DevicesController.update_register_value","parameters":[{"description":"","in":"path","name":"org_slug","required":true,"schema":{"type":"string"}},{"description":"","in":"path","name":"device_id","required":true,"schema":{"type":"string"}},{"description":"","in":"path","name":"register_id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterValue"}}},"description":"Register value","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Register"}}},"description":"registers"},"401":{"$ref":"#/components/responses/unauthorised"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"$ref":"#/components/responses/unprocessable_entity"}},"security":[{"authorization":[]}],"summary":"Update a registers value","tags":["devices"]}},"/api/orgs/{org_slug}/device/{device_id}/registers":{"get":{"callbacks":{},"description":"List registers for a devices","operationId":"PetalProApi.DevicesController.list_registers","parameters":[{"description":"","in":"path","name":"org_slug","required":true,"schema":{"type":"string"}},{"description":"","in":"path","name":"device_id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Registers"}}},"description":"registers"},"401":{"$ref":"#/components/responses/unauthorised"},"403":{"$ref":"#/components/responses/forbidden"}},"security":[{"authorization":[]}],"summary":"List registers","tags":["devices"]}},"/api/orgs/{org_slug}/devices":{"get":{"callbacks":{},"description":"List devices for an organisation","operationId":"PetalProApi.DevicesController.list","parameters":[{"description":"","in":"path","name":"org_slug","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Devices"}}},"description":"devices"},"401":{"$ref":"#/components/responses/unauthorised"},"403":{"$ref":"#/components/responses/forbidden"}},"security":[{"authorization":[]}],"summary":"List devices","tags":["devices"]}},"/api/orgs/{org_slug}/generic16/read":{"post":{"callbacks":{},"description":"Process a generic data packet","operationId":"PetalProApi.Generic16Controller.read","parameters":[{"description":"","in":"path","name":"org_slug","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generic 16 bit read request"}}},"description":"Generic read request","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generic 16 bit read response"}}},"description":"response"},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/unauthorised"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"$ref":"#/components/responses/unprocessable_entity"}},"security":[{"authorization":[]}],"summary":"Process a generic read data packet","tags":["Generic16"]}},"/api/orgs/{org_slug}/generic16/write":{"post":{"callbacks":{},"description":"Process a generic data packet","operationId":"PetalProApi.Generic16Controller.write","parameters":[{"description":"","in":"path","name":"org_slug","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generic 16 bit write request"}}},"description":"Generic write request","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generic 16 bit write response"}}},"description":"response"},"400":{"$ref":"#/components/responses/bad_request"},"401":{"$ref":"#/components/responses/unauthorised"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"$ref":"#/components/responses/unprocessable_entity"}},"security":[{"authorization":[]}],"summary":"Process a generic write data packet","tags":["Generic16"]}},"/api/orgs/{org_slug}/modbus":{"post":{"callbacks":{},"description":"Process a Modbus data packet","operationId":"PetalProApi.ModbusController.process","parameters":[{"description":"","in":"path","name":"org_slug","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Modbus request"}}},"description":"Modbus request","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Modbus response"}}},"description":"response"},"401":{"$ref":"#/components/responses/unauthorised"},"403":{"$ref":"#/components/responses/forbidden"},"422":{"$ref":"#/components/responses/unprocessable_entity"}},"security":[{"authorization":[]}],"summary":"Process a Modbus data packet","tags":["Modbus"]}},"/api/sign-in":{"post":{"callbacks":{},"description":"Authenticate user and generate bearer token","operationId":"PetalProApi.SessionController.create","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserCredentials"}}},"description":"User credentials","required":false},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthResponse"}}},"description":"Authenticated response"},"401":{"$ref":"#/components/responses/unauthorised"}},"summary":"Authenticate user","tags":["session"]}},"/api/user/orgs":{"get":{"callbacks":{},"description":"List organisation for the current user","operationId":"PetalProApi.OrgController.list","parameters":[],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organisations"}}},"description":"Organisations"},"401":{"$ref":"#/components/responses/unauthorised"},"403":{"$ref":"#/components/responses/forbidden"}},"security":[{"authorization":[]}],"summary":"List organisations","tags":["user"]}}},"security":[],"servers":[{"url":"https://iotsimhub.net","variables":{}}],"tags":[]}