Skip to content

Add support for DFRobot DFR0300 EC sensor (using DFRobot DFR0566 Raspberry PI expansion HAT) #425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix function call
  • Loading branch information
linucks committed Sep 3, 2024
commit 056fd4c9aa39032f4619f6f8ff074d1c4d9dc7aa
12 changes: 7 additions & 5 deletions mqtt_io/modules/sensor/frequencycounter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"""

from typing import Dict

from mqtt_io.events import EventBus
from ...types import CerberusSchemaType, ConfigType, SensorValueType
from . import GenericSensor

Expand All @@ -30,7 +32,7 @@ class FREQUENCYCOUNTER:
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 @@ -65,15 +67,15 @@ class Sensor(GenericSensor):

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

def setup_module(self) -> None:
Expand All @@ -83,7 +85,7 @@ def setup_module(self) -> None:
self.gpiozero = gpiozero
self.sensors: Dict[str, FREQUENCYCOUNTER] = {}

def setup_sensor(self, sens_conf: ConfigType) -> None:
def setup_sensor(self, sens_conf: ConfigType, event_bus: EventBus) -> None:
sensor = FREQUENCYCOUNTER(
gpiozero=self.gpiozero, name=sens_conf["name"], pin=sens_conf["pin"]
)
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy