Downtime

class pytm4srv.models.Downtime
alarm_id: Mapped[int | None]

ID of the alarm that directly caused this downtime, if any.

auto_end: Mapped[str | None]

When to automatically end this downtime.

  • null: never (default)

  • "ACTIVE": End when the machine changes to an active state.

  • "PART": End when the machine produces a part. The cycle time will be subtracted.

For auto-end to set the end timestamp of a downtime block, the block’s end value must be set to null. This means downtime blocks with both end and auto_end non-null will never automatically end.

classmethod auto_end_active(machine_id: int)

End downtime blocks on the given machine that are waiting for the machine to become active.

The end timestamp of each block will be set to the current time.

classmethod auto_end_part(machine_id: int, cycle_length: timedelta)

End downtime blocks on the given machine that are waiting for a part to be finished.

The end timestamp of each block will be set to the current time minus the cycle length.

Parameters:
  • machine_id – the ID of the machine to end downtime on

  • cycle_length – the length of the part’s cycle

category_id: Mapped[int | None]

The ID of the category/reason for this downtime. References a user-defined DowntimeCategory object.

end: Mapped[datetime | None]

The date and time this downtime stopped.

null means the downtime is still ongoing.

id: MappedColumn object at 0x7b55cc329c60>]]

Unique, numeric ID of this downtime block.

issue_id: Mapped[int | None]

The ID of the issue that caused this downtime, if any.

Usually for unplanned downtime.

machine_id: Mapped[int]

The ID of the machine that was down.

maintenance_item_id: Mapped[int | None]

The ID of the maintenance item that was being performed during this downtime, if any.

Usually for planned downtime.

notes: Mapped[str]

User-specified notes about this downtime.

planned: Mapped[bool]

Whether this downtime was planned (true) or unplanned (false).

reporter_id: Mapped[int | None]

The ID of the user who reported this downtime.

Will be null if the downtime was created automatically.

start: Mapped[datetime]

The date and time this downtime started.

value: Mapped[float | None]

The currency value of production lost during this downtime.

This field may be NULL for downtime that has not yet ended. When downtime ends automatically, this field will only be modified if it is NULL.