Makerspace tool integration

I’m just starting with HA but already impressed with possibilities comparing to Hubitat I’m currently using. Will appreciate any hints or examples how to do what I want.
I’m implementing a solution for local non-profit makerspace. We have multiple tools like laser cutters, 3D printers, CNC router etc. External CRM handles userbase.

Problems that I’d need to solve:

  1. only certified users can use the tool (CRM knows who is certified)
  2. based on tool current wattage determine tool state (off, idling or doing work). Wattage thresholds are different for every tool.
  3. when user badges-in card reader makes a call to CRM, it verifies that user is certified and if OK turns on the tool saving userId
  4. when tools stops working - tool should calculate work time and send it back to CRM (webhook) across with userId
  5. when user badges-out the tools turns off

I’m connecting a tool through Z-wave smart plug so I could control power.

I’ve implemented this with 5 separate automations but will need to add more tools and it will be really complicated to support that many automations so I’m looking for something more elegant and extendable.

I’m trying to understand if I’m moving in correct direction.

  1. I’m adding new integration: Makerspace. It holds API endpoint and secret token
  2. Within integration I’m defining Tool device with Switch capabilities. Tool stores wattage thresholds for given tool
  3. Every Tool knows which existing Switch device it is connected to (how?)
  4. Every Tool defines webhook trigger. Badge-in webhook will save userId into device options, badge-out webhook clears it.
  5. Device automations are watching switch’s status and update Tool’s state
  6. state change triggers call to CRM - get API URL and secret token from integration and make HTTP call

Ok, I slept on it and now I think that could get away with just one big automation blueprint with multiple triggerIds.