dmamontov / esphome-blekeyboard

ESPHome BLE Keyboard
https://community.home-assistant.io/t/esphome-ble-keyboard/
84 stars 16 forks source link

Added RSSI sensor #26

Open muxa opened 1 year ago

muxa commented 1 year ago

This adds ability to add a signal strength sensor for the BLE connection (for feature request https://github.com/dmamontov/esphome-blekeyboard/issues/25). The sensor is not exposed by default and can be added via rssi: configuration, e.g:

ble_keyboard:
  ...
  rssi:
    name: "RSSI"
sourcery-ai[bot] commented 1 year ago

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.40%.

Quality metrics Before After Change
Complexity 1.38 ⭐ 1.35 ⭐ -0.03 👍
Method Length 177.62 😞 172.29 😞 -5.33 👍
Working memory 12.84 😞 14.72 😞 1.88 👎
Quality 63.71% 🙂 63.31% 🙂 -0.40% 👎
Other metrics Before After Change
Lines 1044 1078 34
Changed files Quality Before Quality After Quality Change
components/ble_keyboard/__init__.py 74.47% 🙂 74.93% 🙂 0.46% 👍
components/ble_keyboard/const.py 35.25% 😞 34.08% 😞 -1.17% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
components/ble_keyboard/__init__.py ble_keyboard_press_to_code 2 ⭐ 125 😞 8 🙂 68.04% 🙂 Try splitting into smaller methods
components/ble_keyboard/__init__.py ble_keyboard_combination_to_code 0 ⭐ 132 😞 8 🙂 69.20% 🙂 Try splitting into smaller methods

Legend and Explanation

The emojis denote the absolute quality of the code:

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!