Skip to content

v3.2.0

Choose a tag to compare

@github-actions github-actions released this 05 Nov 11:55
· 86 commits to main since this release

This release expands the integration beyond Hisense-badged hardware to provide comprehensive, end-to-end support for all partner TV brands operating on the VIDAA Smart TV platform (including Toshiba, Loewe, TPV Technology / Philips, Schneider, Akai, Beko, and others). It also introduces robust client SSL certificate semantic and syntactic validation, enriched async UPnP descriptor parsing, and graceful Zeroconf / HomeKit metadata extraction.

☕ Support the Project

If this integration has added value to your smart home setup, consider buying me a coffee to support continued development and maintenance:

Support on Ko-fi

🌟 What's New & Hardened in v3.2.0

  • UNIVERSAL VIDAA OEM MULTI-BRAND SUPPORT:
    • Full cryptographic and lifecycle support for all licensed partner TV brands running VIDAA OS: Hisense (his), Toshiba (tos), Loewe / We. by Loewe (loe), TPV Technology / Philips / AOC (tpv), Sharp (shp), JVC (jvc), Schneider (sch), Akai (aka), Beko (bek), Telefunken (tel), Bush (bus), Vizio (vic), Philco (phi), Noblex (nob), Sansei (san), RCA (rca), Sinotec (sin), Vestel (ves), Brandt (bra), Metz (met), and Leica (lei).
    • Post-PIN Brand Overwrite Prevention (flow_helpers.py, config_flow.py): Fixed a critical bug where post-PIN device discovery defaulted to "his" and unconditionally clobbered a cascade- or cert-hinted OEM brand (tos, loe, tpv, shp, jvc) when UPnP was blocked across isolated VLANs or omitted brand=.
    • Dynamic Client Credential Regeneration on Brand Change (client.py, __init__.py): Changing the TV OEM brand in Options Flow or setup now automatically derives fresh brand-scoped pairing credentials (client_id, username, password) and invalidates stale tokens on HisenseTvClient, persisting the new credentials cleanly to entry.data.
    • Expanded Candidate OEM Brand Handshake Cascade (protocol/pairing.py): When pairing over manual IP or isolated IoT VLANs without UPnP discovery, if the broker rejects the initial connection with rc: 5 (Not Authorized), the pairing engine automatically cascades through high-probability candidate brands (tos, loe, tpv, shp, jvc), auto-adopting the accepted brand and updating the Home Assistant device registry.
    • Automatic OEM Brand Detection from Certificate Filenames (protocol/certs.py): Added detect_brand_from_cert_paths(). Placing brand-named certificates in /config/ssl/ (e.g. toshiba.crt, loewe.pem, philips.crt, sharp.pem, jvc.key, rcamobile.p12) automatically hints the TV manufacturer and pre-configures the dynamic OEM salt.
    • Manual IP Setup & Device Options Brand Selectors (config_flow.py, options_flow.py): Added CONF_BRAND selector dropdown to both the initial manual IP setup step and the Security Options menu, allowing users to explicitly select their TV OEM brand upfront or adjust it later.
    • Canonical Brand Normalization & 3-Letter Code Preservation (discovery.py): Updated normalize_brand_code() to tokenize word boundaries, avoiding false substring collisions (e.g. preventing "unrecognized_brand" from matching "bra" Brandt), while preserving explicit 3-letter alphanumeric codes (brand=xyz) from UPnP <modelDescription>.
    • UPnP Descriptor MAC Fallbacks (tv/upnp_desc.py, protocol/upnp.py): Supported mac and network_device as fallback MAC keys in UPnP XML descriptors alongside macWifi.
    • Brand-Aware Diagnostics & Sensor Fallbacks (sensors_diagnostic.py, tv/probe.py, client.py): Diagnostic sensors, default friendly names, and probe Markdown reports now dynamically reflect the resolved TV OEM brand rather than hardcoding "Hisense".
    • CLI Diagnostics Multi-Brand Support: Added --brand parameter to test_client.py and debug_tv.py with open brand support.
  • TOPTRO SMART PROJECTOR SUPPORT & OEM BRAND PROPAGATION (const.py, discovery.py, protocol/auth.py, protocol/pairing.py, client.py):
    • Added official OEM brand support for TOPTRO portable smart projectors running VIDAA OS (e.g. FreeStyle series), mapping tpo and toptro across BRAND_OPTIONS, BRAND_MAP, and BRAND_CODE_MAP.
    • Expanded the pairing cascade fallback candidate list to automatically probe tpo alongside tos, loe, tpv, shp, and jvc when initial connections to projector brokers fail.
    • Enhanced async_probe_tv_auth_methods() and HisenseTvClient.async_probe_auth_methods() to propagate synchronized device clock timestamps (timestamp=int(time.time()) + self.clock_offset) and active OEM brand prefixes.
    • Hardened MQTT diagnostic classification across both MQTT 3.1.1 (rc: 4, rc: 5) and MQTT 5.0 (rc: 134, rc: 135) using AUTH_REJECTION_CODES, ensuring bad credentials and permission rejections are cleanly reported as "not_authorized" rather than generic network connection errors.
    • Dynamic brand refresh in pairing handshake: auto-detects and updates client.brand from UPnP descriptor fingerprints before pairing if client.brand is still at default ("his"), safeguarding manual brand overrides.
  • "AUTO-DETECT" BRAND OPTION & DEDICATED BRAND PROFILE DIAGNOSTIC SENSOR (const.py, config_flow.py, sensor.py, sensors_diagnostic.py, flow_helpers.py, flow_reauth.py, options_flow.py, translations/*.json):
    • Added "auto": "Auto Detect (Recommended)" as the default option in the setup and options brand selectors (BRAND_OPTIONS, DEFAULT_BRAND_OPTION), matching the authentication profile UX.
    • Streamlined manual setup: users only need to type their TV/projector IP address; the integration queries the UPnP descriptor on port 38400, extracts brand=... from <modelDescription>, normalizes the code, and resolves OEM branding with zero manual intervention.
    • Added a dedicated diagnostic entity: HisenseVidaaBrandProfileSensor (sensor.<device>_brand_profile), displaying the configured brand profile (Auto Detect (Recommended), Hisense, Toshiba, TOPTRO, etc.) along with diagnostic attributes (configured_profile, active_brand_code, active_brand).
    • Added localized translations for brand_profile and selector options across English, German, Spanish, French, Italian, and Portuguese (en.json, de.json, es.json, fr.json, it.json, pt.json, pt-BR.json).
  • SSL CLIENT CERTIFICATE INTEGRITY VALIDATION (protocol/certs.py):
    • Implemented strict PEM certificate and private key validation via validate_ssl_certs().
    • Validates BEGIN/END headers, Base64 decoding, ASN.1 structure, modulus matching between certificate and private key, and PKCS#8 decryption without hard external cryptography dependencies.
    • Provides clear, actionable error feedback when invalid or mismatched certificates are uploaded during manual certificate setup.
    • Clarified universal app architecture in documentation: the official VIDAA Smart TV app (com.universal.remote.multi) is universal across all brands and its client certificate (CN=VidaaAppAndroidV01) authenticates with any VIDAA OS TV.
  • EVENT LOOP NON-BLOCKING CERTIFICATE RESOLUTION & PKCS#12 CACHING (__init__.py, client.py, protocol/certs.py, config_flow.py, flow_reauth.py):
    • Resolves GitHub issue #49 (Detected blocking call to open with args inside the event loop).
    • Offloaded certificate path searches, resolve_certificates(), and resolve_ca_certificate() in async_setup_entry to Home Assistant's threadpool executor via hass.async_add_executor_job().
    • Hardened HisenseTvClient.__init__ to skip disk certificate scans and resolution entirely when use_ssl=False, for legacy/static auth profiles, or when valid pre-resolved PEM certificate and key paths are supplied.
    • Added timestamp-based (mtime) disk caching in extract_pkcs12_to_pem() to reuse existing extracted PEM certificate and key files on subsequent startups without re-reading the .p12 archive, performing write-access probe checks, or rewriting files.
    • Ensured _async_resolve_ssl_certs() runs in the executor before client initialization in all config flow and re-authentication paths.
  • ASYNC UPnP <modelDescription> CAPABILITY EXTRACTION (protocol/upnp.py):
    • Enhanced HisenseUpnpClient.async_get_device_fingerprint() to parse <modelDescription> as key-value pairs, extracting brand, platform, vidaa_support, voice, transport_protocol, mac_wifi, and mac_ethernet asynchronously.
  • ZEROCONF / HOMEKIT mDNS METADATA ENRICHMENT (discovery.py):
    • Enriched parse_zeroconf_discovery() to extract actual model names (md/model) and manufacturer branding from mDNS TXT properties advertised by Apple HomeKit / AirPlay (_hap._tcp.local., _airplay._tcp.local.).
    • Completely decoupled from control: graceful fallback to defaults if HomeKit/AirPlay is disabled or properties are absent.
  • TEST SUITE MODULARIZATION & EXPANSION (262 PASSING TESTS):
    • Decoupled oversized test suites into modular, single-responsibility modules:
      • Split test_client_auth.py into test_client_tokens.py (token lifecycle/drift/standby), test_client_reconnect.py (reconnect locks/backoff/rejection thresholds), and test_client_auth.py (core auth profiles/probing).
      • Split test_pairing.py into test_pairing_guards.py (abort flow/duplicate guards), test_pairing_cascade.py (brand fallback cascade/profile fallback), and test_pairing.py (PIN challenge probing/flows).
      • Split test_services.py into test_services_targeting.py (device/area/floor/label resolution & guards) and test_services.py (service executions).
      • Added test_multi_brand_readiness.py covering OEM brand selectors, code preservation, cert hinting, UPnP MAC fallbacks, client ID regeneration, and post-PIN brand preservation.
      • Added comprehensive regression coverage for TOPTRO discovery, brand normalization, and probe rejection diagnostics in tests/test_client_auth.py and tests/test_discovery.py.
    • 100% passing test suite across all 262 unit tests with 0 linter errors and 0 Hassfest errors.