Skip to content

Add LD2410 BLE integration#83883

Merged
bdraco merged 13 commits into
home-assistant:devfrom
930913:add_ld2410_ble_integration
Jan 6, 2023
Merged

Add LD2410 BLE integration#83883
bdraco merged 13 commits into
home-assistant:devfrom
930913:add_ld2410_ble_integration

Conversation

@930913
Copy link
Copy Markdown
Contributor

@930913 930913 commented Dec 12, 2022

Proposed change

Adds an MVP integration to connect to LD2410B sensors over bluetooth. This was the mmWave sensor demonstrated by Andreas Spiess at https://www.youtube.com/watch?v=dAzHXpP3FcI

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • [n/a] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link
Copy Markdown
Contributor

Hi 930913

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

- Add integration
- Add config flow
- Add binary_sensor
- Add tests
- Update CODEOWNERS
- Add return types
- Raise errors from previous error
- Rm unneeded log
Add type notation to missing places in binary_sensor
update -> initialise
@930913 930913 force-pushed the add_ld2410_ble_integration branch from af67cba to 7e4cf3b Compare December 13, 2022 16:09
@930913 930913 marked this pull request as ready for review December 13, 2022 16:41
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py Outdated
Comment thread homeassistant/components/ld2410_ble/translations/ca.json Outdated
- Use BinarySensorEntityDescription
- Remove lokalized languages
- Remove dupe async_add_entities call
@930913 930913 requested a review from bdraco December 13, 2022 23:34
Comment thread homeassistant/components/ld2410_ble/__init__.py Outdated
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py Outdated
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py Outdated
Also catch all BleakError
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py Outdated
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py Outdated
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py Outdated
Comment thread homeassistant/components/ld2410_ble/__init__.py Outdated
And don't concatenate f strings.
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py Outdated
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py Outdated
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py Outdated
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py Outdated
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py Outdated
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py Outdated
Comment thread homeassistant/components/ld2410_ble/binary_sensor.py Outdated
Comment thread homeassistant/components/ld2410_ble/const.py Outdated
Comment thread homeassistant/components/ld2410_ble/const.py Outdated
Comment thread homeassistant/components/ld2410_ble/manifest.json Outdated
Use the entity description to get the key
Track connectivity on the coordinator and return availiblity accordingly.
Forgot to add it, lol.
Comment thread homeassistant/components/ld2410_ble/manifest.json
@bdraco
Copy link
Copy Markdown
Member

bdraco commented Dec 15, 2022

This looks like its pretty close to ready. I just need to find time to do another review pass after I've had enough sleep to be sure 😄

@930913
Copy link
Copy Markdown
Contributor Author

930913 commented Dec 19, 2022

This looks like its pretty close to ready. I just need to find time to do another review pass after I've had enough sleep to be sure smile

@bdraco How has your sleeping been? 😆

@bdraco
Copy link
Copy Markdown
Member

bdraco commented Dec 19, 2022

Not as well as I had hoped. This is still on my list to get done

@bdraco bdraco self-requested a review December 19, 2022 00:41
Comment on lines +20 to +33
ENTITY_DESCRIPTIONS = [
BinarySensorEntityDescription(
key="is_moving",
device_class=BinarySensorDeviceClass.MOTION,
has_entity_name=True,
name="Motion",
),
BinarySensorEntityDescription(
key="is_static",
device_class=BinarySensorDeviceClass.OCCUPANCY,
has_entity_name=True,
name="Occupancy",
),
]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR: This could be a tuple since it never changes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted. I might change it in a subsequent MR.

Copy link
Copy Markdown
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@bdraco
Copy link
Copy Markdown
Member

bdraco commented Dec 19, 2022

Looks like there is some feedback on the docs PR to address: home-assistant/home-assistant.io#25264

@bdraco bdraco merged commit 2507ec1 into home-assistant:dev Jan 6, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants