lghorizon icon indicating copy to clipboard operation
lghorizon copied to clipboard

Integration stops updating until reload

Open Shivy011 opened this issue 1 year ago • 12 comments

Hi ,

I am using Virgin Media (GB). My integration works for a few hours, then the boxes etc stop responding, at which point I have to reload the integration, and it all works fine again. It is really strange issue, but consistently stops working. The integration is loaded etc and running fine, it just seems to lose the link to the Virgin TV boxes

Shivy011 avatar Nov 16 '23 14:11 Shivy011

Installed two days ago early in the evening.. I am using a Ziggo Next. Worked fine but the integration died in the night, nothing operational on the LG Horizon integration after that.
I am using Home Assistant uptodate version. I have no MQTT and do not need it. Removed the device and deleted the LG Horizon folder to get rid of the errors in the log.

HansOtten avatar Nov 16 '23 17:11 HansOtten

I am also experiencing this issue. My system is currently only locally accessible, could that be related to the connection dropping?

roderik-maker avatar Nov 25 '23 16:11 roderik-maker

It looks like it's encountering an error that it can't recover from. Please enable debug logging for this component and please communicate it to me. Don't forget to obfuscate any sensitive info in your logs.

The support for GB version is minimal, due to the fact that i need a login and a VPN to test and develop new/altered specifications

Sholofly avatar Dec 08 '23 20:12 Sholofly

I'm experiencing the same issue from day 1 that i've installed this add-on. the periode of that it's working varies. I also have to do a reload to get it working again. I've have debugging activated but where do i find the reports ?

ptaudio avatar Dec 10 '23 18:12 ptaudio

I have this issue as well every now and then, I had debug logs enabled for a while and finally, I had an issue again today. In this case, it seems to be related to a short internet outage. The last part of the log was:

2024-01-02 21:20:33.233 DEBUG (Thread-3 (_thread_main)) [lghorizon.models] Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'redacted'
2024-01-02 21:20:33.247 DEBUG (Thread-3 (_thread_main)) [lghorizon.models] Received CONNACK (0, 5)
2024-01-02 21:20:33.317 DEBUG (Thread-3 (_thread_main)) [lghorizon.models] Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'redacted'
2024-01-02 21:22:33.407 DEBUG (Thread-3 (_thread_main)) [lghorizon.models] Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'redacted'
2024-01-02 21:22:33.423 DEBUG (Thread-3 (_thread_main)) [lghorizon.models] Received CONNACK (0, 5)
2024-01-02 21:22:33.492 DEBUG (Thread-3 (_thread_main)) [lghorizon.models] Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'redacted'
2024-01-02 21:24:33.564 DEBUG (Thread-3 (_thread_main)) [lghorizon.models] Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'redacted'
2024-01-02 21:24:33.574 DEBUG (Thread-3 (_thread_main)) [lghorizon.models] Received CONNACK (0, 5)
2024-01-02 21:24:33.645 DEBUG (Thread-3 (_thread_main)) [lghorizon.models] Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'redacted'

I can email you the full log, it's about 6000 lines (I prefer sending it by mail than sharing it in public)

golles avatar Jan 02 '24 20:01 golles

@Shivy011 Since the GB integration stopped working completely, we're not able to reproduce this one. Please, if the Virgin part works again in the future, please feel free to start a new issue.

@golles Please let me know if you experience the same after installing the latest version

Sholofly avatar Jan 19 '24 20:01 Sholofly

@HansOtten I re-read your message. Your box is talking MQTT to be controlled. You don't need a mqtt server, but the LGHorizon acts as a MQTT client

Sholofly avatar Jan 19 '24 20:01 Sholofly

With the update of HA to OS 2024.1.4 the integration with version v0.5.4 it stopped working in CH. Maybe seems like an auth-issue.

Core 2024.1.4 Supervisor 2023.12.1 Operating System 11.4 Frontend 20240104.0

here is what I get from the log in HA:

