Skip to content

Add Lunatone gateway integration #149182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 85 commits into
base: dev
Choose a base branch
from

Conversation

MoonDevLT
Copy link

@MoonDevLT MoonDevLT commented Jul 21, 2025

Breaking change

Proposed change

This new integration should make it possible to easily integrate Lunatone devices that support REST API.

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
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format 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.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

MoonDevLT added 30 commits July 21, 2025 11:28
This will be mandatory in the future according to the official documenation (See https://developers.home-assistant.io/docs/creating_integration_manifest).
The device ID should be as "unique" as the line/address combination.
The URL can now be changed during reconfiguration.
This reverts commit 7ae8113f1ead6ea120c8abf93500456ad0d6a48b.
Copy link
Member

@abmantis abmantis left a comment

Choose a reason for hiding this comment

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

Please also check the errors in hassfest regarding dependency version restrictions

if user_input is not None:
method = user_input[CONF_SCAN_METHOD]
if method == DALIDeviceScanMethod.DO_NOTHING: # Skip device scan
return await self.async_step_finish({})
Copy link
Member

Choose a reason for hiding this comment

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

what happens with the integration when DO_NOTHING is selected? will it have any entities?

Copy link
Author

Choose a reason for hiding this comment

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

It can have entities if the gateway already has a device list. If the device list is empty (e.g., in the case of a new gateway), a device for the gateway will still be created, but it won’t have any associated entities.

Copy link
Author

@MoonDevLT MoonDevLT Jul 29, 2025

Choose a reason for hiding this comment

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

what happens with the integration when DO_NOTHING is selected?

No device scan is performed and according to the stored device list entities and devices are created.

DO_NOTHING = "do_nothing"
CURRENT_DEVICE_LIST = "current_device_list"
SYSTEM_EXTENSION = "system_extension"
NEW_INSTALLATION = "new_installation"
Copy link
Member

Choose a reason for hiding this comment

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

What are the differences between these scan methods? Could it be automatic somehow? Or omitted? What happens if it is always set to new_installation, for example?

We should explain it in the docs too.

Copy link
Author

@MoonDevLT MoonDevLT Jul 29, 2025

Choose a reason for hiding this comment

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

What are the differences between these scan methods?

  • DO_NOTHING: No device scan is performed and according to the stored device list entities and devices are created.
  • CURRENT_DEVICE_LIST: The device list values (like brightness, on/off, failures) is actively updated with fresh values from DALI bus.
  • SYSTEM_EXTENSION: A none disruptive device scan is performed that can find new devices and address them but doesn't remove any existing DALI addresses.
  • NEW_INSTALLATION: This device scan deletes the stored device list and all DALI addresses. Then it newly addresses the devices on the DALI bus and creates the device list.

What happens if it is always set to new_installation, for example?

That would be the worst choice as a default because it deletes all addresses from DALI devices.

if self.dali_device_scan_task:
next_step_id = None
if self.dali_device_scan_task.cancelled():
_LOGGER.debug("DALI device scan timeout")
Copy link
Member

Choose a reason for hiding this comment

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

isn't the task cancelled when the user closes the form too? if so, this log is misleading

Copy link
Author

Choose a reason for hiding this comment

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

I just tried this and the debugger didn't hit the breakpoint there when I closed the form. Is there another way to determine if the form is closed?

last_step=False,
)

async def async_step_failed(
Copy link
Member

Choose a reason for hiding this comment

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

is this step needed? can we call async_abort directly where it fails instead?

Copy link
Author

Choose a reason for hiding this comment

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

I start async_show_progress() with _dali_device_scan_task and when it is finished or failed async_show_progress_done() has to be called. This method needs next_step_id set to a step ID. So I think this has to stay this way.

@home-assistant home-assistant bot marked this pull request as draft July 29, 2025 11:49
@MoonDevLT
Copy link
Author

Please also check the errors in hassfest regarding dependency version restrictions

I addressed this in commit f109053. I'm wondering is this normal that I didn't get these dependency version restriction errors when I run hassfest locally?

MoonDevLT and others added 6 commits July 29, 2025 14:25
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
The unique_id of the config entry should always be set.
Instead DATA_SCHEMA is used directly.
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
MoonDevLT and others added 2 commits July 29, 2025 15:22
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
With the version of the config flow set to 0 some
tests were failing without the dummy function.
With the version set to 1 the dummy function is no
longer needed.

Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
MoonDevLT and others added 2 commits July 29, 2025 13:29
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy