Skip to content

Commit

Permalink
Remove yfs201 sensor (#396)
Browse files Browse the repository at this point in the history
Also fix incorrect example config for flowsensor
  • Loading branch information
linucks authored Sep 2, 2024
1 parent 19cfb17 commit 57b1b21
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 102 deletions.
18 changes: 10 additions & 8 deletions mqtt_io/modules/sensor/flowsensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
sensor_inputs:
- name: flow_rate1
module: flowsensor
module: yfs201
pin: 0
digits: 0
interval: 10
Expand Down Expand Up @@ -45,7 +45,7 @@ class FLOWSENSOR:
Multiple instances support multiple sensors on different pins
"""

def __init__(self, gpiozero, name: str, pin: int) -> None: # type: ignore[no-untyped-def]
def __init__(self, gpiozero, name: str, pin: int) -> None: # type: ignore[no-untyped-def]
self.name = name
self.pin = gpiozero.DigitalInputDevice(pin)
self.pin.when_activated = self.count_pulse
Expand Down Expand Up @@ -75,7 +75,7 @@ def flow_rate(self, sample_window: int, factor: float) -> float:

def get_value(self, interval: int, factor: float) -> float:
"""Return flow rate in L/min over interval seconds and reset count."""
flow_rate = self.flow_rate(interval,factor)
flow_rate = self.flow_rate(interval, factor)
self.reset_count()
return flow_rate

Expand All @@ -87,20 +87,20 @@ class Sensor(GenericSensor):

SENSOR_SCHEMA: CerberusSchemaType = {
"pin": {
"type": 'integer',
"type": "integer",
"required": True,
"empty": False,
},
"interval": {
"type": 'integer',
"type": "integer",
"required": True,
"empty": False,
},
"factor": {
"type": 'float',
"type": "float",
"required": True,
"empty": False,
}
},
}

def setup_module(self) -> None:
Expand All @@ -117,4 +117,6 @@ def setup_sensor(self, sens_conf: ConfigType) -> None:
self.sensors[sensor.name] = sensor

def get_value(self, sens_conf: ConfigType) -> SensorValueType:
return self.sensors[sens_conf["name"]].get_value(sens_conf["interval"],sens_conf["factor"])
return self.sensors[sens_conf["name"]].get_value(
sens_conf["interval"], sens_conf["factor"]
)
94 changes: 0 additions & 94 deletions mqtt_io/modules/sensor/yfs201.py

This file was deleted.

0 comments on commit 57b1b21

Please sign in to comment.