Maintenance
Items
Definition of a type of regular maintenance created by administrators or planners.
- class pytm4srv.models.MaintenanceMeasurementItem
A recurring numeric measurement that can be charted over time.
- completion_duration: Mapped[timedelta]
How long it is expected to take to complete this item, in minutes.
- cycle_timer: Mapped[timedelta]
The total accumulated cycle time (in minutes) for use when the schedule mode is
1.
- difficulty: Mapped[int]
How difficult this maintenance item is to complete. Useful for delegating to operators of varying training levels.
Value
Difficulty
1Easy
2Medium (default)
3Hard
4Expert (management supervision required)
- equipment_id: Mapped[int | None]
The ID of the equipment this maintenance item is for.
Set to
NULLfor items that apply to a machine or the shop as a whole instead of a particular piece of equipment.Only one of
machine_idorequipment_idmay be set for a given issue.
- frequency: Mapped[str]
How often to repeat this schedule.
Valid options are:
Y(yearly)M(monthly)W(weekly)D(daily)H(hourly)
- id: Mapped[int]
Unique ID across all maintenance items.
- indices: Mapped[List[int]]
When to run within each occurrence of
frequency.For example: frequency=M and indices=[1, 14] will run the 1st and 14th of every month, but frequency=M and indices=[-2] will run on the second to last day of every month.
Ignored if
frequencyis set toH.
- initial_entry: Mapped[datetime | None]
For newly-created maintenance items, this field can be used to set the previous entry date without creating an actual entry.
Once an entry exists for this item, the value of field will be ignored.
- instructions: Mapped[str]
Instructions to users for completing this maintenance item.
- interval: Mapped[int]
One out of how many
frequencyoccurrences to run.For example: frequency=D and interval=1 will run every day, but frequency=W and interval=3 will run every 3 weeks.
- is_critical: Mapped[bool]
Whether the machine should be kept from running until this maintenance item is completed.
- item_type: Mapped[str]
The type of this item. This corresponds to a model type and determines which fields are available.
See the item API endpoint documentation for the possible values.
- machine_id: Mapped[int | None]
The ID of the machine this maintenance item belongs to.
Set to
NULLfor items that apply to the shop as a whole instead of a particular machine.Only one of
machine_idorequipment_idmay be set for a given issue.
- months: Mapped[int]
Months in which to run this schedule.
This is a bitfield (of length 16), so multiple months can be selected by combining their values with bitwise OR.
Value
Binary
Month
00000 0000 0000 0000(None)
10000 0000 0000 0001January
20000 0000 0000 0010February
40000 0000 0000 0100March
80000 0000 0000 1000April
160000 0000 0001 0000May
320000 0000 0010 0000June
640000 0000 0100 0000July
1280000 0000 1000 0000August
2560000 0001 0000 0000September
5120000 0010 0000 0000October
10240000 0100 0000 0000November
20480000 1000 0000 0000December
For example, to run only at the start of each quarter (January, April, July, and October), the value of this field would be 585 (1 + 8 + 64 + 512, or
0000 0010 0100 1001), or to run regardless of the current month, this field would be 4095 (0000 1111 1111 1111).Setting this value to zero will deselect all months and prevent this schedule from ever running.
- name: Mapped[str]
User-specified name for this rule.
- needed_when_archived: Mapped[bool]
Whether this maintenance item needs to be performed for archived machines. Defaults to false.
If this maintenance item is not associated with a machine, this field does nothing.
- needed_when_not_archived: Mapped[bool]
Whether this maintenance item needs to be performed for non-archived machines. Defaults to true.
If this maintenance item is not associated with a machine, this field does nothing.
- process_id: Mapped[int | None]
If non-null, this maintenance item will only come due when this process is active.
Generally this process will be on the machine associated with this maintenance item, but this is not a requirement so shop-wide and equipment-linked maintenance items can use this as well.
- remind_channel_id: Mapped[int | None]
The ID of the notification channel to which due reminders (and, optionally, warning messages) will be sent.
nulldisables sending notifications.
- schedule_mode: Mapped[int]
How this maintenance item should be scheduled. This field can take the following values:
Value
Mode
Description
0(default)Clock time
The item will be due every
timer_interval.1Run time
The
cycle_timerfor this item will be incremented by the active process’s cycle time each time a part is finished on the associated machine.If the item is not associated with a machine, it will use clock time mode.
The item will be due every
timer_intervalof process production time.2Calendar
The item will be scheduled using the
frequency,interval,indices,months,weekdays, andtime_of_dayfields.
- threshold_lower: Mapped[float | None]
A warning will be sent if an entry is below this value.
- threshold_notify_id: Mapped[int | None]
The ID of the notification channel to which threshold warnings will be sent.
NULLdisables sending notifications, but in-app alerts will still be created.
- threshold_upper: Mapped[float | None]
A warning will be sent if an entry is above this value.
- time_of_day: Mapped[time]
What time of day to schedule for.
- timer_interval: Mapped[timedelta]
If non-zero and the schedule mode is
0or1, the item will be due when this much time has passed since the last completion of this task.Measured in hours.
- trigger_alarm_id: Mapped[int | None]
The ID of the alarm that caused this maintenance item to become due at the alarm’s timestamp.
Once a new entry is created, OnTakt will reset this field to
null.
- trigger_alarms: Mapped[StringArray]
A list of NC alarm messages that will cause this maintenance item to become due immediately when present on the associated machine.
If this maintenance item is not associated with a machine (or is associated with equipment that is in turn not associated with a machine), this field does nothing.
This is processed independently of
custom_alarms, so these should be the strings as reported by the control.
- unit: Mapped[str]
The unit used for measurements.
- warning_interval: Mapped[timedelta]
If non-zero, a warning will be sent this far in advance of the item becoming due.
Measured in hours.
- weekdays: Mapped[int]
Days of the week on which to run this schedule.
This is a bitfield (of length 16), so multiple days can be selected by combining their values with bitwise OR.
Value
Binary
Day
00000 0000 0000 0000(None)
10000 0000 0000 0001Monday
20000 0000 0000 0010Tuesday
40000 0000 0000 0100Wednesday
80000 0000 0000 1000Thursday
160000 0000 0001 0000Friday
320000 0000 0010 0000Saturday
640000 0000 0100 0000Sunday
For example, to run Monday through Thursday, the value of this field would be 15 (
0000 1111), and to run regardless of the current day of the week, this field would be 127 (0111 1111).Setting this value to zero will deselect all days and prevent this schedule from ever running.
- class pytm4srv.models.MaintenanceTaskItem
A recurring task that must be completed on an interval.
- completion_duration: Mapped[timedelta]
How long it is expected to take to complete this item, in minutes.
- cycle_timer: Mapped[timedelta]
The total accumulated cycle time (in minutes) for use when the schedule mode is
1.
- difficulty: Mapped[int]
How difficult this maintenance item is to complete. Useful for delegating to operators of varying training levels.
Value
Difficulty
1Easy
2Medium (default)
3Hard
4Expert (management supervision required)
- equipment_id: Mapped[int | None]
The ID of the equipment this maintenance item is for.
Set to
NULLfor items that apply to a machine or the shop as a whole instead of a particular piece of equipment.Only one of
machine_idorequipment_idmay be set for a given issue.
- frequency: Mapped[str]
How often to repeat this schedule.
Valid options are:
Y(yearly)M(monthly)W(weekly)D(daily)H(hourly)
- id: Mapped[IntPK]
Unique ID across all maintenance items.
- indices: Mapped[List[int]]
When to run within each occurrence of
frequency.For example: frequency=M and indices=[1, 14] will run the 1st and 14th of every month, but frequency=M and indices=[-2] will run on the second to last day of every month.
Ignored if
frequencyis set toH.
- initial_entry: Mapped[datetime | None]
For newly-created maintenance items, this field can be used to set the previous entry date without creating an actual entry.
Once an entry exists for this item, the value of field will be ignored.
- instructions: Mapped[str]
Instructions to users for completing this maintenance item.
- interval: Mapped[int]
One out of how many
frequencyoccurrences to run.For example: frequency=D and interval=1 will run every day, but frequency=W and interval=3 will run every 3 weeks.
- is_critical: Mapped[bool]
Whether the machine should be kept from running until this maintenance item is completed.
- item_type: Mapped[str]
The type of this item. This corresponds to a model type and determines which fields are available.
See the item API endpoint documentation for the possible values.
- machine_id: Mapped[int | None]
The ID of the machine this maintenance item belongs to.
Set to
NULLfor items that apply to the shop as a whole instead of a particular machine.Only one of
machine_idorequipment_idmay be set for a given issue.
- months: Mapped[int]
Months in which to run this schedule.
This is a bitfield (of length 16), so multiple months can be selected by combining their values with bitwise OR.
Value
Binary
Month
00000 0000 0000 0000(None)
10000 0000 0000 0001January
20000 0000 0000 0010February
40000 0000 0000 0100March
80000 0000 0000 1000April
160000 0000 0001 0000May
320000 0000 0010 0000June
640000 0000 0100 0000July
1280000 0000 1000 0000August
2560000 0001 0000 0000September
5120000 0010 0000 0000October
10240000 0100 0000 0000November
20480000 1000 0000 0000December
For example, to run only at the start of each quarter (January, April, July, and October), the value of this field would be 585 (1 + 8 + 64 + 512, or
0000 0010 0100 1001), or to run regardless of the current month, this field would be 4095 (0000 1111 1111 1111).Setting this value to zero will deselect all months and prevent this schedule from ever running.
- name: Mapped[str]
User-specified name for this rule.
- needed_when_archived: Mapped[bool]
Whether this maintenance item needs to be performed for archived machines. Defaults to false.
If this maintenance item is not associated with a machine, this field does nothing.
- needed_when_not_archived: Mapped[bool]
Whether this maintenance item needs to be performed for non-archived machines. Defaults to true.
If this maintenance item is not associated with a machine, this field does nothing.
- process_id: Mapped[int | None]
If non-null, this maintenance item will only come due when this process is active.
Generally this process will be on the machine associated with this maintenance item, but this is not a requirement so shop-wide and equipment-linked maintenance items can use this as well.
- remind_channel_id: Mapped[int | None]
The ID of the notification channel to which due reminders (and, optionally, warning messages) will be sent.
nulldisables sending notifications.
- schedule_mode: Mapped[int]
How this maintenance item should be scheduled. This field can take the following values:
Value
Mode
Description
0(default)Clock time
The item will be due every
timer_interval.1Run time
The
cycle_timerfor this item will be incremented by the active process’s cycle time each time a part is finished on the associated machine.If the item is not associated with a machine, it will use clock time mode.
The item will be due every
timer_intervalof process production time.2Calendar
The item will be scheduled using the
frequency,interval,indices,months,weekdays, andtime_of_dayfields.
- time_of_day: Mapped[time]
What time of day to schedule for.
- timer_interval: Mapped[timedelta]
If non-zero and the schedule mode is
0or1, the item will be due when this much time has passed since the last completion of this task.Measured in hours.
- trigger_alarm_id: Mapped[int | None]
The ID of the alarm that caused this maintenance item to become due at the alarm’s timestamp.
Once a new entry is created, OnTakt will reset this field to
null.
- trigger_alarms: Mapped[StringArray]
A list of NC alarm messages that will cause this maintenance item to become due immediately when present on the associated machine.
If this maintenance item is not associated with a machine (or is associated with equipment that is in turn not associated with a machine), this field does nothing.
This is processed independently of
custom_alarms, so these should be the strings as reported by the control.
- warning_interval: Mapped[timedelta]
If non-zero, a warning will be sent this far in advance of the item becoming due.
Measured in hours.
- weekdays: Mapped[int]
Days of the week on which to run this schedule.
This is a bitfield (of length 16), so multiple days can be selected by combining their values with bitwise OR.
Value
Binary
Day
00000 0000 0000 0000(None)
10000 0000 0000 0001Monday
20000 0000 0000 0010Tuesday
40000 0000 0000 0100Wednesday
80000 0000 0000 1000Thursday
160000 0000 0001 0000Friday
320000 0000 0010 0000Saturday
640000 0000 0100 0000Sunday
For example, to run Monday through Thursday, the value of this field would be 15 (
0000 1111), and to run regardless of the current day of the week, this field would be 127 (0111 1111).Setting this value to zero will deselect all days and prevent this schedule from ever running.
Entries
Completion of a maintenance item by a shop user.
- class pytm4srv.models.MaintenanceMeasurementEntry
A single measured value for a
MaintenanceMeasurementItem.- duration: Mapped[timedelta | None]
How long it took to complete this entry (in minutes).
- entry_type: Mapped[str]
The type of this entry. This corresponds to a model type and determines which fields are available.
See the entry API endpoint documentation for the possible values.
- id: Mapped[IntPK]
Unique ID across all maintenance entries.
- item_id: Mapped[int]
The ID of the maintenance item this entry is for.
- notes: Mapped[str]
User-specified notes about this entry.
- timestamp: Mapped[datetime]
When this entry was created.
- unit: Mapped[str | None]
The unit the value was measured in.
Can be
NULL, in which case the maintenance measurement’s unit may be assumed, but that could have changed after this measurement was taken. Therefore, it is best for the user to always enter this with the measurement, though the client can suggest the measurement item’s default unit and require the user to change it.
- user_id: Mapped[int]
The ID of the user who entered this information.
- value: Mapped[float | None]
The measured value.
Can be
NULL, but thenotesshould explain why.
- class pytm4srv.models.MaintenanceTaskEntry
A single completion of a
MaintenanceTaskEntry.- duration: Mapped[timedelta | None]
How long it took to complete this entry (in minutes).
- entry_type: Mapped[str]
The type of this entry. This corresponds to a model type and determines which fields are available.
See the entry API endpoint documentation for the possible values.
- id: Mapped[IntPK]
Unique ID across all maintenance entries.
- item_id: Mapped[int]
The ID of the maintenance item this entry is for.
- notes: Mapped[str]
User-specified notes about this entry.
- success: Mapped[bool]
Whether the task was completed successfully.
If
FALSE, thenotesshould explain why.
- timestamp: Mapped[datetime]
When this entry was created.
- user_id: Mapped[int]
The ID of the user who entered this information.
Issues
Independent of preconfigured maintenance items.