Skip to content

[BUG] Tuner release failure on HDHomeRun when using Kodi (HTSP) client #275

Closed as not planned

Description

@James62370

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When using a Kodi client (HTSP) to watch live channels, Tvheadend correctly logs an unsubscribe event at the subscription layer. However, the tvhdhomerun module fails to issue a corresponding tuner release command to the HDHomeRun hardware.

Although the physical tuner LED continues blinking indefinitely, the tuner still functions correctly for subsequent requests. I am not sure which release this started happening in, as I only recently noticed the LEDs remaining active after watching or recording live TV.

Expected Behavior

Tvheadend should issue a tuner release command to the HDHomeRun device immediately after the last subscription unsubscribes. Following this command, the HDHomeRun LED should stop blinking, indicating the tuner is idle. For context, I have observed this correct behavior when using the Plex client, which successfully releases the tuner and causes the HDHomeRun LEDs to stop blinking once the stream ends.

Steps To Reproduce

  1. Open a live channel in Kodi via HTSP
  2. Watch for a few seconds
  3. Stop playback in Kodi
  4. Observe HDHomeRun device LED — continues blinking indefinitely
  5. Check TVH logs — no tvhdhomerun release/stop event appears

Environment

TVH version: 4.3-2695~g30a549ed5 (Docker, linuxserver image)
Host OS: Debian 12 (LXC container on Proxmox)
Docker installation: [e.g., Docker Engine via official apt repo / Docker Compose]
Network mode: Host
Tuner: HDHomeRun (ATSC-T OTA)
HTSP client: Kodi Media Center (HTSPv35)

CPU architecture

x86-64

Docker creation

Docker Engine (via official apt repository)

Container logs

2026-07-01 10:33:31.479 [INFO] htsp: Got connection from 192.168.1.72
2026-07-01 10:33:31.491 [INFO] htsp: 192.168.1.72: Welcomed client software: Kodi Media Center (HTSPv35)
2026-07-01 10:33:31.495 [INFO] htsp: 192.168.1.72 [ Kodi Media Center ]: Identified as user ''
2026-07-01 10:33:43.426 [INFO] mpegts: 599.028MHz in HDHomeRun - tuning on HDHomeRun ATSC-T Tuner #0 (192.168.1.119)
2026-07-01 10:33:43.426 [INFO] tvhdhomerun: tuning to auto6t:599028615
2026-07-01 10:33:43.552 [INFO] subscription: 000A: "Kodi" subscribing on channel "WNBC", weight: 100, adapter: "HDHomeRun ATSC-T Tuner #0", mux: "599.028MHz", profile="htsp"
2026-07-01 10:33:43.554 [INFO] subscription: 000B: "Kodi" subscribing on channel "COZI-TV", weight: 40, adapter: "HDHomeRun ATSC-T Tuner #0", mux: "599.028MHz", profile="htsp"
2026-07-01 10:33:56.018 [INFO] subscription: 000B: "Kodi" unsubscribing from "COZI-TV"
2026-07-01 10:34:05.503 [INFO] subscription: 000A: "Kodi" unsubscribing from "WNBC"
2026-07-01 10:34:05.508 [INFO] htsp: 192.168.1.72 [ Kodi Media Center ]: Disconnected

*** NOTE: No tvhdhomerun stop/release event follows. ***
*** Tuner continues streaming. HDHomeRun LED keeps blinking. ***

Additional Notes
- Tested on both LXC and VM deployments — same result in both cases.
- Plex (HTTP/M3U interface to TVH) releases the tuner cleanly every time.
- Kodi sends two subscriptions on connect (main channel weight 100 + 
  background mux prefetch weight 40). Both unsubscribe cleanly but 
  neither triggers a tvhdhomerun release.
- Tuner is not functionally locked — new clients can grab it normally.
  The symptom is purely the tuner continuing to stream after all 
  subscribers have disconnected.
- Similar reports seen on tvheadend.org forums starting ~Dec 2023 
  around version 4.3-2187.

Activity

  1. github-actions commented on Jul 1, 2026

    @github-actions

    Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

  2. j0nnymoe commented on Jul 1, 2026

    @j0nnymoe
    Member

    This would need to be pushed upstream, we package what they release. This is unlikely to be related to the container itself.

  3. James62370 commented on Jul 1, 2026

    @James62370
    Author

    Thank you, I will repost here https://github.com/tvheadend/tvheadend/issues

  4. LinuxServer-CI commented on Jul 31, 2026

    @LinuxServer-CI
    Collaborator

    This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

  5. James62370 commented on Jul 31, 2026

    @James62370
    Author

    This workaround addresses the "blinking LED" issue on HDHomeRun tuners caused by a Tvheadend regression. It uses a watchdog script to identify "stuck" idle tuners and release them without interrupting active streams.

    Prerequisites
    You need the hdhomerun_config utility installed. On Debian/Ubuntu-based systems, run:

    Bash
    sudo apt-get update
    sudo apt-get install -y hdhomerun-config

    Create the Script
    Create a new file for the script:
    Bash
    nano /usr/local/bin/tuner_cleanup.sh
    Paste the following code into the editor. Update the DEVICES list with your own 8-character Device IDs.

    Bash
    #!/bin/bash

    List your HDHomeRun Device IDs here
    DEVICES=("ID_HERE_1" "ID_HERE_2" "ID_HERE_3")

    for ID in "${DEVICES[@]}"; do

    Check both tuners (0 and 1) for each device

    for TUNER in 0 1; do

    Get tuner status

    STATUS=$(hdhomerun_config $ID get /tuner$TUNER/status)

    # Extract packets per second (pps)
    PPS=$(echo $STATUS | grep -o 'pps=[0-9]*' | cut -d= -f2)
    
    # If pps is 0, the tuner is idle but stuck; release it
    if [ "$PPS" -eq 0 ]; then
        hdhomerun_config $ID set /tuner$TUNER/channel none
    fi
    

    done
    done
    Save and exit (Press Ctrl+O, Enter, then Ctrl+X).

    Set Permissions
    Make the script executable so the system can run it:
    Bash
    sudo chmod +x /usr/local/bin/tuner_cleanup.sh
    3. Schedule with Cron
    Set the script to run every 5 minutes automatically:

    Open the crontab editor:

    Bash
    crontab -e
    Add this line to the bottom of the file:

    Plaintext
    */5 * * * * /usr/local/bin/tuner_cleanup.sh > /dev/null 2>&1
    Save and exit.

    How it works
    Safety: The script checks the pps (packets per second) value for every tuner. It only issues a reset command (channel none) if pps is 0, meaning the tuner is genuinely idle.

    Non-destructive: If a tuner is actively streaming, pps will be greater than 0, and the script will ignore it.

    Precision: This targets only the "stuck" state, ensuring your active recordings or live TV sessions are never interrupted.

  6. LinuxServer-CI commented on Aug 31, 2026

    @LinuxServer-CI
    Collaborator

    This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

  7. moved this from Issues to Done in Issue & PR Trackeron Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions