Mycodo API (1.0)

Download OpenAPI specification:Download

A REST API for Mycodo

cameras

Camera operations

get last camera image

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the camera

Responses

get last camera image

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the camera

img_type
required
string

The type of image to return, either "still" or "timelapse"

Responses

choices

Form choice operations

Show form choices for all controllers

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "choices controllers": [
    ]
}

Show form choices for all input measurements

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "choices inputs measurements": [
    ]
}

Show form choices for all output devices

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "choices outputs devices": [
    ]
}

Show form choices for all output measurements

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "choices outputs measurements": [
    ]
}

Show form choices for all PID measurements

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "choices pids measurements": [
    ]
}

controllers

Controller operations

Get the status of a controller

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the controller.

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "is_active": true
}

Activate or deactivate a controller

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the controller.

Request Body schema: application/json
activate
required
boolean

Activate (1) or deactivate (0) a controller.

Responses

Request samples

Content type
application/json
{
  • "activate": true
}

daemon

Daemon operations

Get the status of the daemon

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "RAM": 0,
  • "is_running": true,
  • "python_virtual_env": true
}

Shut down the daemon

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "terminated": true
}

export_import

Export/Import operations

Return an archive of an influxdb measurement database export

Authorizations:
apikey

Responses

Return an archive of the Mycodo confgiuration export

Authorizations:
apikey

Responses

functions

Function operations

Show all function settings

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "function channels": [
    ],
  • "function settings": [
    ]
}

Show the settings for an function

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the function

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "device measurements": [
    ],
  • "function channels": [
    ],
  • "function settings": {
    }
}

inputs

Input operations

Show all input settings

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "input channels": [
    ],
  • "input settings": [
    ]
}

Show the settings for an input

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the input

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "device measurements": [
    ],
  • "input channels": [
    ],
  • "input settings": {
    }
}

Force an input to acquire measurements

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the input.

Responses

measurements

Measurement operations

Create a measurement

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the device

unit
required
string

The unit of the measurement

channel
required
integer

The channel of the measurement

value
required
string

the value of the measurement

Request Body schema: application/json
timestamp
string <date-time>

The timestamp of the measurement, in %Y-%m-%dT%H:%M:%S.%fZ format (e.g. 2019-04-15T18:07:00.392Z). (Optional; exclude to create a measurement with a timestamp of the current time)

Responses

Request samples

Content type
application/json
{
  • "timestamp": "2019-08-24T14:15:22Z"
}

Return a list of measurements found within a time range

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the device

unit
required
string

The unit of the measurement

channel
required
integer

The channel of the measurement

epoch_start
required
integer

The start time, as epoch. Set to 0 for none.

epoch_end
required
integer

The end time, as epoch. Set to 0 for none.

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "measurements": [
    ]
}

Return the last measurement found within a duration from the past to the present

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the device

unit
required
string

The unit of the measurement

channel
required
integer

The channel of the measurement

past_seconds
required
integer

How many seconds in the past to query.

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "time": 0,
  • "value": 0
}

Return a list of measurements found within a duration from the past to the present

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the device

unit
required
string

The unit of the measurement

channel
required
integer

The channel of the measurement

past_seconds
required
integer

How many seconds in the past to query.

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "measurements": [
    ]
}

notes

Note operations

Create a note

Authorizations:
apikey
Request Body schema: application/json
name
required
string

The note name.

note
required
string

The note text.

tags
required
string

List of tag names, separated by commas

Responses

Request samples

Content type
application/json
{
  • "name": "Note Name",
  • "note": "My Note.",
  • "tags": "tag1,tag2,tag3"
}

outputs

Output operations

Show all output settings and statuses

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "output channels": [
    ],
  • "output devices": [
    ],
  • "output states": {
    }
}

Show the settings and status for an output

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the output.

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "output device": {
    },
  • "output device channel states": {
    },
  • "output device channels": [
    ]
}

Change the state of an output

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the output.

Request Body schema: application/json
channel
required
number >= 0

The output channel to modulate.

duration
number > 0

The duration to keep a non-PWM output on, in seconds.

duty_cycle
number >= 0

The duty cycle to set a PWM output, in percent (%).

state
boolean

Set a non-PWM output state to on (True) or off (False).

volume
number >= 0

The volume to send to an output.

Responses

Request samples

Content type
application/json
{
  • "channel": 0,
  • "duration": 10,
  • "duty_cycle": 50,
  • "state": true,
  • "volume": 35
}

pids

PID operations

Show all pid settings

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "pid settings": [
    ]
}

Show the settings for a pid

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the pid

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "device measurements": [
    ],
  • "pid settings": {
    }
}

settings

Settings operations

Show all device measurement settings

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "device measurement settings": [
    ]
}

Show the settings for all device measurements with the device_id

Authorizations:
apikey
path Parameters
device_id
required
string

The unique ID of the controller (Input, etc.) for which the measurement belongs.

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "device measurement settings": [
    ]
}

Show the settings for a device measurement with the unique_id

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the measurement

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "channel": 0,
  • "conversion": {
    },
  • "device_id": "string",
  • "device_type": "string",
  • "id": 0,
  • "invert_scale": true,
  • "is_enabled": true,
  • "measurement": "string",
  • "measurement_type": "string",
  • "name": "string",
  • "rescale_equation": "string",
  • "rescale_method": "string",
  • "rescaled_measurement": "string",
  • "rescaled_unit": "string",
  • "scale_from_max": 0,
  • "scale_from_min": 0,
  • "scale_to_max": 0,
  • "scale_to_min": 0,
  • "unique_id": "string",
  • "unit": "string"
}

