Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
linucks committed Aug 5, 2024
1 parent c5da962 commit 6af0df9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions mqtt_io/modules/sensor/dfr0300.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,15 @@ def setup_sensor(self, sens_conf: ConfigType, event_bus: EventBus) -> None:
_LOG.info("dfr0300: No temperature sensor configured")
return

def on_sensor_read(data: SensorReadEvent) -> None:
"""Callback for sensor read event"""
if data.sensor_name == sens_conf[TEMPSENSOR_ID] and data.value is not None:
self.temperature = data.value
async def on_sensor_read(event: SensorReadEvent) -> None:
"""Callback for sensor read event
Sets self.temperature from the temperature sensor
"""
if (
event.sensor_name == sens_conf[TEMPSENSOR_ID]
and event.value is not None
):
self.temperature = event.value

event_bus.subscribe(SensorReadEvent, on_sensor_read)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def set_adc_disable(self) -> None:
"""
self._write_bytes(self._REG_ADC_CTRL, [0x00])

def get_adc_value(self, chan: int) -> Union[List[float], float]:
def get_adc_value(self, chan: int) -> float:
"""
Return the ADC value for the given channel.
"""
Expand Down

0 comments on commit 6af0df9

Please sign in to comment.