From 6895e44a1b2dc4cfc5d53e7c36cf97caedc676ab Mon Sep 17 00:00:00 2001 From: benjamin Date: Thu, 17 Oct 2024 23:05:22 +0200 Subject: [PATCH] possible solution for pylint accepted comments --- mqtt_io/modules/sensor/adxl345.py | 27 +++++----- mqtt_io/modules/sensor/ens160.py | 57 ++++++++++---------- mqtt_io/modules/sensor/flowsensor.py | 61 ++++++++++------------ mqtt_io/modules/sensor/frequencycounter.py | 32 +++++------- 4 files changed, 81 insertions(+), 96 deletions(-) diff --git a/mqtt_io/modules/sensor/adxl345.py b/mqtt_io/modules/sensor/adxl345.py index b706ff83..9d50f39c 100644 --- a/mqtt_io/modules/sensor/adxl345.py +++ b/mqtt_io/modules/sensor/adxl345.py @@ -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}, diff --git a/mqtt_io/modules/sensor/ens160.py b/mqtt_io/modules/sensor/ens160.py index d06bceba..dc0862e7 100644 --- a/mqtt_io/modules/sensor/ens160.py +++ b/mqtt_io/modules/sensor/ens160.py @@ -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 diff --git a/mqtt_io/modules/sensor/flowsensor.py b/mqtt_io/modules/sensor/flowsensor.py index e54d2a10..43553d54 100644 --- a/mqtt_io/modules/sensor/flowsensor.py +++ b/mqtt_io/modules/sensor/flowsensor.py @@ -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",) diff --git a/mqtt_io/modules/sensor/frequencycounter.py b/mqtt_io/modules/sensor/frequencycounter.py index 914b9ee1..1e7de92d 100644 --- a/mqtt_io/modules/sensor/frequencycounter.py +++ b/mqtt_io/modules/sensor/frequencycounter.py @@ -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",)