Show all input settings

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "input settings": [
    ]
}

Show the settings for an input

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the input

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "adc_gain": 0,
  • "adc_resolution": 0,
  • "adc_sample_speed": "string",
  • "baud_rate": 0,
  • "bt_adapter": "string",
  • "calibrate_sensor_measure": "string",
  • "cmd_command": "string",
  • "custom_options": "string",
  • "datetime": "2019-08-24T14:15:22Z",
  • "deadline": 0,
  • "device": "string",
  • "ftdi_location": "string",
  • "gpio_location": 0,
  • "i2c_bus": 0,
  • "i2c_location": "string",
  • "id": 0,
  • "interface": "string",
  • "is_activated": true,
  • "is_preset": true,
  • "location": "string",
  • "log_level_debug": true,
  • "name": "string",
  • "period": 0,
  • "pin_clock": 0,
  • "pin_cs": 0,
  • "pin_miso": 0,
  • "pin_mosi": 0,
  • "port": 0,
  • "position_y": 0,
  • "power_output_id": "string",
  • "pre_output_duration": 0,
  • "pre_output_during_measure": true,
  • "pre_output_id": "string",
  • "preset_name": "string",
  • "ref_ohm": 0,
  • "resolution": 0,
  • "resolution_2": 0,
  • "rpm_pulses_per_rev": 0,
  • "sample_time": 0,
  • "sensitivity": 0,
  • "sht_voltage": "string",
  • "start_offset": 0,
  • "switch_bouncetime": 0,
  • "switch_edge": "string",
  • "switch_reset_period": 0,
  • "thermocouple_type": "string",
  • "times_check": 0,
  • "uart_location": "string",
  • "unique_id": "string",
  • "weighting": 0
}

Show all measurement settings

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "measurement settings": [
    ]
}

Show the settings for a measurement with the unique_id

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the measurement

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "id": 0,
  • "name": "string",
  • "name_safe": "string",
  • "unique_id": "string",
  • "units": "string"
}

Show all output settings

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "output settings": [
    ]
}

Show the settings for an output with the unique_id

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the output

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "baud_rate": 0,
  • "custom_options": "string",
  • "ftdi_location": "string",
  • "i2c_bus": 0,
  • "i2c_location": "string",
  • "id": 0,
  • "interface": "string",
  • "location": "string",
  • "log_level_debug": true,
  • "name": "string",
  • "output_type": "string",
  • "uart_location": "string",
  • "unique_id": "string"
}

Show all pid settings

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "pid settings": [
    ]
}

Show the settings for a pid with the unique_id

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the pid

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "autotune_activated": true,
  • "autotune_noiseband": 0,
  • "autotune_outstep": 0,
  • "band": 0,
  • "d": 0,
  • "direction": "string",
  • "i": 0,
  • "id": 0,
  • "integrator_max": 0,
  • "integrator_min": 0,
  • "is_activated": true,
  • "is_held": true,
  • "is_paused": true,
  • "is_preset": true,
  • "log_level_debug": true,
  • "lower_max_duration": 0,
  • "lower_min_duration": 0,
  • "lower_min_off_duration": 0,
  • "lower_output_id": "string",
  • "max_measure_age": 0,
  • "measurement": "string",
  • "method_end_time": "string",
  • "method_start_time": "string",
  • "name": "string",
  • "p": 0,
  • "period": 0,
  • "preset_name": "string",
  • "raise_max_duration": 0,
  • "raise_min_duration": 0,
  • "raise_min_off_duration": 0,
  • "raise_output_id": "string",
  • "setpoint": 0,
  • "setpoint_tracking_id": "string",
  • "setpoint_tracking_max_age": 0,
  • "setpoint_tracking_type": "string",
  • "start_offset": 0,
  • "store_lower_as_negative": true,
  • "unique_id": "string"
}

Show all trigger settings

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "trigger settings": [
    ]
}

Show the settings for a trigger with the unique_id

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the trigger

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "date_offset_days": 0,
  • "edge_detected": "string",
  • "id": 0,
  • "is_activated": true,
  • "latitude": 0,
  • "log_level_debug": true,
  • "longitude": 0,
  • "measurement": "string",
  • "method_end_time": "string",
  • "method_start_time": "string",
  • "name": "string",
  • "output_duration": 0,
  • "output_duty_cycle": 0,
  • "output_state": "string",
  • "period": 0,
  • "program": "string",
  • "rise_or_set": "string",
  • "time_offset_minutes": 0,
  • "timer_end_time": "string",
  • "timer_start_offset": 0,
  • "timer_start_time": "string",
  • "trigger_actions_at_period": true,
  • "trigger_actions_at_start": true,
  • "trigger_type": "string",
  • "unique_id": "string",
  • "unique_id_1": "string",
  • "unique_id_2": "string",
  • "word": "string",
  • "zenith": 0
}

Show all unit settings

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "unit settings": [
    ]
}

Show the settings for a unit with the unique_id

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the unit

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "id": 0,
  • "name": "string",
  • "name_safe": "string",
  • "unique_id": "string",
  • "unit": "string"
}

Show all user settings

Authorizations:
apikey
header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "user settings": [
    ]
}

Show the settings for a user with the unique_id

Authorizations:
apikey
path Parameters
unique_id
required
string

The unique ID of the user

header Parameters
X-Fields
string <mask>

An optional fields mask

Responses

Response samples

Content type
application/vnd.mycodo.v1+json
{
  • "email": "string",
  • "id": 0,
  • "index_page": "string",
  • "landing_page": "string",
  • "language": "string",
  • "name": "string",
  • "role_id": 0,
  • "theme": "string",
  • "unique_id": "string"
}