Logger: lghorizon.lghorizon_api Source: /usr/local/lib/python3.11/site-packages/backoff/_common.py:120 First occurred: 10:12:36 (7 occurrences) Last logged: 10:14:21

Giving up _do_api_call(...) after 3 tries (lghorizon.exceptions.LGHorizonApiConnectionError: Unable to call https://spark-prod-ch.gnp.cloud.sunrisetv.ch/auth-service/v1/mqtt/token. Error:401 Client Error: Unauthorized for url: https://spark-prod-ch.gnp.cloud.sunrisetv.ch/auth-service/v1/mqtt/token)

steuerzentrale avatar Jan 20 '24 09:01 steuerzentrale

I get this issue with the box becoming unavailable too. Although this doesn't fix the root cause of the problem, you can create an automation to reload the integration when it becomes unavailable, which mostly makes the issue go away. I've pasted my full automation below, which if failing to reload on the first attempt will try to reload every five minutes until it's working again. It includes notifications to my phone when it becomes unavailable and then when it has successfully reloaded. You will need to get the entry_id for your own setup from .storage\core.config_entries.

# Virgin TV 360 integration monitor
- id: C61EBCD1-1C2D-4D78-A6F5-443AD8B9ADAE
  alias: "Audio-Visual: Virgin TV 360 integration monitor"
  variables:
    var_date: "{{ now().strftime('%d/%m/%Y') }}"
    var_time: "{{ now().strftime('%H:%M:%S') }}"
  trigger:
    # Virgin TV 360 becomes unavailable
    - platform: state
      entity_id: media_player.virgin_tv_360
      to: unavailable
  action:
    # Send a notification
    - service: notify.rob_s_phone
      data:
        title: Virgin TV 360 Unavailable
        message: >-
          Virgin TV 360 is {{ states('media_player.virgin_tv_360') }}; attempting to reload the integration.<br>
          {{- var_time }} {{ var_date -}}
        data:
          notification_icon: mdi:set-top-box
          actions:
            - action: URI
              title: View
              uri: /lovelace-home/audio-visual
          clickAction: /lovelace-home/audio-visual
          ttl: 0
          priority: high
          color: '#FFA500' # orange
          sticky: true
          group: Audio-Visual
    # While Virgin TV 360 is unavailable
    - repeat:
        while:
          - condition: state
            entity_id: media_player.virgin_tv_360
            state: unavailable
        sequence:
          # Reload the Virgin TV 360 integration
          - service: homeassistant.reload_config_entry
            data:
              entry_id: 12bcd61c119579af4cd401e40171b6d3 # ID from .storage\core.config_entries
          # Try every 5 minutes
          - delay: 00:05:00
    # Send a notification
    - service: notify.rob_s_phone
      data:
        title: Virgin TV 360 Reloaded
        message: >-
          The Virgin TV 360 integration has been reloaded.<br>
          {{- var_time }} {{ var_date -}}
        data:
          notification_icon: mdi:set-top-box
          actions:
            - action: URI
              title: View
              uri: /lovelace-home/audio-visual
          clickAction: /lovelace-home/audio-visual
          ttl: 0
          priority: high
          color: green
          sticky: true
          group: Audio-Visual

robertwigley avatar Jan 25 '24 15:01 robertwigley

@robertwigley @Shivy011 Please let me know if you can retrieve the cause of the unavailabillity. I've tried to make the api as self-healing as i could. I personally don't experience it anymore but if there still situation where the integration can't recover from, let me know. I'll try to fix that.

Sholofly avatar Jan 25 '24 22:01 Sholofly

@robertwigley @Shivy011 Please let me know if you can retrieve the cause of the unavailabillity. I've tried to make the api as self-healing as i could. I personally don't experience it anymore but if there still situation where the integration can't recover from, let me know. I'll try to fix that.

I am out of action at the moment as GB based :(

Shivy011 avatar Jan 25 '24 22:01 Shivy011

Ah thats a pity....we're on it...

Sholofly avatar Jan 26 '24 06:01 Sholofly