Skip to content

Releases: stevene1919/hisense_vidaa

v2.10.0

Choose a tag to compare

@stevene1919 stevene1919 released this 28 Sep 17:42

Added

  • HOME ASSISTANT INTEGRATION QUALITY SCALE GOLD TIER (100% COMPLIANCE):
    • Structured Service Response Data (SupportsResponse.OPTIONAL): Registered all custom TV services (send_key, launch_app, set_picture_setting, set_sound_setting, send_text_input) with supports_response=SupportsResponse.OPTIONAL, returning detailed execution metadata and target IP arrays to Home Assistant scripts and automations.
    • Dynamic Options Lifecycle: Streamlined config entry update listener with options filtering to prevent unnecessary reloads.
  • MODULAR ARCHITECTURAL DECOMPOSITION (<300 LINES PER MODULE):
    • Config Flow Decomposition (flow_helpers.py, flow_certs.py, flow_discovery.py, flow_reauth.py): Split monolithic config_flow.py (580 lines -> 268 lines) into dedicated discovery, certificate handling, and re-authentication mixins.
    • Client Connection Lifecycle (protocol/connection.py): Extracted MQTT connection loops, keepalive management, async queries, and socket error recovery into ConnectionManagerMixin (client.py reduced from 842 lines -> 388 lines, -53.9%).
    • TV Settings & Picture/Sound Actions (tv/settings.py): Moved picture calibration sliders and sound mode get/set commands into TvSettingsActionsMixin (293 lines).
    • Diagnostic Sensors Platform (sensors_diagnostic.py): Extracted secondary diagnostic entities (SessionStatusSensor, AuthProfileSensor, ReportedNameSensor, AudioOutputSensor) into sensors_diagnostic.py (222 lines), reducing sensor.py from 409 lines -> 235 lines.
    • Media Player Broadcast State Parsing (tv/media.py): Modularized incoming broadcast telemetry, volume, and input handlers into pure functional parsers (parse_media_state_broadcast, parse_volume_broadcast, parse_sourcelist_data, parse_applist_data).

v2.9.6

Choose a tag to compare

@stevene1919 stevene1919 released this 28 Sep 16:24

Fixed

  • HASSFEST TRANSLATION SCHEMA MUTUAL EXCLUSION (strings.json, translations/en.json):
    • Resolved Hassfest validation error (two or more values in the same group of exclusion 'fixable' at 'issues.auth_token_invalidated.<fixable>') by merging the top-level explanation into fix_flow.step.confirm.description in accordance with Home Assistant core Repairs schema standards.

Added

  • HOME ASSISTANT INTEGRATION QUALITY SCALE IMPROVEMENTS:
    • PARALLEL_UPDATES = 0: Declared across all 9 platform modules (media_player.py, remote.py, sensor.py, binary_sensor.py, switch.py, select.py, number.py, button.py, notify.py) to properly communicate local push concurrency semantics to Home Assistant Core.
    • Entity Translation Standardization: Migrated all remaining entities from hardcoded _attr_name to official _attr_translation_key across binary_sensor, select, number, switch, notify, and remote platforms with 100% key parity between strings.json and translations/en.json.
    • Complete MDI Icon Mapping (icons.json): Fully expanded icons.json covering all entity translation keys, binary sensor states, select options, and custom services.
    • PEP 561 Type Marker (py.typed): Added package type marker for strict static type checking.
    • Quality Scale Declaration: Formally declared "quality_scale": "bronze" in manifest.json adhering to Home Assistant Integration Quality Scale progression.

v2.9.5

Choose a tag to compare

@github-actions github-actions released this 28 Sep 14:38

Fixed

  • BROKER-INVALIDATED TOKEN DETECTION & AUTO-ESCALATION (client.py):
    • Added MAX_BROKER_REJECTION_ATTEMPTS = 3 threshold. When the TV broker invalidates its token store out-of-band (firmware update, hard power-cut, or deep energy-saving standby after HDMI sources sleep), both the access_token and refresh_token are simultaneously rejected (rc: 4). Previously, _dispatch_auth_failed() was gated strictly on timestamp-based is_token_expired(), meaning broker-invalidated tokens still within their 30-day validity window silently retried forever with exponential backoff without notifying the user. The integration now treats 3 consecutive broker rejections as permanent credential invalidation and triggers the re-authentication flow.
  • ZEROCONF INSTANCE DEPRECATION WARNING (tv/fingerprint.py):
    • Removed direct Zeroconf() instantiation that caused Home Assistant deprecation warnings (Detected that custom integration 'hisense_vidaa' attempted to create another Zeroconf instance). Callers in Home Assistant should pass the shared Zeroconf instance; mDNS fingerprinting gracefully skips when zc=None while UPnP descriptor parsing continues to capture model, MAC, and firmware metadata.

Added

  • PERSISTENT HA REPAIRS DASHBOARD CARD (repairs.py, strings.json, __init__.py):
    • Introduced auth_token_invalidated repair issue flow. When the broker invalidates credentials, Home Assistant creates a persistent card in the Repairs panel (Settings → System → Repairs) explaining why tokens were invalidated and providing a 1-click prompt to display a PIN on the TV and re-pair.
  • RECOMMENDED TV STANDBY & POWER SETTINGS GUIDANCE (README.md, docs/network_requirements.md, GEMINI.md):
    • Documented essential TV power settings (Fast Power On = ON, Auto Standby with No Signal = OFF, Auto Sleep = OFF) to prevent deep energy-conservation shutdowns when connected HDMI devices (Chromecast with Google TV, Apple TV, gaming consoles) sleep.

v2.9.4

Choose a tag to compare

@stevene1919 stevene1919 released this 26 Sep 16:28

Fixed

  • WILDCARD SUBACK 128 SUBSCRIPTION REJECTION FIX (Issue #28):
    • In protocol/auth.py (perform_token_refresh), replaced the wildcard # subscription with explicit subscriptions to platform_service/data/tokenissuance and platform_service/data/gettoken. Resolves failed token refreshes on modern VIDAA TV firmwares (e.g. 65Q75QE, 65U6KE) that deny wildcard subscriptions with SUBACK 128.
  • PREVENT ON/OFF FLAPPING LOOP AFTER SUCCESSFUL REFRESH (Issue #28):
    • In __init__.py, updated update_listener to check whether entry.options actually changed before reloading the integration. Persisting refreshed tokens in entry.data no longer triggers entry reload, preventing duplicate MQTT client sessions from fighting over the same client_id and flapping every 2 seconds.
    • Removed redundant connect_and_run() call in _refresh_token_and_update_creds() since refresh_tokens() already handles reconnection.
  • STRANDED CONNECTION AFTER FAILED TOKEN REFRESH (PR #27):
    • refresh_tokens() now restores the main MQTT connection with the current access token when the refresh fails (a TV in standby never answers gettoken); previously the entry stayed loaded but disconnected until it was reloaded.
    • _proactive_token_refresh() waits for the retained state broadcast and skips the refresh while the TV reports standby (fake_sleep_0); a periodic token watch retries the near-expiry refresh once the TV is awake, with exponential backoff.
    • On rc: 4/5 the refresh retries now back off (1 → 30 min) and a delayed reconnect is scheduled, since paho's loop is stopped on rejection and nothing retried.
  • FALSE on STATE WHILE IN STANDBY (PR #27):
    • media_player no longer forces is_on = True on connect or on volumechange / sourcelist / applist messages; TVs with fake_sleep keep the broker up and publish these in standby, which made the entity report on after a restart and turned turn_off (KEY_POWER toggle) into power-on. Power state is derived from state messages only.

v2.9.3

Choose a tag to compare

@stevene1919 stevene1919 released this 20 Sep 17:35

Fixed

  • LIVE TV SOURCE STATE PARSING & INPUT CYCLING:
    • Fixed client.current_source not updating to "TV" when receiving statetype: "livetv" broadcasts without a sourcename key, which previously caused remote input cycling to calculate the next source from stale previous states and loop on Live TV.
    • Filtered get_next_cycled_source candidates to physical hardware inputs (HDMI1, HDMI2, HDMI3, AV, TV), preventing input cycling from stalling on virtual app entries (such as VIDAA tv app ID 284).
    • Added Live TV alias matching (tv, live tv, livetv, dtv, antenna) to cleanly wrap cycling around from TV back to HDMI1.
    • Ensured both sourceid and sourcename are populated in actions/changesource MQTT payloads when switching inputs.
  • CONFIG FLOW MQTT CLIENT LEAK & 30s RECONNECT FLAPPING (Issue #25):
    • Cleanly disconnects the pairing flow MQTT client in the executor before creating the configuration entry in async_step_options, eliminating duplicate client sessions with identical client_ids that caused 30-second disconnect/reconnect flapping until HA restart.
    • Cleanly disconnects the flow client before entry reload in _async_finish_reauth.
    • Implemented @callback def async_remove(self) in HisenseVidaaConfigFlow to stop background client threads when a pairing flow is aborted, dismissed, or closed.

Added

  • VIDAA 2024 APK KEYSTORE AUTO-DISCOVERY (El.p12) (Issue #6):
    • Added El.p12 and el.p12 to PKCS#12 bundle candidate lists for modern, middle, and auto profiles, allowing raw keystores extracted directly from official VIDAA Android APKs (res/El.p12) to be auto-discovered and unpacked to PEM without manual renaming.
    • Documented client certificate identity validation (CN=VidaaAppAndroidV01) on 2024+ VIDAA firmware (p20.09.6030...) and guidance for resolving rc: 5 (Not Authorized) pairing rejections.

v2.9.2

Choose a tag to compare

@stevene1919 stevene1919 released this 18 Sep 14:26

Fixed

  • TOKEN REFRESH RESILIENCE & STANDBY REAUTH SUPPRESSION:
    • Suppressed spurious auth_failed callback and HA reauth prompts when the TV's internal MQTT broker rejects connections with rc: 4 or rc: 5 while entering/in standby (fake_sleep_0), preserving valid 30-day refresh_token credentials for automatic reconnection upon TV wake.
    • Eliminated race condition in _on_connect where in-flight or throttled token refresh attempts prematurely dispatched _dispatch_auth_failed().
    • Only triggers Home Assistant interactive reauth if the refresh_token is completely missing or expired (>30 days).
  • PROACTIVE TOKEN RENEWAL:
    • Added _proactive_token_refresh to renew tokens in the background when connected and the 2-day access_token has <12 hours remaining, preventing token expiration during overnight standby.
  • TOKEN LIFESPAN DIAGNOSTICS:
    • Added access_token_expires_at and refresh_token_expires_at ISO datetime attributes to sensor.{tv}_session_status.

v2.9.0

Choose a tag to compare

@github-actions github-actions released this 17 Sep 04:57

Added

  • PROTOCOL & TV SUBPACKAGE ARCHITECTURE: Refactored internal module structure into two dedicated subpackages:
    • protocol/ — auth.py (TLS setup, token refresh), certs.py (certificate resolution), dispatcher.py (MQTT topic dispatch), pairing.py (PIN challenge flow), topics.py (topic path builders), wol.py (Wake-on-LAN).
    • tv/ — actions.py (command senders), navigation.py (source/app cycling), probe.py (capability probing), settings.py (picture/sound menu models), state.py (state attribute updaters).
  • BASE ENTITY CLASS (entity.py): All 9 entity platforms now inherit from a single HisenseVidaaEntity base class, eliminating duplicated device_info, availability, and name scaffolding.
  • SWITCH PLATFORM: Added switch.{tv}_audio_only (idempotent screen-off audio control) and switch.{tv}_debug_logging (dynamic verbose logging toggle without HA restart).
  • 76 AUTOMATED TESTS: Expanded test suite to 76 passing unit tests covering the full refactored module structure.

Fixed

  • CERTIFICATE RESOLUTION CALL-SITE MISMATCH: resolve_certificates signature changed from (certfile, keyfile) to (auth_profile, certfile, keyfile) during refactor — both call sites in client.py (__init__ and validate_certificates) were still passing positional args, causing ssl.SSLError: [SSL] PEM lib on every startup and triggering the rapid connect/disconnect loop in entity activity logs.
  • STALE CLIENT ATTRIBUTE NAMES: Several entity platforms still referenced old attribute names removed or renamed during the tv/state.py refactor:
    • client.channel_name → client.current_channel (media_player.py, binary_sensor.py)
    • client.program_title → client.current_program (media_player.py, binary_sensor.py)
    • client.program_detail, client.program_start, client.program_end — removed entirely from client state model.
    • client.is_on (boolean) → client.state not in ("off", "") (binary_sensor.py)
  • ENTITY ACTIVITY LOG LOOP: The root cause of the rapid entity state-change loop was the ssl.SSLError crash on every setup attempt — each failure triggered an immediate reconnect cycle, re-firing all MQTT subscription bursts (sourceswitch, applist, sourcelist) in the activity log. Fixed by resolving all three call-site and attribute mismatches above.

v2.8.6

Choose a tag to compare

@stevene1919 stevene1919 released this 17 Sep 02:38

Fixed

  • MQTT RC 4/5 LOOP HALT & THREAD-STORM PREVENTION (Issues #6, #22):
    • Immediately stop paho-mqtt auto-reconnect background loop on rc=4 / rc=5 (not authorized / invalid credentials) before processing authentication futures and callbacks to prevent runaway reconnect thread storms and broker throttling during pairing failures or expired tokens.
    • Added thread lock and ensure_connected(min_interval=5.0) rate-limiting to throttle connection attempts from media player and remote entity commands.
    • Properly clean up active MQTT background loops and event handlers before instantiating new client instances in connect_and_run().
    • Removed duplicate unthrottled reconnect logic from token refresh failure paths.
  • PAIRING SESSION COLLISION & PIN POPUP STORM PREVENTION:
    • In config_flow.py, proactively disconnect and shut down running background clients prior to launching the pairing handshake, preventing identical Client ID session ping-pong collisions (rc: 7) and repeated TV PIN modals.
    • Stopped paho-mqtt auto-reconnect loops on pairing clients during in-flight PIN verification.
  • PROACTIVE TOKEN REFRESH & STARTUP PIN SUPPRESSION:
    • check_and_refresh_token() now avoids proactive token refresh on startup whenever the access token is valid (time_remaining > 0), preventing unwanted TV pairing dialogs while watching TV.
    • Removed automatic actions/picturesetting and actions/soundsetting menu queries from initial connection sequence to avoid prompting protected engineering menu authorization modals on boot.
  • VERSIONED CERTIFICATE RESOLUTION (Issues #6, #21):
    • Extended certificate resolver to recognize versioned certificate bundles (vidaa_client_v01.pem/.crt/.key, vidaa_client_v02.pem/.key).
    • Added automatic matching key resolution alongside explicit or discovered certificate files.
  • AUDIO OUTPUT SELECTION STABILITY:
    • Filtered volume update handler in select.py and media_player.py to only process master volume (0) and ARC (1) channels, preventing mute broadcast packets (volume_type: 2) from momentarily toggling audio output selection to Headphone / Bluetooth.
  • UNIT TEST EXPANSION:
    • Added unit test cases covering token validity thresholds, missing metadata safety, and auth fallback (55 passing tests).

v2.8.5

Choose a tag to compare

@stevene1919 stevene1919 released this 15 Sep 10:08

Added

  • PICTURE & DISPLAY CONTROLS (number and select platforms - Issue #20):
    • Added number.{tv}_backlight, number.{tv}_brightness, and number.{tv}_contrast slider entities (0–100) for real-time picture adjustments over MQTT.
    • Added select.{tv}_picture_mode dropdown entity with options dynamically discovered from the TV (with fallback to Standard, Cinema Day, Cinema Night, Dynamic, Sport, Game, Filmmaker Mode, PC).
    • Added select.{tv}_sound_mode dropdown entity for real-time sound equalizer mode switching (Standard, Theater, Music, Speech, Late Night, Sports).
  • NEW AUTOMATION SERVICES:
    • hisense_vidaa.set_picture_setting: Execute arbitrary picture setting changes via menu_id and menu_value.
    • hisense_vidaa.set_sound_setting: Execute arbitrary sound equalizer adjustments via menu_id and menu_value.
    • hisense_vidaa.send_text_input: Inject text strings directly into TV search bars and text fields via actions/txtinputdata and actions/bwsinputdata.
  • FEATURE PROBING & GITHUB ISSUE DIAGNOSTICS:
    • Added shared probe.py module for discovering TV capabilities and querying picture/sound menu structures.
    • Added probe CLI command and --probe reporting flag to test_client.py and debug_tv.py, generating pre-formatted Markdown diagnostics tables ready for GitHub issue submissions.

Fixed

  • STANDARD HOME ASSISTANT SSL DIRECTORY (Issue #21):
    • Standardized certificate search paths to standard Home Assistant directories (/config/ssl, /ssl, /config/certs, /config).
    • Stopped auto-reconnect loops and broker hammering when credentials expire (rc: 5), preventing collisions during re-pairing handshakes.
  • CODEBASE MODULARIZATION:
    • Extracted menu models and parsers into settings.py.
    • Extracted app fuzzy matching, source cycling, and key alias definitions into navigation.py.
    • Consolidated CLI test and debugging tools to share common probing and credential handlers.

v2.8.1

Choose a tag to compare

@github-actions github-actions released this 13 Sep 00:15

Added

  • SESSION STATUS SENSOR (sensor.{tv}_session_status): Replaced the misleading "Token Expiry" timestamp countdown with an intuitive diagnostic Session Status sensor tracking live authentication state (Active, Standby, Reauth Required) with rich attributes (paired_at, auth_profile, encryption, client_id).

Fixed

  • SELECTIVE PLATFORM UNLOAD ON RECONFIGURATION: async_unload_entry now unloads only the dynamically enabled platforms recorded during setup instead of static PLATFORMS. This prevents ValueError: Config entry was never loaded! crashes when unloading entries where optional platforms (such as notify or remote) are disabled or not supported, resolving ConfigEntryState.FAILED_UNLOAD and preserving the ability to reload and reconfigure options from the UI.
  • MATERIAL DESIGN ICON CORRECTION: Updated Sync Clock button icon to standard mdi:clock-outline in button.py and icons.json to fix broken icon rendering.

Removed

  • REDUNDANT REFRESH TOKEN BUTTON: Removed button.{tv}_refresh_access_token since VIDAA firmware does not require or execute periodic manual token rotations during active pairing sessions.