Alarm
Model
- class pytm4srv.models.Alarm
- Represents a past alarm. - alarm_code: Mapped[str]
- The alarm code reported by the machine. 
 - alarm_src: Mapped[str]
- The source of the alarm (“NC” or “TMAC”). 
 - alarm_type: Mapped[str]
- The type of alarm reported. 
 - custom_message: Mapped[str]
- Message specified in machine settings or looked up from the alarm code. 
 - editor_id: Mapped[int | None]
- ID of the user who last edited this alarm. 
 - false_alarm: Mapped[bool]
- Whether the alarm reported by the machine has been identified as a false alarm. 
 - id: MappedColumn object at 0x79861b52dc60>]]
- Unique, numeric ID for this alarm in OnTakt. 
 - info: Mapped[dict]
- Data that was recorded during the alarm. - For NC alarms, this is the position of all axes. 
- For TMAC alarms, this is the tool and section that were running. 
 
 - machine_id: Mapped[int]
- The ID of the machine the alarm occurred on. 
 - notes: Mapped[str]
- User-modifiable notes about the alarm. 
 - timestamp: Mapped[datetime]
- The date and time the alarm was reported. 
 - tool_assembly_id: Mapped[int | None]
- ID of the tool assembly related to this alarm, if any. - Primarily for use with TMAC alarms. 
 
Endpoints
- GET /api/alarms/
- Get a list of alarms. - Query Parameters:
- machine (int) – if specified by ID, only alarms from that machine will be returned 
- day (string) – if specified (in - YYYY-MM-DDformat), only alarms on that date (UTC) will be returned
 
 - Example response: - { "758": { "alarm_src": "TMAC", "alarm_type": "EXTREME ALARM", "id": 758, "info": { "section": "unavailable", "tool": "unavailable" }, "machine_id": 9, "notes": "", "timestamp": 1595346567.894741 }, "759": { "alarm_src": "TMAC", "alarm_type": "WEAR ALARM", "id": 759, "info": { "section": "unavailable", "tool": "unavailable" }, "machine_id": 9, "notes": "", "timestamp": 1595374705.988335 }, "760": { "alarm_src": "TMAC", "alarm_type": "EXTREME ALARM", "id": 760, "info": { "section": "unavailable", "tool": "unavailable" }, "machine_id": 9, "notes": "", "timestamp": 1595375451.101454 } } - Returns:
- an object mapping alarm IDs to Alarm objects 
 
- PATCH /api/alarms/(int: alarm_id)
- Edit an existing alarm. - Request JSON Object:
- notes (string) – a new notes field value 
 
- Parameters:
- alarm_id – the ID of the alarm to edit 
 
- Returns:
- the modified alarm object 
- Status Codes:
- 404 Not Found – if the alarm doesn’t exist 
 
 
- DELETE /api/alarms/(int: alarm_id)
- Delete an alarm from the database. - Parameters:
- alarm_id – The numeric ID of the alarm to delete. 
 
- Status Codes:
- 204 No Content – on success 
- 404 Not Found – if the alarm does not exist