Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new MicroPython driver package for the Würth Elektronik WSEN-HIDS (2525020210001) humidity/temperature sensor, including a public API, constants, examples, and documentation, following the repository’s driver-per-sensor layout.
Changes:
- Introduces the
wsen_hidsdriver implementation (I²C register access, calibration reading, one-shot and continuous measurement). - Adds package metadata (
manifest.py), module exports, and custom exception types. - Adds README and multiple example scripts, including a more extensive
test.pyvalidation script.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/wsen-hids/wsen_hids/device.py | Core driver logic: configuration, status helpers, raw reads, conversions, one-shot and continuous modes |
| lib/wsen-hids/wsen_hids/const.py | Register map and bit definitions, plus averaging/timeout defaults |
| lib/wsen-hids/wsen_hids/exceptions.py | Driver-specific exception hierarchy |
| lib/wsen-hids/wsen_hids/init.py | Public module export for WSEN_HIDS |
| lib/wsen-hids/manifest.py | Package metadata and package declaration |
| lib/wsen-hids/examples/continuous_mode.py | Example for continuous measurement usage |
| lib/wsen-hids/examples/oneShot_mode.py | Example for one-shot measurement usage |
| lib/wsen-hids/examples/test.py | Manual validation/test script for sensor + driver behavior |
| lib/wsen-hids/README.md | Driver documentation and usage overview |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nedseb
left a comment
There was a problem hiding this comment.
Code Review
Corrections appliquées (39798bd)
const.py: ajout demicropython.const()— Toutes les constantes utilisent maintenantconst()pour réduire l'usage RAM sur MicroPython, conformément à la convention du projet.manifest.py— Description corrigée : "Driver of" → "Driver for the" (cohérence avec les autres drivers).
Points déjà corrigés par Charly (dadcf87)
- ✅ Renommage
oneShot_mode.py→one_shot_mode.py - ✅ Suppression imports
Pininutiles dans les 3 exemples - ✅ Traduction commentaires français → anglais (
device.py,test.py) - ✅ README :
example1.py→continuous_mode.py - ✅ Suppression
_buffer_2/_buffer_4inutilisés - ✅ Correction commentaire AVG_H_DEFAULT (32 → 16 samples)
- ✅ Déplacement
DEFAULT_ONE_SHOT_TIMEOUT_MS/DEFAULT_BOOT_TIME_MSdans la classe
Remarques (non bloquantes)
examples/test.pyest un script de test exhaustif (~300 lignes). Un renommage enfull_test.pypourrait clarifier son rôle par rapport aux exemples d'usage (one_shot_mode.py,continuous_mode.py).read()en mode power-down : après l'init, le capteur est en mode one-shot etread()lit les registres sans déclencher de conversion. Un utilisateur qui appellesensor.read()directement après init obtiendra les dernières données en mémoire. Ce comportement est acceptable mais mériterait une note dans le README ou la docstring.
Tests
Tous les tests passent (mock + hardware) :
- Mock : humidity 50.00 %RH, temperature 25.00 °C ✅
- Hardware : humidity 36.17 %RH, temperature 20.30 °C ✅
|
Complément à la revue : le point sur |
|
🎉 This PR is included in version 0.0.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Resolves #6
Add WSEN-HIDS MicroPython Driver
This PR adds a MicroPython driver for the Würth Elektronik WSEN-HIDS humidity and temperature sensor.
The driver provides an easy-to-use interface for reading relative humidity and temperature via I²C and follows the structure used by the other drivers in this repository.
The implementation targets the WSEN-HIDS 2525020210001 sensor.
Features
Driver Structure
The structure follows the layout used by other drivers in micropython-steami-lib.
API Overview
Initialization:
Read humidity and temperature:
One-shot measurement:
Continuous mode:
Additional features: