iqrfpy.utils.quantity_data

Quantity data module.

This module contains Quantity dataclasses used when parsing Sensor data.

  1"""Quantity data module.
  2
  3This module contains Quantity dataclasses used when parsing Sensor data.
  4"""
  5
  6from dataclasses import dataclass
  7from typing import Union
  8from iqrfpy.exceptions import UnknownSensorTypeError
  9from iqrfpy.utils.sensor_constants import SensorTypes, SensorFrcCommands
 10
 11__all__ = [
 12    'Temperature',
 13    'CO2',
 14    'VOC',
 15    'ExtraLowVoltage',
 16    'EarthsMagneticField',
 17    'LowVoltage',
 18    'Current',
 19    'Power',
 20    'MainsFrequency',
 21    'TimeSpan',
 22    'Illuminance',
 23    'NO2',
 24    'SO2',
 25    'CO',
 26    'O3',
 27    'AtmosphericPressure',
 28    'BinaryInput',
 29    'ColorTemperature',
 30    'ParticulatesPM2_5',
 31    'SoundPressureLevel',
 32    'Altitude',
 33    'Acceleration',
 34    'NH3',
 35    'Methane',
 36    'ShortLength',
 37    'ParticulatesPM1',
 38    'ParticulatesPM4',
 39    'ParticulatesPM10',
 40    'TVOC',
 41    'NOX',
 42    'ActivityConcentration',
 43    'RelativeHumidity',
 44    'BinaryData7',
 45    'PowerFactor',
 46    'UVIndex',
 47    'PH',
 48    'RSSI',
 49    'Action',
 50    'BinaryData30',
 51    'Consumption',
 52    'Datetime',
 53    'TimeSpanLong',
 54    'Latitude',
 55    'Longitude',
 56    'TemperatureFloat',
 57    'Length',
 58    'FourBytes',
 59    'DataBlock',
 60    'get_sensor_class'
 61]
 62
 63
 64@dataclass
 65class Temperature:
 66    """Temperature dataclass."""
 67
 68    type = SensorTypes.TEMPERATURE
 69    name = 'Temperature'
 70    short_name = 'T'
 71    unit = '˚C'
 72    decimal_places = 4
 73    frc_commands = [
 74        SensorFrcCommands.FRC_1BYTE,
 75        SensorFrcCommands.FRC_2BYTES
 76    ]
 77
 78
 79@dataclass
 80class CO2:
 81    """Carbon dioxide dataclass."""
 82
 83    type = SensorTypes.CO2
 84    name = 'Carbon dioxide'
 85    short_name = 'CO2'
 86    unit = 'ppm'
 87    decimal_places = 0
 88    frc_commands = [
 89        SensorFrcCommands.FRC_1BYTE,
 90        SensorFrcCommands.FRC_2BYTES
 91    ]
 92
 93
 94@dataclass
 95class VOC:
 96    """Volatile organic compound dataclass."""
 97
 98    type = SensorTypes.VOC
 99    name = 'Volatile organic compound'
100    short_name = 'VOC'
101    unit = 'ppm'
102    decimal_places = 0
103    frc_commands = [
104        SensorFrcCommands.FRC_1BYTE,
105        SensorFrcCommands.FRC_2BYTES
106    ]
107
108
109@dataclass
110class ExtraLowVoltage:
111    """Extra-low voltage dataclass."""
112
113    type = SensorTypes.EXTRA_LOW_VOLTAGE
114    name = 'Extra-low voltage'
115    short_name = 'U'
116    unit = 'V'
117    decimal_places = 3
118    frc_commands = [
119        SensorFrcCommands.FRC_2BYTES
120    ]
121
122
123@dataclass
124class EarthsMagneticField:
125    """Earth's magnetic field dataclass."""
126
127    type = SensorTypes.EARTHS_MAGNETIC_FIELD
128    name = "Earth's magnetic field"
129    short_name = 'B'
130    unit = 'T'
131    decimal_places = 7
132    frc_commands = [
133        SensorFrcCommands.FRC_2BYTES
134    ]
135
136
137@dataclass
138class LowVoltage:
139    """Low voltage dataclass."""
140
141    type = SensorTypes.LOW_VOLTAGE
142    name = 'Low voltage'
143    short_name = 'U'
144    unit = 'V'
145    decimal_places = 4
146    frc_commands = [
147        SensorFrcCommands.FRC_2BYTES
148    ]
149
150
151@dataclass
152class Current:
153    """Current dataclass."""
154
155    type = SensorTypes.CURRENT
156    name = 'Current'
157    short_name = 'I'
158    unit = 'A'
159    decimal_places = 3
160    frc_commands = [
161        SensorFrcCommands.FRC_2BYTES
162    ]
163
164
165@dataclass
166class Power:
167    """Power dataclass."""
168
169    type = SensorTypes.POWER
170    name = 'Power'
171    short_name = 'P'
172    unit = 'W'
173    decimal_places = 2
174    frc_commands = [
175        SensorFrcCommands.FRC_2BYTES
176    ]
177
178
179@dataclass
180class MainsFrequency:
181    """Mains frequency dataclass."""
182
183    type = SensorTypes.MAINS_FREQUENCY
184    name = 'Mains frequency'
185    short_name = 'f'
186    unit = 'Hz'
187    decimal_places = 3
188    frc_commands = [
189        SensorFrcCommands.FRC_2BYTES
190    ]
191
192
193@dataclass
194class TimeSpan:
195    """Timespan dataclass."""
196
197    type = SensorTypes.TIMESPAN
198    name = 'Timespan'
199    short_name = 't'
200    unit = 's'
201    decimal_places = 0
202    frc_commands = [
203        SensorFrcCommands.FRC_2BYTES
204    ]
205
206
207@dataclass
208class Illuminance:
209    """Illuminance dataclass."""
210
211    type = SensorTypes.ILLUMINANCE
212    name = 'Illuminance'
213    short_name = 'Ev'
214    unit = 'lx'
215    decimal_places = 0
216    frc_commands = [
217        SensorFrcCommands.FRC_2BYTES
218    ]
219
220
221@dataclass
222class NO2:
223    """Nitrogen dioxide dataclass."""
224
225    type = SensorTypes.NO2
226    name = 'Nitrogen dioxide'
227    short_name = 'NO2'
228    unit = 'ppm'
229    decimal_places = 3
230    frc_commands = [
231        SensorFrcCommands.FRC_2BYTES
232    ]
233
234
235@dataclass
236class SO2:
237    """Sulfur dioxide dataclass."""
238
239    type = SensorTypes.SO2
240    name = 'Sulfur dioxide'
241    short_name = 'SO2'
242    unit = 'ppm'
243    decimal_places = 3
244    frc_commands = [
245        SensorFrcCommands.FRC_2BYTES
246    ]
247
248
249@dataclass
250class CO:
251    """Carbon monoxide dataclass."""
252
253    type = SensorTypes.CO
254    name = 'Carbon monoxide'
255    short_name = 'CO'
256    unit = 'ppm'
257    decimal_places = 2
258    frc_commands = [
259        SensorFrcCommands.FRC_2BYTES
260    ]
261
262
263@dataclass
264class O3:
265    """Ozone dataclass."""
266
267    type = SensorTypes.O3
268    name = 'Ozone'
269    short_name = 'O3'
270    unit = 'ppm'
271    decimal_places = 4
272    frc_commands = [
273        SensorFrcCommands.FRC_2BYTES
274    ]
275
276
277@dataclass
278class AtmosphericPressure:
279    """Atmospheric pressure dataclass."""
280
281    type = SensorTypes.ATMOSPHERIC_PRESSURE
282    name = 'Atmospheric pressure'
283    short_name = 'p'
284    unit = 'hPa'
285    decimal_places = 4
286    frc_commands = [
287        SensorFrcCommands.FRC_2BYTES
288    ]
289
290
291@dataclass
292class ColorTemperature:
293    """Color temperature dataclass."""
294
295    type = SensorTypes.COLOR_TEMPERATURE
296    name = 'Color temperature'
297    short_name = 'Tc'
298    unit = 'K'
299    decimal_places = 0
300    frc_commands = [
301        SensorFrcCommands.FRC_2BYTES
302    ]
303
304
305@dataclass
306class ParticulatesPM2_5:
307    """Particulates PM2.5 dataclass."""
308
309    type = SensorTypes.PARTICULATES_PM2_5
310    name = 'Particulates PM2.5'
311    short_name = 'PM2.5'
312    unit = 'µg/m3'
313    decimal_places = 2
314    frc_commands = [
315        SensorFrcCommands.FRC_2BYTES
316    ]
317
318
319@dataclass
320class SoundPressureLevel:
321    """Sound pressure level dataclass."""
322
323    type = SensorTypes.SOUND_PRESSURE_LEVEL
324    name = 'Sound pressure level'
325    short_name = 'Lp'
326    unit = 'dB'
327    decimal_places = 4
328    frc_commands = [
329        SensorFrcCommands.FRC_2BYTES
330    ]
331
332
333@dataclass
334class Altitude:
335    """Altitude dataclass."""
336
337    type = SensorTypes.ALTITUDE
338    name = 'Altitude'
339    short_name = 'h'
340    unit = 'm'
341    decimal_places = 2
342    frc_commands = [
343        SensorFrcCommands.FRC_2BYTES
344    ]
345
346
347@dataclass
348class Acceleration:
349    """Acceleration dataclass."""
350
351    types = SensorTypes.ACCELERATION
352    name = 'Acceleration'
353    short_name = 'a'
354    unit = 'm/s2'
355    decimal_places = 8
356    frc_commands = [
357        SensorFrcCommands.FRC_2BYTES
358    ]
359
360
361@dataclass
362class NH3:
363    """Ammonia dataclass."""
364
365    types = SensorTypes.NH3
366    name = 'Ammonia'
367    short_name = 'NH3'
368    unit = 'ppm'
369    decimal_places = 1
370    frc_commands = [
371        SensorFrcCommands.FRC_2BYTES
372    ]
373
374
375@dataclass
376class Methane:
377    """Methane dataclass."""
378
379    type = SensorTypes.METHANE
380    name = 'Methane'
381    short_name = 'CH4'
382    unit = '%'
383    decimal_places = 3
384    frc_commands = [
385        SensorFrcCommands.FRC_2BYTES
386    ]
387
388
389@dataclass
390class ShortLength:
391    """Short length dataclass."""
392
393    type = SensorTypes.SHORT_LENGTH
394    name = 'Short length'
395    short_name = 'l'
396    unit = 'm'
397    decimal_places = 3
398    frc_commands = [
399        SensorFrcCommands.FRC_2BYTES
400    ]
401
402
403@dataclass
404class ParticulatesPM1:
405    """Particulates PM1 dataclass."""
406
407    type = SensorTypes.PARTICULATES_PM1
408    name = 'Particulates PM1'
409    short_name = 'PM1'
410    unit = 'µg/m3'
411    decimal_places = 2
412    frc_commands = [
413        SensorFrcCommands.FRC_2BYTES
414    ]
415
416
417@dataclass
418class ParticulatesPM4:
419    """Particulates PM4 dataclass."""
420
421    type = SensorTypes.PARTICULATES_PM4
422    name = 'Particulates PM4'
423    short_name = 'PM4'
424    unit = 'µg/m3'
425    decimal_places = 2
426    frc_commands = [
427        SensorFrcCommands.FRC_2BYTES
428    ]
429
430
431@dataclass
432class ParticulatesPM10:
433    """Particulates PM10 dataclass."""
434
435    type = SensorTypes.PARTICULATES_PM10
436    name = 'Particulates PM10'
437    short_name = 'PM10'
438    unit = 'µg/m3'
439    decimal_places = 2
440    frc_commands = [
441        SensorFrcCommands.FRC_2BYTES
442    ]
443
444
445@dataclass
446class TVOC:
447    """Total volatile organic compound dataclass."""
448
449    type = SensorTypes.TVOC
450    name = 'Total volatile organic compound'
451    short_name = 'TVOC'
452    unit = 'µg/m3'
453    decimal_places = 0
454    frc_commands = [
455        SensorFrcCommands.FRC_2BYTES
456    ]
457
458
459@dataclass
460class NOX:
461    """Nitrogen oxides dataclass."""
462
463    type = SensorTypes.NOX
464    name = 'Nitrogen oxides'
465    short_name = 'NOX'
466    unit = ''
467    decimal_places = 0
468    frc_commands = [
469        SensorFrcCommands.FRC_2BYTES
470    ]
471
472
473@dataclass
474class ActivityConcentration:
475    """Activity concentration dataclass."""
476
477    type = SensorTypes.ACTIVITY_CONCENTRATION
478    name = 'Activity concentration'
479    short_name = 'CA'
480    unit = 'Bq/m3'
481    decimal_places = 0
482    frc_commands = [
483        SensorFrcCommands.FRC_2BYTES
484    ]
485
486
487@dataclass
488class BinaryInput:
489    """Binary input dataclass."""
490
491    type = SensorTypes.BINARY_INPUT
492    name = 'Binary input'
493    short_name = 'BinInput'
494    unit = ''
495    decimal_places = 0
496    frc_commands = [
497        SensorFrcCommands.FRC_2BYTES
498    ]
499
500
501@dataclass
502class ParticulatesPM40:
503    """Particulates PM40 dataclass."""
504
505    type = SensorTypes.PARTICULATES_PM40
506    name = 'Particulates PM40'
507    short_name = 'PM40'
508    unit = 'µg/m3'
509    decimal_places = 2
510    frc_commands = [
511        SensorFrcCommands.FRC_2BYTES
512    ]
513
514
515@dataclass
516class RelativeHumidity:
517    """Relative humidity dataclass."""
518
519    type = SensorTypes.RELATIVE_HUMIDITY
520    name = 'Relative humidity'
521    short_name = 'RH'
522    unit = '%'
523    decimal_places = 1
524    frc_commands = [
525        SensorFrcCommands.FRC_1BYTE
526    ]
527
528
529@dataclass
530class BinaryData7:
531    """Binary data 7 dataclass."""
532
533    type = SensorTypes.BINARYDATA7
534    name = 'Binary data7'
535    short_name = 'bin7'
536    unit = ''
537    decimal_places = 0
538    frc_commands = [
539        SensorFrcCommands.FRC_2BITS,
540        SensorFrcCommands.FRC_1BYTE
541    ]
542
543
544@dataclass
545class PowerFactor:
546    """Power factor dataclass."""
547
548    type = SensorTypes.POWER_FACTOR
549    name = 'Power factor'
550    short_name = 'cos θ'
551    unit = ''
552    decimal_places = 3
553    frc_commands = [
554        SensorFrcCommands.FRC_1BYTE
555    ]
556
557
558@dataclass
559class UVIndex:
560    """UV index dataclass."""
561
562    type = SensorTypes.UV_INDEX
563    name = 'UV index'
564    short_name = 'UV'
565    unit = ''
566    decimal_places = 3
567    frc_commands = [
568        SensorFrcCommands.FRC_1BYTE
569    ]
570
571
572@dataclass
573class PH:
574    """PH dataclass."""
575
576    type = SensorTypes.PH
577    name = 'pH'
578    short_name = 'pH'
579    unit = ''
580    decimal_places = 4
581    frc_commands = [
582        SensorFrcCommands.FRC_1BYTE
583    ]
584
585
586@dataclass
587class RSSI:
588    """RSSI dataclass."""
589
590    type = SensorTypes.RSSI
591    name = 'RSSI'
592    short_name = 'RSSI'
593    unit = 'dBm'
594    decimal_places = 1
595    frc_commands = [
596        SensorFrcCommands.FRC_1BYTE
597    ]
598
599
600@dataclass
601class Action:
602    """Action dataclass."""
603
604    type = SensorTypes.ACTION
605    name = 'Action'
606    short_name = 'Action'
607    unit = ''
608    decimal_places = 0
609    frc_commands = [
610        SensorFrcCommands.FRC_1BYTE
611    ]
612
613
614@dataclass
615class BinaryData30:
616    """Binary data 30 dataclass."""
617
618    type = SensorTypes.BINARYDATA30
619    name = 'Binary data30'
620    short_name = 'bin30'
621    unit = ''
622    decimal_places = 0
623    frc_commands = [
624        SensorFrcCommands.FRC_2BYTES,
625        SensorFrcCommands.FRC_4BYTES
626    ]
627
628
629@dataclass
630class Consumption:
631    """Consumption dataclass."""
632
633    type = SensorTypes.CONSUMPTION
634    name = 'Consumption'
635    short_name = 'E'
636    unit = 'Wh'
637    decimal_places = 0
638    frc_commands = [
639        SensorFrcCommands.FRC_4BYTES
640    ]
641
642
643@dataclass
644class Datetime:
645    """Datetime dataclass."""
646
647    type = SensorTypes.DATETIME
648    name = 'DateTime'
649    short_name = 'DateTime'
650    unit = ''
651    decimal_places = 0
652    frc_commands = [
653        SensorFrcCommands.FRC_4BYTES
654    ]
655
656
657@dataclass
658class TimeSpanLong:
659    """Timespan long dataclass."""
660
661    type = SensorTypes.TIMESPAN_LONG
662    name = 'Timespan long'
663    short_name = 't'
664    unit = 's'
665    decimal_places = 4
666    frc_commands = [
667        SensorFrcCommands.FRC_4BYTES
668    ]
669
670
671@dataclass
672class Latitude:
673    """Latitude dataclass."""
674
675    type = SensorTypes.LATITUDE
676    name = 'Latitude'
677    short_name = 'LAT'
678    unit = '°'
679    decimal_places = 7
680    frc_commands = [
681        SensorFrcCommands.FRC_4BYTES
682    ]
683
684
685@dataclass
686class Longitude:
687    """Longitude dataclass."""
688
689    type = SensorTypes.LONGITUDE
690    name = 'Longitude'
691    short_name = 'LONG'
692    unit = '°'
693    decimal_places = 7
694    frc_commands = [
695        SensorFrcCommands.FRC_4BYTES
696    ]
697
698
699@dataclass
700class TemperatureFloat:
701    """Temperature float dataclass."""
702
703    type = SensorTypes.TEMPERATURE_FLOAT
704    name = 'Temperature'
705    short_name = 'T'
706    unit = '˚C'
707    decimal_places = 7
708    frc_commands = [
709        SensorFrcCommands.FRC_4BYTES
710    ]
711
712
713@dataclass
714class Length:
715    """Length dataclass."""
716
717    type = SensorTypes.LENGTH
718    name = 'Length'
719    short_name = 'l'
720    unit = 'm'
721    decimal_places = 7
722    frc_commands = [
723        SensorFrcCommands.FRC_4BYTES
724    ]
725
726
727@dataclass
728class FourBytes:
729    """Four bytes dataclass."""
730
731    type = SensorTypes.FOUR_BYTES
732    name = 'Four bytes'
733    short_name = '4B'
734    unit = ''
735    decimal_places = 0
736    frc_commands = [
737        SensorFrcCommands.FRC_4BYTES
738    ]
739
740
741@dataclass
742class DataBlock:
743    """Data block dataclass."""
744
745    type = SensorTypes.DATA_BLOCK
746    name = 'Data block'
747    short_name = 'datablock'
748    unit = ''
749    decimal_places = 0
750    frc_commands = []
751
752
753_type_classes = {
754    SensorTypes.TEMPERATURE: Temperature,
755    SensorTypes.CO2: CO2,
756    SensorTypes.VOC: VOC,
757    SensorTypes.EXTRA_LOW_VOLTAGE: ExtraLowVoltage,
758    SensorTypes.EARTHS_MAGNETIC_FIELD: EarthsMagneticField,
759    SensorTypes.LOW_VOLTAGE: LowVoltage,
760    SensorTypes.CURRENT: Current,
761    SensorTypes.POWER: Power,
762    SensorTypes.MAINS_FREQUENCY: MainsFrequency,
763    SensorTypes.TIMESPAN: TimeSpan,
764    SensorTypes.ILLUMINANCE: Illuminance,
765    SensorTypes.NO2: NO2,
766    SensorTypes.SO2: SO2,
767    SensorTypes.CO: CO,
768    SensorTypes.O3: O3,
769    SensorTypes.ATMOSPHERIC_PRESSURE: AtmosphericPressure,
770    SensorTypes.BINARY_INPUT: BinaryInput,
771    SensorTypes.COLOR_TEMPERATURE: ColorTemperature,
772    SensorTypes.PARTICULATES_PM2_5: ParticulatesPM2_5,
773    SensorTypes.SOUND_PRESSURE_LEVEL: SoundPressureLevel,
774    SensorTypes.ALTITUDE: Altitude,
775    SensorTypes.ACCELERATION: Acceleration,
776    SensorTypes.NH3: NH3,
777    SensorTypes.METHANE: Methane,
778    SensorTypes.SHORT_LENGTH: ShortLength,
779    SensorTypes.PARTICULATES_PM1: ParticulatesPM1,
780    SensorTypes.PARTICULATES_PM4: ParticulatesPM4,
781    SensorTypes.PARTICULATES_PM10: ParticulatesPM10,
782    SensorTypes.TVOC: TVOC,
783    SensorTypes.NOX: NOX,
784    SensorTypes.ACTIVITY_CONCENTRATION: ActivityConcentration,
785    SensorTypes.PARTICULATES_PM40: ParticulatesPM40,
786    SensorTypes.RELATIVE_HUMIDITY: RelativeHumidity,
787    SensorTypes.BINARYDATA7: BinaryData7,
788    SensorTypes.POWER_FACTOR: PowerFactor,
789    SensorTypes.UV_INDEX: UVIndex,
790    SensorTypes.PH: PH,
791    SensorTypes.RSSI: RSSI,
792    SensorTypes.ACTION: Action,
793    SensorTypes.BINARYDATA30: BinaryData30,
794    SensorTypes.CONSUMPTION: Consumption,
795    SensorTypes.DATETIME: Datetime,
796    SensorTypes.TIMESPAN_LONG: TimeSpanLong,
797    SensorTypes.LATITUDE: Latitude,
798    SensorTypes.LONGITUDE: Longitude,
799    SensorTypes.TEMPERATURE_FLOAT: TemperatureFloat,
800    SensorTypes.LENGTH: Length,
801    SensorTypes.FOUR_BYTES: FourBytes,
802    SensorTypes.DATA_BLOCK: DataBlock,
803}
804
805
806def get_sensor_class(sensor_type: Union[SensorTypes, int]):
807    """Return quantity class corresponding to sensor type.
808
809    Args:
810        sensor_type (Union[SensorTypes, int]): Sensor type (represents a quantity)
811
812    Returns:
813        Quantity dataclass
814    Raises:
815        UnknownSensorTypeError: Raised if sensor type is passed as integer and the value is not recognized
816        ValueError: Raised if sensor type is recognized, but corresponding quantity data is missing
817    """
818    if sensor_type not in SensorTypes:
819        raise UnknownSensorTypeError(f'Unknown or unsupported sensor type: {sensor_type}')
820    if sensor_type not in _type_classes:
821        raise ValueError(f'Quantity data not available for sensor type: {sensor_type}')
822    return _type_classes[sensor_type]
@dataclass
class Temperature:
65@dataclass
66class Temperature:
67    """Temperature dataclass."""
68
69    type = SensorTypes.TEMPERATURE
70    name = 'Temperature'
71    short_name = 'T'
72    unit = '˚C'
73    decimal_places = 4
74    frc_commands = [
75        SensorFrcCommands.FRC_1BYTE,
76        SensorFrcCommands.FRC_2BYTES
77    ]

Temperature dataclass.

type = <SensorTypes.TEMPERATURE: 1>
name = 'Temperature'
short_name = 'T'
unit = '˚C'
decimal_places = 4
frc_commands = [<SensorFrcCommands.FRC_1BYTE: 144>, <SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class CO2:
80@dataclass
81class CO2:
82    """Carbon dioxide dataclass."""
83
84    type = SensorTypes.CO2
85    name = 'Carbon dioxide'
86    short_name = 'CO2'
87    unit = 'ppm'
88    decimal_places = 0
89    frc_commands = [
90        SensorFrcCommands.FRC_1BYTE,
91        SensorFrcCommands.FRC_2BYTES
92    ]

Carbon dioxide dataclass.

type = <SensorTypes.CO2: 2>
name = 'Carbon dioxide'
short_name = 'CO2'
unit = 'ppm'
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_1BYTE: 144>, <SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class VOC:
 95@dataclass
 96class VOC:
 97    """Volatile organic compound dataclass."""
 98
 99    type = SensorTypes.VOC
100    name = 'Volatile organic compound'
101    short_name = 'VOC'
102    unit = 'ppm'
103    decimal_places = 0
104    frc_commands = [
105        SensorFrcCommands.FRC_1BYTE,
106        SensorFrcCommands.FRC_2BYTES
107    ]

Volatile organic compound dataclass.

type = <SensorTypes.VOC: 3>
name = 'Volatile organic compound'
short_name = 'VOC'
unit = 'ppm'
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_1BYTE: 144>, <SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class ExtraLowVoltage:
110@dataclass
111class ExtraLowVoltage:
112    """Extra-low voltage dataclass."""
113
114    type = SensorTypes.EXTRA_LOW_VOLTAGE
115    name = 'Extra-low voltage'
116    short_name = 'U'
117    unit = 'V'
118    decimal_places = 3
119    frc_commands = [
120        SensorFrcCommands.FRC_2BYTES
121    ]

Extra-low voltage dataclass.

type = <SensorTypes.EXTRA_LOW_VOLTAGE: 4>
name = 'Extra-low voltage'
short_name = 'U'
unit = 'V'
decimal_places = 3
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class EarthsMagneticField:
124@dataclass
125class EarthsMagneticField:
126    """Earth's magnetic field dataclass."""
127
128    type = SensorTypes.EARTHS_MAGNETIC_FIELD
129    name = "Earth's magnetic field"
130    short_name = 'B'
131    unit = 'T'
132    decimal_places = 7
133    frc_commands = [
134        SensorFrcCommands.FRC_2BYTES
135    ]

Earth's magnetic field dataclass.

type = <SensorTypes.EARTHS_MAGNETIC_FIELD: 5>
name = "Earth's magnetic field"
short_name = 'B'
unit = 'T'
decimal_places = 7
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class LowVoltage:
138@dataclass
139class LowVoltage:
140    """Low voltage dataclass."""
141
142    type = SensorTypes.LOW_VOLTAGE
143    name = 'Low voltage'
144    short_name = 'U'
145    unit = 'V'
146    decimal_places = 4
147    frc_commands = [
148        SensorFrcCommands.FRC_2BYTES
149    ]

Low voltage dataclass.

type = <SensorTypes.LOW_VOLTAGE: 6>
name = 'Low voltage'
short_name = 'U'
unit = 'V'
decimal_places = 4
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class Current:
152@dataclass
153class Current:
154    """Current dataclass."""
155
156    type = SensorTypes.CURRENT
157    name = 'Current'
158    short_name = 'I'
159    unit = 'A'
160    decimal_places = 3
161    frc_commands = [
162        SensorFrcCommands.FRC_2BYTES
163    ]

Current dataclass.

type = <SensorTypes.CURRENT: 7>
name = 'Current'
short_name = 'I'
unit = 'A'
decimal_places = 3
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class Power:
166@dataclass
167class Power:
168    """Power dataclass."""
169
170    type = SensorTypes.POWER
171    name = 'Power'
172    short_name = 'P'
173    unit = 'W'
174    decimal_places = 2
175    frc_commands = [
176        SensorFrcCommands.FRC_2BYTES
177    ]

Power dataclass.

type = <SensorTypes.POWER: 8>
name = 'Power'
short_name = 'P'
unit = 'W'
decimal_places = 2
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class MainsFrequency:
180@dataclass
181class MainsFrequency:
182    """Mains frequency dataclass."""
183
184    type = SensorTypes.MAINS_FREQUENCY
185    name = 'Mains frequency'
186    short_name = 'f'
187    unit = 'Hz'
188    decimal_places = 3
189    frc_commands = [
190        SensorFrcCommands.FRC_2BYTES
191    ]

Mains frequency dataclass.

type = <SensorTypes.MAINS_FREQUENCY: 9>
name = 'Mains frequency'
short_name = 'f'
unit = 'Hz'
decimal_places = 3
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class TimeSpan:
194@dataclass
195class TimeSpan:
196    """Timespan dataclass."""
197
198    type = SensorTypes.TIMESPAN
199    name = 'Timespan'
200    short_name = 't'
201    unit = 's'
202    decimal_places = 0
203    frc_commands = [
204        SensorFrcCommands.FRC_2BYTES
205    ]

Timespan dataclass.

type = <SensorTypes.TIMESPAN: 10>
name = 'Timespan'
short_name = 't'
unit = 's'
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class Illuminance:
208@dataclass
209class Illuminance:
210    """Illuminance dataclass."""
211
212    type = SensorTypes.ILLUMINANCE
213    name = 'Illuminance'
214    short_name = 'Ev'
215    unit = 'lx'
216    decimal_places = 0
217    frc_commands = [
218        SensorFrcCommands.FRC_2BYTES
219    ]

Illuminance dataclass.

type = <SensorTypes.ILLUMINANCE: 11>
name = 'Illuminance'
short_name = 'Ev'
unit = 'lx'
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class NO2:
222@dataclass
223class NO2:
224    """Nitrogen dioxide dataclass."""
225
226    type = SensorTypes.NO2
227    name = 'Nitrogen dioxide'
228    short_name = 'NO2'
229    unit = 'ppm'
230    decimal_places = 3
231    frc_commands = [
232        SensorFrcCommands.FRC_2BYTES
233    ]

Nitrogen dioxide dataclass.

type = <SensorTypes.NO2: 12>
name = 'Nitrogen dioxide'
short_name = 'NO2'
unit = 'ppm'
decimal_places = 3
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class SO2:
236@dataclass
237class SO2:
238    """Sulfur dioxide dataclass."""
239
240    type = SensorTypes.SO2
241    name = 'Sulfur dioxide'
242    short_name = 'SO2'
243    unit = 'ppm'
244    decimal_places = 3
245    frc_commands = [
246        SensorFrcCommands.FRC_2BYTES
247    ]

Sulfur dioxide dataclass.

type = <SensorTypes.SO2: 13>
name = 'Sulfur dioxide'
short_name = 'SO2'
unit = 'ppm'
decimal_places = 3
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class CO:
250@dataclass
251class CO:
252    """Carbon monoxide dataclass."""
253
254    type = SensorTypes.CO
255    name = 'Carbon monoxide'
256    short_name = 'CO'
257    unit = 'ppm'
258    decimal_places = 2
259    frc_commands = [
260        SensorFrcCommands.FRC_2BYTES
261    ]

Carbon monoxide dataclass.

type = <SensorTypes.CO: 14>
name = 'Carbon monoxide'
short_name = 'CO'
unit = 'ppm'
decimal_places = 2
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class O3:
264@dataclass
265class O3:
266    """Ozone dataclass."""
267
268    type = SensorTypes.O3
269    name = 'Ozone'
270    short_name = 'O3'
271    unit = 'ppm'
272    decimal_places = 4
273    frc_commands = [
274        SensorFrcCommands.FRC_2BYTES
275    ]

Ozone dataclass.

type = <SensorTypes.O3: 15>
name = 'Ozone'
short_name = 'O3'
unit = 'ppm'
decimal_places = 4
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class AtmosphericPressure:
278@dataclass
279class AtmosphericPressure:
280    """Atmospheric pressure dataclass."""
281
282    type = SensorTypes.ATMOSPHERIC_PRESSURE
283    name = 'Atmospheric pressure'
284    short_name = 'p'
285    unit = 'hPa'
286    decimal_places = 4
287    frc_commands = [
288        SensorFrcCommands.FRC_2BYTES
289    ]

Atmospheric pressure dataclass.

type = <SensorTypes.ATMOSPHERIC_PRESSURE: 16>
name = 'Atmospheric pressure'
short_name = 'p'
unit = 'hPa'
decimal_places = 4
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class BinaryInput:
488@dataclass
489class BinaryInput:
490    """Binary input dataclass."""
491
492    type = SensorTypes.BINARY_INPUT
493    name = 'Binary input'
494    short_name = 'BinInput'
495    unit = ''
496    decimal_places = 0
497    frc_commands = [
498        SensorFrcCommands.FRC_2BYTES
499    ]

Binary input dataclass.

type = <SensorTypes.BINARY_INPUT: 31>
name = 'Binary input'
short_name = 'BinInput'
unit = ''
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class ColorTemperature:
292@dataclass
293class ColorTemperature:
294    """Color temperature dataclass."""
295
296    type = SensorTypes.COLOR_TEMPERATURE
297    name = 'Color temperature'
298    short_name = 'Tc'
299    unit = 'K'
300    decimal_places = 0
301    frc_commands = [
302        SensorFrcCommands.FRC_2BYTES
303    ]

Color temperature dataclass.

type = <SensorTypes.COLOR_TEMPERATURE: 17>
name = 'Color temperature'
short_name = 'Tc'
unit = 'K'
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class ParticulatesPM2_5:
306@dataclass
307class ParticulatesPM2_5:
308    """Particulates PM2.5 dataclass."""
309
310    type = SensorTypes.PARTICULATES_PM2_5
311    name = 'Particulates PM2.5'
312    short_name = 'PM2.5'
313    unit = 'µg/m3'
314    decimal_places = 2
315    frc_commands = [
316        SensorFrcCommands.FRC_2BYTES
317    ]

Particulates PM2.5 dataclass.

type = <SensorTypes.PARTICULATES_PM2_5: 18>
name = 'Particulates PM2.5'
short_name = 'PM2.5'
unit = 'µg/m3'
decimal_places = 2
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class SoundPressureLevel:
320@dataclass
321class SoundPressureLevel:
322    """Sound pressure level dataclass."""
323
324    type = SensorTypes.SOUND_PRESSURE_LEVEL
325    name = 'Sound pressure level'
326    short_name = 'Lp'
327    unit = 'dB'
328    decimal_places = 4
329    frc_commands = [
330        SensorFrcCommands.FRC_2BYTES
331    ]

Sound pressure level dataclass.

type = <SensorTypes.SOUND_PRESSURE_LEVEL: 19>
name = 'Sound pressure level'
short_name = 'Lp'
unit = 'dB'
decimal_places = 4
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class Altitude:
334@dataclass
335class Altitude:
336    """Altitude dataclass."""
337
338    type = SensorTypes.ALTITUDE
339    name = 'Altitude'
340    short_name = 'h'
341    unit = 'm'
342    decimal_places = 2
343    frc_commands = [
344        SensorFrcCommands.FRC_2BYTES
345    ]

Altitude dataclass.

type = <SensorTypes.ALTITUDE: 20>
name = 'Altitude'
short_name = 'h'
unit = 'm'
decimal_places = 2
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class Acceleration:
348@dataclass
349class Acceleration:
350    """Acceleration dataclass."""
351
352    types = SensorTypes.ACCELERATION
353    name = 'Acceleration'
354    short_name = 'a'
355    unit = 'm/s2'
356    decimal_places = 8
357    frc_commands = [
358        SensorFrcCommands.FRC_2BYTES
359    ]

Acceleration dataclass.

types = <SensorTypes.ACCELERATION: 21>
name = 'Acceleration'
short_name = 'a'
unit = 'm/s2'
decimal_places = 8
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class NH3:
362@dataclass
363class NH3:
364    """Ammonia dataclass."""
365
366    types = SensorTypes.NH3
367    name = 'Ammonia'
368    short_name = 'NH3'
369    unit = 'ppm'
370    decimal_places = 1
371    frc_commands = [
372        SensorFrcCommands.FRC_2BYTES
373    ]

Ammonia dataclass.

types = <SensorTypes.NH3: 22>
name = 'Ammonia'
short_name = 'NH3'
unit = 'ppm'
decimal_places = 1
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class Methane:
376@dataclass
377class Methane:
378    """Methane dataclass."""
379
380    type = SensorTypes.METHANE
381    name = 'Methane'
382    short_name = 'CH4'
383    unit = '%'
384    decimal_places = 3
385    frc_commands = [
386        SensorFrcCommands.FRC_2BYTES
387    ]

Methane dataclass.

type = <SensorTypes.METHANE: 23>
name = 'Methane'
short_name = 'CH4'
unit = '%'
decimal_places = 3
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class ShortLength:
390@dataclass
391class ShortLength:
392    """Short length dataclass."""
393
394    type = SensorTypes.SHORT_LENGTH
395    name = 'Short length'
396    short_name = 'l'
397    unit = 'm'
398    decimal_places = 3
399    frc_commands = [
400        SensorFrcCommands.FRC_2BYTES
401    ]

Short length dataclass.

type = <SensorTypes.SHORT_LENGTH: 24>
name = 'Short length'
short_name = 'l'
unit = 'm'
decimal_places = 3
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class ParticulatesPM1:
404@dataclass
405class ParticulatesPM1:
406    """Particulates PM1 dataclass."""
407
408    type = SensorTypes.PARTICULATES_PM1
409    name = 'Particulates PM1'
410    short_name = 'PM1'
411    unit = 'µg/m3'
412    decimal_places = 2
413    frc_commands = [
414        SensorFrcCommands.FRC_2BYTES
415    ]

Particulates PM1 dataclass.

type = <SensorTypes.PARTICULATES_PM1: 25>
name = 'Particulates PM1'
short_name = 'PM1'
unit = 'µg/m3'
decimal_places = 2
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class ParticulatesPM4:
418@dataclass
419class ParticulatesPM4:
420    """Particulates PM4 dataclass."""
421
422    type = SensorTypes.PARTICULATES_PM4
423    name = 'Particulates PM4'
424    short_name = 'PM4'
425    unit = 'µg/m3'
426    decimal_places = 2
427    frc_commands = [
428        SensorFrcCommands.FRC_2BYTES
429    ]

Particulates PM4 dataclass.

type = <SensorTypes.PARTICULATES_PM4: 26>
name = 'Particulates PM4'
short_name = 'PM4'
unit = 'µg/m3'
decimal_places = 2
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class ParticulatesPM10:
432@dataclass
433class ParticulatesPM10:
434    """Particulates PM10 dataclass."""
435
436    type = SensorTypes.PARTICULATES_PM10
437    name = 'Particulates PM10'
438    short_name = 'PM10'
439    unit = 'µg/m3'
440    decimal_places = 2
441    frc_commands = [
442        SensorFrcCommands.FRC_2BYTES
443    ]

Particulates PM10 dataclass.

type = <SensorTypes.PARTICULATES_PM10: 27>
name = 'Particulates PM10'
short_name = 'PM10'
unit = 'µg/m3'
decimal_places = 2
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class TVOC:
446@dataclass
447class TVOC:
448    """Total volatile organic compound dataclass."""
449
450    type = SensorTypes.TVOC
451    name = 'Total volatile organic compound'
452    short_name = 'TVOC'
453    unit = 'µg/m3'
454    decimal_places = 0
455    frc_commands = [
456        SensorFrcCommands.FRC_2BYTES
457    ]

Total volatile organic compound dataclass.

type = <SensorTypes.TVOC: 28>
name = 'Total volatile organic compound'
short_name = 'TVOC'
unit = 'µg/m3'
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class NOX:
460@dataclass
461class NOX:
462    """Nitrogen oxides dataclass."""
463
464    type = SensorTypes.NOX
465    name = 'Nitrogen oxides'
466    short_name = 'NOX'
467    unit = ''
468    decimal_places = 0
469    frc_commands = [
470        SensorFrcCommands.FRC_2BYTES
471    ]

Nitrogen oxides dataclass.

type = <SensorTypes.NOX: 29>
name = 'Nitrogen oxides'
short_name = 'NOX'
unit = ''
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class ActivityConcentration:
474@dataclass
475class ActivityConcentration:
476    """Activity concentration dataclass."""
477
478    type = SensorTypes.ACTIVITY_CONCENTRATION
479    name = 'Activity concentration'
480    short_name = 'CA'
481    unit = 'Bq/m3'
482    decimal_places = 0
483    frc_commands = [
484        SensorFrcCommands.FRC_2BYTES
485    ]

Activity concentration dataclass.

type = <SensorTypes.ACTIVITY_CONCENTRATION: 30>
name = 'Activity concentration'
short_name = 'CA'
unit = 'Bq/m3'
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>]
@dataclass
class RelativeHumidity:
516@dataclass
517class RelativeHumidity:
518    """Relative humidity dataclass."""
519
520    type = SensorTypes.RELATIVE_HUMIDITY
521    name = 'Relative humidity'
522    short_name = 'RH'
523    unit = '%'
524    decimal_places = 1
525    frc_commands = [
526        SensorFrcCommands.FRC_1BYTE
527    ]

Relative humidity dataclass.

type = <SensorTypes.RELATIVE_HUMIDITY: 128>
name = 'Relative humidity'
short_name = 'RH'
unit = '%'
decimal_places = 1
frc_commands = [<SensorFrcCommands.FRC_1BYTE: 144>]
@dataclass
class BinaryData7:
530@dataclass
531class BinaryData7:
532    """Binary data 7 dataclass."""
533
534    type = SensorTypes.BINARYDATA7
535    name = 'Binary data7'
536    short_name = 'bin7'
537    unit = ''
538    decimal_places = 0
539    frc_commands = [
540        SensorFrcCommands.FRC_2BITS,
541        SensorFrcCommands.FRC_1BYTE
542    ]

Binary data 7 dataclass.

type = <SensorTypes.BINARYDATA7: 129>
name = 'Binary data7'
short_name = 'bin7'
unit = ''
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_2BITS: 16>, <SensorFrcCommands.FRC_1BYTE: 144>]
@dataclass
class PowerFactor:
545@dataclass
546class PowerFactor:
547    """Power factor dataclass."""
548
549    type = SensorTypes.POWER_FACTOR
550    name = 'Power factor'
551    short_name = 'cos θ'
552    unit = ''
553    decimal_places = 3
554    frc_commands = [
555        SensorFrcCommands.FRC_1BYTE
556    ]

Power factor dataclass.

type = <SensorTypes.POWER_FACTOR: 130>
name = 'Power factor'
short_name = 'cos θ'
unit = ''
decimal_places = 3
frc_commands = [<SensorFrcCommands.FRC_1BYTE: 144>]
@dataclass
class UVIndex:
559@dataclass
560class UVIndex:
561    """UV index dataclass."""
562
563    type = SensorTypes.UV_INDEX
564    name = 'UV index'
565    short_name = 'UV'
566    unit = ''
567    decimal_places = 3
568    frc_commands = [
569        SensorFrcCommands.FRC_1BYTE
570    ]

UV index dataclass.

type = <SensorTypes.UV_INDEX: 131>
name = 'UV index'
short_name = 'UV'
unit = ''
decimal_places = 3
frc_commands = [<SensorFrcCommands.FRC_1BYTE: 144>]
@dataclass
class PH:
573@dataclass
574class PH:
575    """PH dataclass."""
576
577    type = SensorTypes.PH
578    name = 'pH'
579    short_name = 'pH'
580    unit = ''
581    decimal_places = 4
582    frc_commands = [
583        SensorFrcCommands.FRC_1BYTE
584    ]

PH dataclass.

type = <SensorTypes.PH: 132>
name = 'pH'
short_name = 'pH'
unit = ''
decimal_places = 4
frc_commands = [<SensorFrcCommands.FRC_1BYTE: 144>]
@dataclass
class RSSI:
587@dataclass
588class RSSI:
589    """RSSI dataclass."""
590
591    type = SensorTypes.RSSI
592    name = 'RSSI'
593    short_name = 'RSSI'
594    unit = 'dBm'
595    decimal_places = 1
596    frc_commands = [
597        SensorFrcCommands.FRC_1BYTE
598    ]

RSSI dataclass.

type = <SensorTypes.RSSI: 133>
name = 'RSSI'
short_name = 'RSSI'
unit = 'dBm'
decimal_places = 1
frc_commands = [<SensorFrcCommands.FRC_1BYTE: 144>]
@dataclass
class Action:
601@dataclass
602class Action:
603    """Action dataclass."""
604
605    type = SensorTypes.ACTION
606    name = 'Action'
607    short_name = 'Action'
608    unit = ''
609    decimal_places = 0
610    frc_commands = [
611        SensorFrcCommands.FRC_1BYTE
612    ]

Action dataclass.

type = <SensorTypes.ACTION: 134>
name = 'Action'
short_name = 'Action'
unit = ''
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_1BYTE: 144>]
@dataclass
class BinaryData30:
615@dataclass
616class BinaryData30:
617    """Binary data 30 dataclass."""
618
619    type = SensorTypes.BINARYDATA30
620    name = 'Binary data30'
621    short_name = 'bin30'
622    unit = ''
623    decimal_places = 0
624    frc_commands = [
625        SensorFrcCommands.FRC_2BYTES,
626        SensorFrcCommands.FRC_4BYTES
627    ]

Binary data 30 dataclass.

type = <SensorTypes.BINARYDATA30: 160>
name = 'Binary data30'
short_name = 'bin30'
unit = ''
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_2BYTES: 224>, <SensorFrcCommands.FRC_4BYTES: 249>]
@dataclass
class Consumption:
630@dataclass
631class Consumption:
632    """Consumption dataclass."""
633
634    type = SensorTypes.CONSUMPTION
635    name = 'Consumption'
636    short_name = 'E'
637    unit = 'Wh'
638    decimal_places = 0
639    frc_commands = [
640        SensorFrcCommands.FRC_4BYTES
641    ]

Consumption dataclass.

type = <SensorTypes.CONSUMPTION: 161>
name = 'Consumption'
short_name = 'E'
unit = 'Wh'
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_4BYTES: 249>]
@dataclass
class Datetime:
644@dataclass
645class Datetime:
646    """Datetime dataclass."""
647
648    type = SensorTypes.DATETIME
649    name = 'DateTime'
650    short_name = 'DateTime'
651    unit = ''
652    decimal_places = 0
653    frc_commands = [
654        SensorFrcCommands.FRC_4BYTES
655    ]

Datetime dataclass.

type = <SensorTypes.DATETIME: 162>
name = 'DateTime'
short_name = 'DateTime'
unit = ''
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_4BYTES: 249>]
@dataclass
class TimeSpanLong:
658@dataclass
659class TimeSpanLong:
660    """Timespan long dataclass."""
661
662    type = SensorTypes.TIMESPAN_LONG
663    name = 'Timespan long'
664    short_name = 't'
665    unit = 's'
666    decimal_places = 4
667    frc_commands = [
668        SensorFrcCommands.FRC_4BYTES
669    ]

Timespan long dataclass.

type = <SensorTypes.TIMESPAN_LONG: 163>
name = 'Timespan long'
short_name = 't'
unit = 's'
decimal_places = 4
frc_commands = [<SensorFrcCommands.FRC_4BYTES: 249>]
@dataclass
class Latitude:
672@dataclass
673class Latitude:
674    """Latitude dataclass."""
675
676    type = SensorTypes.LATITUDE
677    name = 'Latitude'
678    short_name = 'LAT'
679    unit = '°'
680    decimal_places = 7
681    frc_commands = [
682        SensorFrcCommands.FRC_4BYTES
683    ]

Latitude dataclass.

type = <SensorTypes.LATITUDE: 164>
name = 'Latitude'
short_name = 'LAT'
unit = '°'
decimal_places = 7
frc_commands = [<SensorFrcCommands.FRC_4BYTES: 249>]
@dataclass
class Longitude:
686@dataclass
687class Longitude:
688    """Longitude dataclass."""
689
690    type = SensorTypes.LONGITUDE
691    name = 'Longitude'
692    short_name = 'LONG'
693    unit = '°'
694    decimal_places = 7
695    frc_commands = [
696        SensorFrcCommands.FRC_4BYTES
697    ]

Longitude dataclass.

type = <SensorTypes.LONGITUDE: 165>
name = 'Longitude'
short_name = 'LONG'
unit = '°'
decimal_places = 7
frc_commands = [<SensorFrcCommands.FRC_4BYTES: 249>]
@dataclass
class TemperatureFloat:
700@dataclass
701class TemperatureFloat:
702    """Temperature float dataclass."""
703
704    type = SensorTypes.TEMPERATURE_FLOAT
705    name = 'Temperature'
706    short_name = 'T'
707    unit = '˚C'
708    decimal_places = 7
709    frc_commands = [
710        SensorFrcCommands.FRC_4BYTES
711    ]

Temperature float dataclass.

type = <SensorTypes.TEMPERATURE_FLOAT: 166>
name = 'Temperature'
short_name = 'T'
unit = '˚C'
decimal_places = 7
frc_commands = [<SensorFrcCommands.FRC_4BYTES: 249>]
@dataclass
class Length:
714@dataclass
715class Length:
716    """Length dataclass."""
717
718    type = SensorTypes.LENGTH
719    name = 'Length'
720    short_name = 'l'
721    unit = 'm'
722    decimal_places = 7
723    frc_commands = [
724        SensorFrcCommands.FRC_4BYTES
725    ]

Length dataclass.

type = <SensorTypes.LENGTH: 167>
name = 'Length'
short_name = 'l'
unit = 'm'
decimal_places = 7
frc_commands = [<SensorFrcCommands.FRC_4BYTES: 249>]
@dataclass
class FourBytes:
728@dataclass
729class FourBytes:
730    """Four bytes dataclass."""
731
732    type = SensorTypes.FOUR_BYTES
733    name = 'Four bytes'
734    short_name = '4B'
735    unit = ''
736    decimal_places = 0
737    frc_commands = [
738        SensorFrcCommands.FRC_4BYTES
739    ]

Four bytes dataclass.

type = <SensorTypes.FOUR_BYTES: 168>
name = 'Four bytes'
short_name = '4B'
unit = ''
decimal_places = 0
frc_commands = [<SensorFrcCommands.FRC_4BYTES: 249>]
@dataclass
class DataBlock:
742@dataclass
743class DataBlock:
744    """Data block dataclass."""
745
746    type = SensorTypes.DATA_BLOCK
747    name = 'Data block'
748    short_name = 'datablock'
749    unit = ''
750    decimal_places = 0
751    frc_commands = []

Data block dataclass.

type = <SensorTypes.DATA_BLOCK: 192>
name = 'Data block'
short_name = 'datablock'
unit = ''
decimal_places = 0
frc_commands = []
def get_sensor_class(sensor_type: Union[iqrfpy.utils.sensor_constants.SensorTypes, int]):
807def get_sensor_class(sensor_type: Union[SensorTypes, int]):
808    """Return quantity class corresponding to sensor type.
809
810    Args:
811        sensor_type (Union[SensorTypes, int]): Sensor type (represents a quantity)
812
813    Returns:
814        Quantity dataclass
815    Raises:
816        UnknownSensorTypeError: Raised if sensor type is passed as integer and the value is not recognized
817        ValueError: Raised if sensor type is recognized, but corresponding quantity data is missing
818    """
819    if sensor_type not in SensorTypes:
820        raise UnknownSensorTypeError(f'Unknown or unsupported sensor type: {sensor_type}')
821    if sensor_type not in _type_classes:
822        raise ValueError(f'Quantity data not available for sensor type: {sensor_type}')
823    return _type_classes[sensor_type]

Return quantity class corresponding to sensor type.

Arguments:
  • sensor_type (Union[SensorTypes, int]): Sensor type (represents a quantity)
Returns:

Quantity dataclass

Raises:
  • UnknownSensorTypeError: Raised if sensor type is passed as integer and the value is not recognized
  • ValueError: Raised if sensor type is recognized, but corresponding quantity data is missing