Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/hardware/abstract/pump.py: 0%

21 statements  

« prev     ^ index     » next       coverage.py v7.6.5, created at 2024-11-15 02:12 +0000

1#!/usr/bin/env python 

2# -*- coding: utf-8 -*- 

3from marshmallow import fields 

4 

5from daiquiri.core.hardware.abstract import HardwareObject 

6from daiquiri.core.schema.hardware import HardwareSchema 

7from daiquiri.core.schema.validators import RequireEmpty, OneOf 

8 

9import logging 

10 

11logger = logging.getLogger(__name__) 

12 

13PumpStates = ["ON", "OFF", "UNKNOWN", "ERROR"] 

14 

15 

16class PumpPropertiesSchema(HardwareSchema): 

17 state = OneOf(PumpStates, metadata={"readOnly": True}) 

18 status = fields.Str(metadata={"readOnly": True}) 

19 pressure = fields.Float(metadata={"readOnly": True}) 

20 voltage = fields.Float(metadata={"readOnly": True}) 

21 current = fields.Float(metadata={"readOnly": True}) 

22 

23 

24class PumpCallablesSchema(HardwareSchema): 

25 on = RequireEmpty() 

26 off = RequireEmpty() 

27 

28 

29class Pump(HardwareObject): 

30 _type = "pump" 

31 _state_ok = [PumpStates[0], PumpStates[1]] 

32 

33 _properties = PumpPropertiesSchema() 

34 _callables = PumpCallablesSchema()