Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
All notable changes to this project are documented here. The format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow [Semantic Versioning](https://semver.org/).

## [2.0.2] - 2026-09-29

### Fixed

- `RadioPacket.dbm` is `None` for telegrams to send (those built by `RadioPacket.create()`, the actuators and UTE
teach-in responses), instead of -255: their dBm byte is 0xFF, which ESP3 uses when sending, not a signal strength.
This also fixes `to_dict()`, the `dbm` field of the `Sending` log, and `str(packet)`, which no longer shows a signal
strength when there is none.

## [2.0.1] - 2026-09-29

### Fixed
Expand Down Expand Up @@ -139,6 +148,7 @@ First release of the [j5lien/enocean](https://github.com/j5lien/enocean) fork of

Last release of [kipe/enocean](https://github.com/kipe/enocean).

[2.0.2]: https://github.com/j5lien/enocean/compare/2.0.1...2.0.2
[2.0.1]: https://github.com/j5lien/enocean/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/j5lien/enocean/compare/1.0.0...2.0.0
[1.0.0]: https://github.com/j5lien/enocean/compare/0.60.1...1.0.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ This is a maintained fork of [kipe/enocean](https://github.com/kipe/enocean), wh
Requires Python 3.10 or later.

```bash
pip install git+https://github.com/j5lien/enocean.git@2.0.1
pip install git+https://github.com/j5lien/enocean.git@2.0.2
# or, in a uv-managed project
uv add git+https://github.com/j5lien/enocean.git --tag 2.0.1
uv add git+https://github.com/j5lien/enocean.git --tag 2.0.2
```

Wheels are also attached to each [GitHub release](https://github.com/j5lien/enocean/releases); see
Expand Down
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,4 @@ aujourd'hui) ; on **s'aligne sur les noms officiels** des champs (version 2.0).
et trames réelles en tests CI (PTM 210 F6-02-02, SIN-2-2-01 D2-01-12)
- [x] Release 2.0.0 : profils officiels, API d'intégration, supervision, documentation
- [x] Release 2.0.1 : `status` et `repeater_count` des télégrammes VLD (lus dans le niveau de sécurité)
- [x] Release 2.0.2 : `dbm` à `None` au lieu de -255 pour les télégrammes à envoyer
6 changes: 3 additions & 3 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
## Installation

```bash
pip install git+https://github.com/j5lien/enocean.git@2.0.1
pip install git+https://github.com/j5lien/enocean.git@2.0.2
# or, in a uv-managed project
uv add git+https://github.com/j5lien/enocean.git --tag 2.0.1
uv add git+https://github.com/j5lien/enocean.git --tag 2.0.2
# with Prometheus metrics
pip install "enocean[prometheus] @ git+https://github.com/j5lien/enocean.git@2.0.1"
pip install "enocean[prometheus] @ git+https://github.com/j5lien/enocean.git@2.0.2"
```

## Finding the module's serial port
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ actuators…) through an EnOcean USB/serial module (e.g. USB 300) or a TCP bridg
It requires Python 3.10 or later, and has one dependency: `pyserial`.

```bash
pip install git+https://github.com/j5lien/enocean.git@2.0.1
pip install git+https://github.com/j5lien/enocean.git@2.0.2
```

```python
Expand Down
8 changes: 6 additions & 2 deletions enocean/protocol/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ class RadioPacket(Packet):
"""A radio telegram (ERP1).

Attributes set when parsing: `sender` / `destination` (4-byte IDs, also as `sender_hex` / `destination_hex`),
`dbm` (signal strength of the received telegram, None if the module didn't report it) and `learn`.
`dbm` (signal strength of the received telegram, None if the module didn't report it and for telegrams to send)
and `learn`.

`learn` tells whether the telegram can be used to teach the device in. 1BS and 4BS telegrams carry a learn bit,
UTE telegrams a teach-in request; RPS and VLD telegrams have no learn bit, so `learn` is always True for them:
Expand All @@ -518,6 +519,8 @@ class RadioPacket(Packet):

def __str__(self) -> str:
packet_str = super().__str__()
if self.dbm is None:
return '%s->%s: %s' % (self.sender_hex, self.destination_hex, packet_str)
return '%s->%s (%s dBm): %s' % (self.sender_hex, self.destination_hex, self.dbm, packet_str)

@property
Expand Down Expand Up @@ -588,7 +591,8 @@ def parse(self) -> OrderedDict[str, FieldValue]:
# Optional data (sub-telegram count, destination, dBm, security level) may be omitted
if len(self.optional) >= 6:
self.destination = self.optional[1:5]
self.dbm = -self.optional[5]
# 0xFF is what telegrams to send carry (e.g. those built by create()): not a signal strength
self.dbm = None if self.optional[5] == 0xFF else -self.optional[5]
self.sender = self.data[-5:-1]
# RPS and VLD have no learn bit: any of their telegrams may be used for teach-in
self.learn = True
Expand Down
20 changes: 20 additions & 0 deletions enocean/protocol/tests/test_packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,23 @@ def test_dbm_and_deprecated_dBm(): # noqa: N802
with pytest.warns(DeprecationWarning):
assert packet.dBm == -58
assert RadioPacket(PACKET.RADIO_ERP1, [RORG.RPS, 0x10, 1, 2, 3, 4, 0x30], []).dbm is None
assert RadioPacket(PACKET.RADIO_ERP1, [RORG.RPS, 0x10, 1, 2, 3, 4, 0x30], [0x01, 0xFF, 0xFF]).dbm is None
assert str(packet).startswith('01:02:03:04->FF:FF:FF:FF (-58 dBm): ')


def test_no_dbm_on_telegrams_to_send():
"""Telegrams to send carry 0xFF in place of the signal strength (ESP3), not -255 dBm."""
packet = RadioPacket.create(
rorg=RORG.VLD,
rorg_func=0x01,
rorg_type=0x12,
command=1,
destination=[0x05, 0x99, 0x77, 0xAF],
sender=[0xFF, 0xF5, 0xB4, 0x80],
IO=1,
OV=100,
)
assert packet.optional[5] == 0xFF
assert packet.dbm is None
assert packet.to_dict()['dbm'] is None
assert str(packet).startswith('FF:F5:B4:80->05:99:77:AF: ')
1 change: 1 addition & 0 deletions enocean/protocol/tests/test_real_frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def test_d2_01_12_actuator_status(payload, output):
packet, values = decode(radio_frame(RORG.VLD, payload, OFFICE_LIGHT, 0x00, -73), 0x01, 0x12, command=4)

assert packet.sender_hex == '05:99:77:AF'
assert packet.dbm == -73
assert packet.command == 4
assert values['IO'] == 'Output channel (to load): 1'
assert values['OV'] == output
Expand Down
1 change: 1 addition & 0 deletions enocean/protocol/tests/test_teachin.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def test_ute_in():
response_packet = packet.create_response_packet(communicator.base_id)
assert response_packet.sender_hex == 'DE:AD:BE:EF'
assert response_packet.destination_hex == '01:94:E3:B9'
assert response_packet.dbm is None
assert response_packet._bit_data[DB6.BIT_5 : DB6.BIT_3] == [False, True]
assert response_packet.data[2:7] == packet.data[2:7]

Expand Down
2 changes: 2 additions & 0 deletions enocean/tests/test_actuators.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def test_switch_turn_on_matches_a_real_controller(communicator):
assert payload == [0x01, 0x01, 0x64]
assert packet.sender_hex == 'FF:C3:6F:80'
assert packet.optional[1:5] == [0x05, 0x99, 0x77, 0xAF]
assert packet.dbm is None
assert packet.to_dict()['dbm'] is None


def test_switch_commands(communicator):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "enocean"
version = "2.0.1"
version = "2.0.2"
description = "EnOcean serial protocol (ESP3) and equipment profiles (EEP) implementation"
readme = "README.md"
classifiers = [
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading