Skip to content

Build first version#2

Merged
kongo09 merged 10 commits intomainfrom
build-first-version
Mar 4, 2026
Merged

Build first version#2
kongo09 merged 10 commits intomainfrom
build-first-version

Conversation

@kongo09
Copy link
Copy Markdown
Owner

@kongo09 kongo09 commented Mar 4, 2026

Summary

  • Implement the core scan/diff engine that reads learnt commands from Broadlink/tuya-local storage, diffs against known state, and dynamically creates or removes button entities
  • Fix config flow to use SelectSelector (replaces vol.Coerce(list) which broke frontend serialization) and modernize OptionsFlow to use the base class config_entry property
  • Add brand/ folder with mdi:remote icon for HA 2026.3+ local brand image support
  • Add 7 tests for scan logic and service listener, plus a button press test

Key changes

  • __init__.py: async_scan_remote_commands() resolves entity→device→storage key via registries, reads commands per remote, set-diffs to create/remove buttons. _make_service_listener() schedules delayed re-scans on learn_command/delete_command events
  • button.py: Added async_setup_entry to store async_add_entities callback for dynamic entity creation
  • config_flow.py: SelectSelector with multiple=True for remote entity selection; removed OptionsFlow.__init__ (uses inherited config_entry property)
  • brand/: icon.png (256px) and icon@2x.png (512px), transparent background

Test plan

  • Verify scan creates buttons when storage has new commands
  • Verify scan removes entities when commands disappear from storage
  • Verify service listener only triggers for watched remotes
  • Verify config flow and options flow render correctly in HA frontend
  • Verify brand icon displays on integrations page (requires HA 2026.3+)

kongo09 added 10 commits March 4, 2026 12:51
Implement scanning and dynamic entity management for learned remote commands. async_scan_remote_commands now reads per-remote storage via platform READERS, diffs against known commands, creates RemoteCommandButton instances for new commands (using stored async_add_entities) and removes deleted commands via the entity registry. Added helper _get_remote_info to resolve platform/device identifiers from registries and switched known_commands to a set. Use async_call_later for scheduled scans and expose async_setup_entry in the button platform to capture the AddEntities callback. Also update config flow to use SelectSelector for multi-select remote_entities, adjust imports, and add/update tests (including new test_init and a button press test) to cover the new behavior.
Add support for IR-specific configuration via Number entities (delay and repeat) and detection/cleanup of new/removed remotes. Introduces a new number platform (number.py) with RemoteCommandNumber and create_ir_number_pair, default IR constants, and wiring in async_setup_entry to forward the NUMBER platform and store async_add_number_entities. Buttons now accept a config_entry_id and include delay_secs/num_repeats from the associated numbers when calling remote.send_command. Adds an entity registry listener that raises a repair issue for newly discovered compatible remotes and cleans up buttons/devices/number entities when a watched remote is removed. Implements helpers (_has_ir_codes, _remove_ir_numbers) and dismisses stale issues when options are updated. Updates config flow to only consider supported reader platforms, adds README and translation strings for the new repair issue, and includes comprehensive tests for button, init, and number behaviour.
@kongo09 kongo09 merged commit e812e36 into main Mar 4, 2026
2 checks passed
@kongo09 kongo09 deleted the build-first-version branch March 6, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant