Compare commits
8 Commits
111faaaaae
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9bb7b9894e | ||
|
|
2c1c9f612e | ||
| 29d35f9c16 | |||
|
|
831a8eba82 | ||
| 757d5a1671 | |||
|
|
021d0a6b9b | ||
|
|
84b02a024f | ||
|
|
fb95c7061d |
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"group": "smart_household",
|
||||
}
|
||||
|
||||
37
README.md
37
README.md
@@ -0,0 +1,37 @@
|
||||
# Veles Python package
|
||||
|
||||
This is a package for reading [Veles Smart Household](#veles-smart-household) sensors and for logging and visualizing data.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
pip install veles
|
||||
```
|
||||
|
||||
Further documentation is a work in progress :)
|
||||
|
||||
## Veles Smart Household
|
||||
|
||||
This package is part of Veles Smart Household. Goal of this project is to create open hardware and software platform for measuring various quantities, not only related to indoor air quality:
|
||||
|
||||
* temperature
|
||||
* humidity
|
||||
* atmospheric pressure
|
||||
* carbon dioxide (CO2)
|
||||
* carbon monoxide (CO)
|
||||
* volatile organic compounds (VOC)
|
||||
* particulate matter (PM - dust particles)
|
||||
* light intensity
|
||||
* soil moisture
|
||||
|
||||
... and some more!
|
||||
|
||||
Sensors are connected either via RS-485 Modbus or wirelessly to central unit. Wireless sensors are currently in development. Central unit may be any anything that can read from the bus: any computer with RS-485 to USB converter (e.g. Raspberry Pi) or an actual PLC. Readout of the sensor is possible via Modbus: either using your own favourite application or using your Python package.
|
||||
|
||||
**We want this to be community effort! Come help us make something great!**
|
||||
|
||||
### Other Smart Household repositories
|
||||
|
||||
* [RHT wired sensor](https://gitea.veleslabs.org/veles_labs/rht_sensor_wired)
|
||||
* [IAQ wired sensor](https://gitea.veleslabs.org/veles_labs/iaq_sensor_wired)
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@ DEVICE_IDENTIFIERS: Final[Dict[int, Device]] = {
|
||||
T = TypeVar("T", bound=Device)
|
||||
|
||||
|
||||
def find_devices(device_cls: Type[T], address_space: Iterable[Any]) -> list[T]:
|
||||
def find_devices(device_cls: Type[T], address_space: Iterable[Any], dev="/dev/rs485", baudrate=19200) -> list[T]:
|
||||
"""
|
||||
Look for devices in given address space
|
||||
"""
|
||||
return list(filter(device_cls.probe, address_space))
|
||||
return list(filter(lambda x: device_cls.probe(x,dev,baudrate), address_space))
|
||||
|
||||
# TODO add device args
|
||||
|
||||
@@ -53,15 +53,16 @@ class Device(ABC):
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def probe(cls, address) -> bool:
|
||||
def probe(cls, address, dev="/dev/rs485", baudrate=19200) -> bool:
|
||||
"""
|
||||
Probe given address, return True if device detected,
|
||||
False otherwise
|
||||
"""
|
||||
# try instantiating; this raises NoResponseError
|
||||
# if device not detected
|
||||
print(f'Probing address {address}')
|
||||
try:
|
||||
_ = cls(address)
|
||||
_ = cls(address,dev,baudrate)
|
||||
except NoResponseError:
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -83,7 +83,7 @@ class SensorWiredIAQ(ModbusRTUDevice):
|
||||
deleted_registers = list(filter(lambda x: sensor in x, self.input_registers))
|
||||
_ = list((self.input_registers.pop(x) for x in deleted_registers))
|
||||
|
||||
def __init__(self, modbus_address, baudrate=19200, dev="/dev/rs485"):
|
||||
def __init__(self, modbus_address, dev="/dev/rs485", baudrate=19200):
|
||||
super().__init__(modbus_address, baudrate, dev)
|
||||
# detect sensor configuration and modify input_registers accordingly
|
||||
# Check if VOC sensor present
|
||||
|
||||
Reference in New Issue
Block a user