Skip to content

Commit

Permalink
possible solution for pylint accepted comments
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjiU committed Oct 17, 2024
1 parent d208a8c commit 6895e44
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 96 deletions.
27 changes: 12 additions & 15 deletions mqtt_io/modules/sensor/adxl345.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
"""
ADXL345 Digital Accelerometer Sensor
"""

"""
Mandatory:
- chip_addr
Optional:
- output_g (set True if output in g). default:m*s²
Output:
- x (in m*s²)
- y (in m*s²)
- z (in m*s²)
"""

from json import dumps
from typing import cast

from ...types import CerberusSchemaType, ConfigType, SensorValueType
from . import GenericSensor

## Mandatory:
## - chip_addr
##
## Optional:
## - output_g (set True if output in g). default:m*s²
##
## Output:
## - x (in m*s²)
## - y (in m*s²)
## - z (in m*s²)


REQUIREMENTS = ("adxl345",)
CONFIG_SCHEMA: CerberusSchemaType = {
"chip_addr": {"type": 'integer', "required": True, "empty": False},
Expand Down
57 changes: 27 additions & 30 deletions mqtt_io/modules/sensor/ens160.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,38 @@
"""
ENS160 Air Quality Sensor
"""

"""
sensor_modules:
- name: ens160
module: ens160
chip_addr: 0x53
temperature_compensation: 25
humidity_compensation: 50
sensor_inputs:
- name: air_quality
module: ens160
interval: 10
digits: 0
type: aqi
- name: volatile_organic_compounds
module: ens160
interval: 10
digits: 0
type: tvoc
- name: eco2
module: ens160
interval: 10
digits: 0
type: eco2
"""

from typing import cast

from ...types import CerberusSchemaType, ConfigType
from . import GenericSensor

## Example configuration:
##sensor_modules:
## - name: ens160
## module: ens160
## chip_addr: 0x53
## temperature_compensation: 25
## humidity_compensation: 50
##
##sensor_inputs:
## - name: air_quality
## module: ens160
## interval: 10
## digits: 0
## type: aqi
##
## - name: volatile_organic_compounds
## module: ens160
## interval: 10
## digits: 0
## type: tvoc
##
## - name: eco2
## module: ens160
## interval: 10
## digits: 0
## type: eco2

DEFAULT_CHIP_ADDR = 0x53
DEFAULT_TEMPERATURE_COMPENSATION = 25
DEFAULT_HUMIDITY_COMPENSATION = 50
Expand Down
61 changes: 28 additions & 33 deletions mqtt_io/modules/sensor/flowsensor.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,38 @@
"""
Flowsensor: Generic Flow Rate Sensor
"""

"""
Example configuration:
sensor_modules:
- name: yfs201
module: flowsensor
sensor_inputs:
- name: flow_rate1
module: yfs201
pin: 0
digits: 0
interval: 10
factor: 0.2
Factor can be calculated from Pulse characteristcs (dicumentation):
From YF-S201 manual:
Pulse Characteristic: F = 7 * Q (L/MIN).
Pulse frequency (Hz) / 7.0 = flow rate in L/min
==> Factor = 7.0
From YF-DN50 manual:
Pulse Characteristic: F = 0.2 * Q (L/MIN).
Pulse frequency (Hz) / 0.2 = flow rate in L/min
==> Factor = 0.2
If you use "factor = 1", the sensor module returns the frequency in Hertz (Hz).
"""

from typing import Dict
from ...types import CerberusSchemaType, ConfigType, SensorValueType
from . import GenericSensor

## Example configuration:
##sensor_modules:
## - name: yfs201
## module: flowsensor
##
##sensor_inputs:
## - name: flow_rate1
## module: yfs201
## pin: 0
## digits: 0
## interval: 10
## factor: 0.2
##
##Factor can be calculated from Pulse characteristcs (dicumentation):
##
##From YF-S201 manual:
## Pulse Characteristic: F = 7 * Q (L/MIN).
## Pulse frequency (Hz) / 7.0 = flow rate in L/min
## ==> Factor = 7.0
##
##From YF-DN50 manual:
## Pulse Characteristic: F = 0.2 * Q (L/MIN).
## Pulse frequency (Hz) / 0.2 = flow rate in L/min
## ==> Factor = 0.2
##
##If you use "factor = 1", the sensor module returns the frequency in Hertz (Hz).


REQUIREMENTS = ("gpiozero",)


Expand Down
32 changes: 14 additions & 18 deletions mqtt_io/modules/sensor/frequencycounter.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
"""
Frequencycounter: Generic Frequency Counter
"""

"""
Example configuration:
sensor_modules:
- name: frequency
module: frequencycounter
sensor_inputs:
- name: flow_rate1
module: frequency
pin: 0
digits: 0
interval: 10
"""

from typing import Dict
from ...types import CerberusSchemaType, ConfigType, SensorValueType
from . import GenericSensor

##Example configuration:
##
##sensor_modules:
## - name: frequency
## module: frequencycounter
##
##sensor_inputs:
## - name: flow_rate1
## module: frequency
## pin: 0
## digits: 0
## interval: 10


REQUIREMENTS = ("gpiozero",)


Expand Down

0 comments on commit 6895e44

Please sign in to comment.