Skip to content

Commit d468fff

Browse files
committed
rename sensors
1 parent ee99f7a commit d468fff

24 files changed

+135
-135
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"mqttpassword",
4848
"mqttuser",
4949
"pmsa",
50+
"pmsx",
5051
"pwsh",
5152
"senserion"
5253
],

src/pms/sensor/aq/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import mcu680

src/pms/sensor/aq/MCU680.py renamed to src/pms/sensor/bosch_sensortec/mcu680.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222
class Message(base.Message):
23-
"""Messages from MCU680 modules with a BME680 sensor"""
23+
"""Messages from mcu680 modules with a BME680 sensor"""
2424

2525
data_records = slice(7)
2626

src/pms/sensor/honeywell/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import hpma115s0, hpma115c0

src/pms/sensor/pm/HPMA115C0.py renamed to src/pms/sensor/honeywell/hpma115c0.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
from dataclasses import dataclass, field
88

99
from pms.sensor import base
10-
from . import HPMA115S0
10+
from . import hpma115s0
1111

12-
commands = HPMA115S0.commands._replace(
12+
commands = hpma115s0.commands._replace(
1313
passive_read=base.Cmd( # Read Particle Measuring Results
1414
b"\x68\x01\x04\x93", b"\x40\x05\x04", 16
1515
)
1616
)
1717

1818

19-
class Message(HPMA115S0.Message):
19+
class Message(hpma115s0.Message):
2020
"""Messages from Honeywell HPMA115C0 sensors"""
2121

2222
data_records = slice(4)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import sds01x, sds198
File renamed without changes.

src/pms/sensor/pm/SDS198.py renamed to src/pms/sensor/novafitness/sds198.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
from dataclasses import dataclass, field
88

99
from pms.sensor import base
10-
from . import SDS01x
10+
from . import sds01x
1111

12-
commands = SDS01x.commands._replace(
12+
commands = sds01x.commands._replace(
1313
passive_read=base.Cmd(
1414
b"\xAA\xB4\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\x02\xAB",
1515
b"\xAA\xCF",
@@ -18,7 +18,7 @@
1818
)
1919

2020

21-
class Message(SDS01x.Message):
21+
class Message(sds01x.Message):
2222
"""Messages from NovaFitness SDS011, SDS018 and SDS021 sensors"""
2323

2424
data_records = slice(1, 2)

src/pms/sensor/plantower/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import pmsx003, pms3003, pms5003s, pms5003st, pms5003t
File renamed without changes.

src/pms/sensor/pm/PMS5003S.py renamed to src/pms/sensor/plantower/pms5003s.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@
77
from dataclasses import dataclass, field
88

99
from pms.sensor import base
10-
from . import PMS3003, PMSx003
10+
from . import pms3003, pmsx003
1111

1212

13-
commands = PMSx003.commands
13+
commands = pmsx003.commands
1414

1515

16-
class Message(PMS3003.Message):
16+
class Message(pms3003.Message):
1717
"""Messages from Plantower PMS5003S sensors"""
1818

1919
data_records = slice(13)
2020

2121

2222
@dataclass(frozen=False)
23-
class ObsData(PMSx003.ObsData):
23+
class ObsData(pmsx003.ObsData):
2424
"""Observations from Plantower PMS5003S sensors
2525
2626
time measurement time [seconds since epoch]

src/pms/sensor/pm/PMS5003ST.py renamed to src/pms/sensor/plantower/pms5003st.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
import struct
1010

1111
from pms.sensor import base
12-
from . import PMS3003, PMSx003, PMS5003S
12+
from . import pms3003, pmsx003, pms5003s
1313

1414

1515
commands = base.Commands(
16-
passive_read=base.Cmd(PMSx003.commands.passive_read.command, b"\x42\x4D\x00\x24", 40),
17-
passive_mode=PMSx003.commands.passive_mode,
18-
active_mode=base.Cmd(PMSx003.commands.active_mode.command, b"\x42\x4D\x00\x24", 40),
19-
sleep=PMSx003.commands.sleep,
20-
wake=base.Cmd(PMSx003.commands.wake.command, b"\x42\x4D\x00\x24", 40),
16+
passive_read=base.Cmd(pmsx003.commands.passive_read.command, b"\x42\x4D\x00\x24", 40),
17+
passive_mode=pmsx003.commands.passive_mode,
18+
active_mode=base.Cmd(pmsx003.commands.active_mode.command, b"\x42\x4D\x00\x24", 40),
19+
sleep=pmsx003.commands.sleep,
20+
wake=base.Cmd(pmsx003.commands.wake.command, b"\x42\x4D\x00\x24", 40),
2121
)
2222

2323

24-
class Message(PMS3003.Message):
24+
class Message(pms3003.Message):
2525
"""Messages from Plantower PMS5003ST sensors"""
2626

2727
data_records = slice(15)
@@ -32,11 +32,11 @@ def _unpack(message: bytes) -> Tuple[int, ...]:
3232
# 14th record is signed (temp)
3333
return struct.unpack(f">13Hh3H", message)
3434
else:
35-
return PMS3003.Message._unpack(message)
35+
return pms3003.Message._unpack(message)
3636

3737

3838
@dataclass(frozen=False)
39-
class ObsData(PMS5003S.ObsData):
39+
class ObsData(pms5003s.ObsData):
4040
"""Observations from Plantower PMS5003ST sensors
4141
4242
time measurement time [seconds since epoch]

src/pms/sensor/pm/PMS5003T.py renamed to src/pms/sensor/plantower/pms5003t.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010

1111
from pms import InconsistentObservation
1212
from pms.sensor import base
13-
from . import PMS3003, PMSx003
13+
from . import pms3003, pmsx003
1414

1515

16-
commands = PMSx003.commands
16+
commands = pmsx003.commands
1717

1818

19-
class Message(PMS3003.Message):
19+
class Message(pms3003.Message):
2020
"""Messages from Plantower PMS5003T sensors"""
2121

2222
data_records = slice(12)
@@ -27,11 +27,11 @@ def _unpack(message: bytes) -> Tuple[int, ...]:
2727
# 11th record is signed (temp)
2828
return struct.unpack(">10Hh2H", message)
2929
else:
30-
return PMS3003.Message._unpack(message)
30+
return pms3003.Message._unpack(message)
3131

3232

3333
@dataclass(frozen=False)
34-
class ObsData(PMS3003.ObsData):
34+
class ObsData(pms3003.ObsData):
3535
"""Observations from Plantower PMS5003T sensors
3636
3737
time measurement time [seconds since epoch]

src/pms/sensor/pm/PMSx003.py renamed to src/pms/sensor/plantower/pmsx003.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from pms import InconsistentObservation
99
from pms.sensor import base
10-
from . import PMS3003
10+
from . import pms3003
1111

1212

1313
commands = base.Commands(
@@ -19,14 +19,14 @@
1919
)
2020

2121

22-
class Message(PMS3003.Message):
22+
class Message(pms3003.Message):
2323
"""Messages from Plantower PMS1003, PMS5003, PMS7003 and PMSA003 sensors"""
2424

2525
data_records = slice(12)
2626

2727

2828
@dataclass(frozen=False)
29-
class ObsData(PMS3003.ObsData):
29+
class ObsData(pms3003.ObsData):
3030
"""Observations from Plantower PMS1003, PMS5003, PMS7003 and PMSA003 sensors
3131
3232
time measurement time [seconds since epoch]

src/pms/sensor/pm/__init__.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/pms/sensor/senserion/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import sps30
File renamed without changes.

src/pms/sensor/sensor.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
from enum import Enum
77

88
from pms import WrongMessageFormat
9-
from pms.sensor import base, pm, aq
9+
from pms.sensor import base, plantower, novafitness, honeywell, senserion, bosch_sensortec
1010

1111

1212
class Sensor(Enum):
1313
"""Supported PM sensors"""
1414

15-
PMSx003 = pm.PMSx003
16-
PMS3003 = pm.PMS3003
17-
PMS5003S = pm.PMS5003S
18-
PMS5003ST = pm.PMS5003ST
19-
PMS5003T = pm.PMS5003T
20-
SDS01x = pm.SDS01x
21-
SDS198 = pm.SDS198
22-
HPMA115S0 = pm.HPMA115S0
23-
HPMA115C0 = pm.HPMA115C0
24-
SPS30 = pm.SPS30
25-
MCU680 = aq.MCU680
15+
PMSx003 = plantower.pmsx003
16+
PMS3003 = plantower.pms3003
17+
PMS5003S = plantower.pms5003s
18+
PMS5003ST = plantower.pms5003st
19+
PMS5003T = plantower.pms5003t
20+
SDS01x = novafitness.sds01x
21+
SDS198 = novafitness.sds198
22+
HPMA115S0 = honeywell.hpma115s0
23+
HPMA115C0 = honeywell.hpma115c0
24+
SPS30 = senserion.sps30
25+
MCU680 = bosch_sensortec.mcu680
2626

2727
PMS1003 = PMS5003 = PMS7003 = PMSA003 = PMSx003
2828
G1, G3, G5, G7, G10 = PMS1003, PMS3003, PMS5003, PMS7003, PMSA003

tests/sensor/test_extra_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import pytest
33

44
os.environ["LEVEL"] = "DEBUG"
5-
from pms.sensor.pm.extra_commands import SDS, HPMA
5+
from pms.sensor.novafitness.extra_commands import SDS, HPMA
66

77

88
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)