Releases: stevene1919/hisense_vidaa
Releases · stevene1919/hisense_vidaa
Release list
v2.10.0
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) withsupports_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.
- Structured Service Response Data (
- MODULAR ARCHITECTURAL DECOMPOSITION (<300 LINES PER MODULE):
- Config Flow Decomposition (
flow_helpers.py,flow_certs.py,flow_discovery.py,flow_reauth.py): Split monolithicconfig_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 intoConnectionManagerMixin(client.pyreduced 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 intoTvSettingsActionsMixin(293 lines). - Diagnostic Sensors Platform (
sensors_diagnostic.py): Extracted secondary diagnostic entities (SessionStatusSensor,AuthProfileSensor,ReportedNameSensor,AudioOutputSensor) intosensors_diagnostic.py(222 lines), reducingsensor.pyfrom 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).
- Config Flow Decomposition (
v2.9.6
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 intofix_flow.step.confirm.descriptionin accordance with Home Assistant core Repairs schema standards.
- Resolved Hassfest validation error (
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_nameto official_attr_translation_keyacrossbinary_sensor,select,number,switch,notify, andremoteplatforms with 100% key parity betweenstrings.jsonandtranslations/en.json. - Complete MDI Icon Mapping (
icons.json): Fully expandedicons.jsoncovering 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"inmanifest.jsonadhering to Home Assistant Integration Quality Scale progression.
v2.9.5
Fixed
- BROKER-INVALIDATED TOKEN DETECTION & AUTO-ESCALATION (
client.py):- Added
MAX_BROKER_REJECTION_ATTEMPTS = 3threshold. 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 theaccess_tokenandrefresh_tokenare simultaneously rejected (rc: 4). Previously,_dispatch_auth_failed()was gated strictly on timestamp-basedis_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.
- Added
- 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 whenzc=Nonewhile UPnP descriptor parsing continues to capture model, MAC, and firmware metadata.
- Removed direct
Added
- PERSISTENT HA REPAIRS DASHBOARD CARD (
repairs.py,strings.json,__init__.py):- Introduced
auth_token_invalidatedrepair 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.
- Introduced
- 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.
- Documented essential TV power settings (
v2.9.4
Fixed
- WILDCARD SUBACK 128 SUBSCRIPTION REJECTION FIX (Issue #28):
- In
protocol/auth.py(perform_token_refresh), replaced the wildcard#subscription with explicit subscriptions toplatform_service/data/tokenissuanceandplatform_service/data/gettoken. Resolves failed token refreshes on modern VIDAA TV firmwares (e.g. 65Q75QE, 65U6KE) that deny wildcard subscriptions withSUBACK 128.
- In
- PREVENT ON/OFF FLAPPING LOOP AFTER SUCCESSFUL REFRESH (Issue #28):
- In
__init__.py, updatedupdate_listenerto check whetherentry.optionsactually changed before reloading the integration. Persisting refreshed tokens inentry.datano longer triggers entry reload, preventing duplicate MQTT client sessions from fighting over the sameclient_idand flapping every 2 seconds. - Removed redundant
connect_and_run()call in_refresh_token_and_update_creds()sincerefresh_tokens()already handles reconnection.
- In
- 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 answersgettoken); 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/5the 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
onSTATE WHILE IN STANDBY (PR #27):media_playerno longer forcesis_on = Trueon connect or onvolumechange/sourcelist/applistmessages; TVs withfake_sleepkeep the broker up and publish these in standby, which made the entity reportonafter a restart and turnedturn_off(KEY_POWERtoggle) into power-on. Power state is derived from state messages only.
v2.9.3
Fixed
- LIVE TV SOURCE STATE PARSING & INPUT CYCLING:
- Fixed
client.current_sourcenot updating to"TV"when receivingstatetype: "livetv"broadcasts without asourcenamekey, which previously caused remoteinputcycling to calculate the next source from stale previous states and loop on Live TV. - Filtered
get_next_cycled_sourcecandidates to physical hardware inputs (HDMI1,HDMI2,HDMI3,AV,TV), preventing input cycling from stalling on virtual app entries (such asVIDAA tvapp ID284). - Added Live TV alias matching (
tv,live tv,livetv,dtv,antenna) to cleanly wrap cycling around fromTVback toHDMI1. - Ensured both
sourceidandsourcenameare populated inactions/changesourceMQTT payloads when switching inputs.
- Fixed
- 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 identicalclient_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)inHisenseVidaaConfigFlowto stop background client threads when a pairing flow is aborted, dismissed, or closed.
- Cleanly disconnects the pairing flow MQTT client in the executor before creating the configuration entry in
Added
- VIDAA 2024 APK KEYSTORE AUTO-DISCOVERY (
El.p12) (Issue #6):- Added
El.p12andel.p12to PKCS#12 bundle candidate lists formodern,middle, andautoprofiles, 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 resolvingrc: 5(Not Authorized) pairing rejections.
- Added
v2.9.2
Fixed
- TOKEN REFRESH RESILIENCE & STANDBY REAUTH SUPPRESSION:
- Suppressed spurious
auth_failedcallback and HA reauth prompts when the TV's internal MQTT broker rejects connections withrc: 4orrc: 5while entering/in standby (fake_sleep_0), preserving valid 30-dayrefresh_tokencredentials for automatic reconnection upon TV wake. - Eliminated race condition in
_on_connectwhere in-flight or throttled token refresh attempts prematurely dispatched_dispatch_auth_failed(). - Only triggers Home Assistant interactive reauth if the
refresh_tokenis completely missing or expired (>30 days).
- Suppressed spurious
- PROACTIVE TOKEN RENEWAL:
- Added
_proactive_token_refreshto renew tokens in the background when connected and the 2-dayaccess_tokenhas<12 hoursremaining, preventing token expiration during overnight standby.
- Added
- TOKEN LIFESPAN DIAGNOSTICS:
- Added
access_token_expires_atandrefresh_token_expires_atISO datetime attributes tosensor.{tv}_session_status.
- Added
v2.9.0
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 singleHisenseVidaaEntitybase class, eliminating duplicateddevice_info, availability, and name scaffolding. - SWITCH PLATFORM: Added
switch.{tv}_audio_only(idempotent screen-off audio control) andswitch.{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_certificatessignature changed from(certfile, keyfile)to(auth_profile, certfile, keyfile)during refactor — both call sites inclient.py(__init__andvalidate_certificates) were still passing positional args, causingssl.SSLError: [SSL] PEM libon 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.pyrefactor: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.SSLErrorcrash 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
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.
- Immediately stop paho-mqtt auto-reconnect background loop on
- 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.
- In
- 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/picturesettingandactions/soundsettingmenu 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.
- Extended certificate resolver to recognize versioned certificate bundles (
- AUDIO OUTPUT SELECTION STABILITY:
- Filtered volume update handler in
select.pyandmedia_player.pyto only process master volume (0) and ARC (1) channels, preventing mute broadcast packets (volume_type: 2) from momentarily toggling audio output selection toHeadphone / Bluetooth.
- Filtered volume update handler in
- UNIT TEST EXPANSION:
- Added unit test cases covering token validity thresholds, missing metadata safety, and auth fallback (55 passing tests).
v2.8.5
Added
- PICTURE & DISPLAY CONTROLS (
numberandselectplatforms - Issue #20):- Added
number.{tv}_backlight,number.{tv}_brightness, andnumber.{tv}_contrastslider entities (0–100) for real-time picture adjustments over MQTT. - Added
select.{tv}_picture_modedropdown entity with options dynamically discovered from the TV (with fallback toStandard,Cinema Day,Cinema Night,Dynamic,Sport,Game,Filmmaker Mode,PC). - Added
select.{tv}_sound_modedropdown entity for real-time sound equalizer mode switching (Standard,Theater,Music,Speech,Late Night,Sports).
- Added
- NEW AUTOMATION SERVICES:
hisense_vidaa.set_picture_setting: Execute arbitrary picture setting changes viamenu_idandmenu_value.hisense_vidaa.set_sound_setting: Execute arbitrary sound equalizer adjustments viamenu_idandmenu_value.hisense_vidaa.send_text_input: Inject text strings directly into TV search bars and text fields viaactions/txtinputdataandactions/bwsinputdata.
- FEATURE PROBING & GITHUB ISSUE DIAGNOSTICS:
- Added shared
probe.pymodule for discovering TV capabilities and querying picture/sound menu structures. - Added
probeCLI command and--probereporting flag totest_client.pyanddebug_tv.py, generating pre-formatted Markdown diagnostics tables ready for GitHub issue submissions.
- Added shared
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.
- Standardized certificate search paths to standard Home Assistant directories (
- 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.
- Extracted menu models and parsers into
v2.8.1
Added
- SESSION STATUS SENSOR (
sensor.{tv}_session_status): Replaced the misleading "Token Expiry" timestamp countdown with an intuitive diagnosticSession Statussensor 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_entrynow unloads only the dynamically enabled platforms recorded during setup instead of staticPLATFORMS. This preventsValueError: Config entry was never loaded!crashes when unloading entries where optional platforms (such asnotifyorremote) are disabled or not supported, resolvingConfigEntryState.FAILED_UNLOADand preserving the ability to reload and reconfigure options from the UI. - MATERIAL DESIGN ICON CORRECTION: Updated Sync Clock button icon to standard
mdi:clock-outlineinbutton.pyandicons.jsonto fix broken icon rendering.
Removed
- REDUNDANT REFRESH TOKEN BUTTON: Removed
button.{tv}_refresh_access_tokensince VIDAA firmware does not require or execute periodic manual token rotations during active pairing sessions.