burnnat / ha-hdhomerun

HDHomeRun integration for Home Assistant.
MIT License
15 stars 6 forks source link

Issues once devices found #2

Closed pssc closed 4 years ago

pssc commented 4 years ago
2020-01-04 19:20:40 DEBUG (MainThread) [custom_components.hdhomerun.sensor] Scanning network for HDHomeRun devices
2020-01-04 19:20:41 DEBUG (MainThread) [custom_components.hdhomerun.sensor] Detected 4 tuners for device: 1251E8E2
2020-01-04 19:20:41 DEBUG (MainThread) [custom_components.hdhomerun.sensor] Fetching status for tuner: 1251E8E2-1
2020-01-04 19:20:41 ERROR (MainThread) [hdhr.adapter] Could not get tuner vstatus (0).
2020-01-04 19:20:41 ERROR (MainThread) [homeassistant.components.sensor] hdhomerun: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
    await self.async_update()
  File "/config/custom_components/hdhomerun/sensor.py", line 69, in async_update
    (vstatus, raw_data) = self._adapter.get_tuner_vstatus()
  File "/usr/local/lib/python3.7/site-packages/hdhr/adapter.py", line 191, in get_tuner_vstatus
    raise Exception(message)
Exception: Could not get tuner vstatus (0).
2020-01-04 19:20:41 DEBUG (MainThread) [custom_components.hdhomerun.sensor] Fetching status for tuner: 1251E8E2-3
2020-01-04 19:20:41 ERROR (MainThread) [hdhr.adapter] Could not get tuner vstatus (0).
2020-01-04 19:20:41 ERROR (MainThread) [homeassistant.components.sensor] hdhomerun: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
    await self.async_update()
  File "/config/custom_components/hdhomerun/sensor.py", line 69, in async_update
    (vstatus, raw_data) = self._adapter.get_tuner_vstatus()
  File "/usr/local/lib/python3.7/site-packages/hdhr/adapter.py", line 191, in get_tuner_vstatus
    raise Exception(message)
Exception: Could not get tuner vstatus (0).
2020-01-04 19:20:41 DEBUG (MainThread) [custom_components.hdhomerun.sensor] Fetching status for tuner: 1251E8E2-0
2020-01-04 19:20:41 ERROR (MainThread) [hdhr.adapter] Could not get tuner vstatus (0).
2020-01-04 19:20:41 ERROR (MainThread) [homeassistant.components.sensor] hdhomerun: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
    await self.async_update()
  File "/config/custom_components/hdhomerun/sensor.py", line 69, in async_update
    (vstatus, raw_data) = self._adapter.get_tuner_vstatus()
  File "/usr/local/lib/python3.7/site-packages/hdhr/adapter.py", line 191, in get_tuner_vstatus
    raise Exception(message)
Exception: Could not get tuner vstatus (0).
2020-01-04 19:20:41 DEBUG (MainThread) [custom_components.hdhomerun.sensor] Fetching status for tuner: 1251E8E2-2
2020-01-04 19:20:41 ERROR (MainThread) [hdhr.adapter] Could not get tuner vstatus (0).
2020-01-04 19:20:41 ERROR (MainThread) [homeassistant.components.sensor] hdhomerun: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
    await self.async_update()
  File "/config/custom_components/hdhomerun/sensor.py", line 69, in async_update
    (vstatus, raw_data) = self._adapter.get_tuner_vstatus()
  File "/usr/local/lib/python3.7/site-packages/hdhr/adapter.py", line 191, in get_tuner_vstatus
    raise Exception(message)
Exception: Could not get tuner vstatus (0).
burnnat commented 4 years ago

Thanks for the report. According to the underlying library provided by Silicondust, it looks like a 0 result means "the operation was rejected" but there's no indication what could lead to that. I'll try to do a little digging and see if I can come up with any ideas. If you have the hdhomerun_config command-line utility are you able to query the tuner status that way?

burnnat commented 4 years ago

Also, could you provide some info about what HDHomeRun device you have? The library documentation is pretty sparse but I'm wondering if the vstatus API is only supported on certain models (in which case we'd need to fall back to a different API as appropriate).

burnnat commented 4 years ago

On further reading, it looks like the output of hdhomerun_config <device-id> get help lists the APIs supported by that device. If you are able to run that and post the results, that would be great.

pssc commented 4 years ago

All looks ok from the cli

hdhomerun_config 1251E8E2 get /sys/version
➜  ~ hdhomerun_config 1251E8E2 get /sys/version
20190621
➜  ~ hdhomerun_config 1251E8E2 get /sys/hwmodel
HDHR5-4DT
➜  ~ hdhomerun_config 1251E8E2 get /sys/features
channelmap: eu-bcast au-bcast tw-bcast
modulation: tt8qam256 tt8qam64 tt8qam16 tt8qpsk tt7qam256 tt7qam64 tt7qam16 tt7psk tt6qam256 tt6qam64 tt6qam16 tt6qpsk t8qam64 t8qam16 t8qpsk t7qam64 t7qam16 t7qpsk t6qam64 t6qam16 t6qpsk
auto-modulation: auto auto8t auto7t auto6t

➜  ~ hdhomerun_config 1251E8E2 get /tuner0/status
ch=none lock=none ss=0 snq=0 seq=0 bps=0 pps=0
➜  ~ hdhomerun_config 1251E8E2 get /sys/debug
mem: nbk=2 dmk=374 fet=0
loop: pkt=0
t0: pt=11 cal=-5540
t1: pt=11 cal=-5518
t2: pt=11 cal=-5540
t3: pt=11 cal=-5540
eth: link=100f

➜  ~ hdhomerun_config 1251E8E2 get help /
Supported configuration options:
/lineup/scan
/sys/copyright
/sys/debug
/sys/features
/sys/hwmodel
/sys/model
/sys/restart <resource>
/sys/version
/tuner<n>/channel <modulation>:<freq|ch>
/tuner<n>/channelmap <channelmap>
/tuner<n>/debug
/tuner<n>/filter "0x<nnnn>-0x<nnnn> [...]"
/tuner<n>/lockkey
/tuner<n>/program <program number>
/tuner<n>/status
/tuner<n>/streaminfo
/tuner<n>/target <ip>:<port>
/tuner<n>/vchannel <vchannel>

➜  ~ hdhomerun_config discover
hdhomerun device 1251E8E2 found at 192.168.78.145
➜  ~ hdhomerun_config 1251E8E2 get /tuner1/status
ch=none lock=none ss=0 snq=0 seq=0 bps=0 pps=0
➜  ~ hdhomerun_config 1251E8E2 get /tuner2/status
ch=none lock=none ss=0 snq=0 seq=0 bps=0 pps=0
➜  ~ hdhomerun_config 1251E8E2 get /tuner3/status
ch=none lock=none ss=0 snq=0 seq=0 bps=0 pps=0
florafrisia commented 4 years ago

(homeassistant) ➜ libhdhomerun git:(master) ✗ ./hdhomerun_config discover hdhomerun device 14104765 found at 192.168.xxx.xxx

(homeassistant) ➜ libhdhomerun git:(master) ✗ ./hdhomerun_config discover get /sys/version invalid ip address: get

(homeassistant) ➜ libhdhomerun git:(master) ✗ ./hdhomerun_config 14104765 get /sys/version 20190621

(homeassistant) ➜ libhdhomerun git:(master) ✗ ./hdhomerun_config 14104765 get /sys/model
hdhomerun3_dvbc

(homeassistant) ➜ libhdhomerun git:(master) ✗ ./hdhomerun_config 14104765 get /sys/features channelmap: eu-cable au-cable tw-cable modulation: a8qam256- a8qam128- a8qam64- a7qam256- a7qam128- a7qam64- a6qam256- a6qam128- a6qam64-* auto-modulation: auto auto8c auto7c auto6c

(homeassistant) ➜ libhdhomerun git:(master) ✗ ./hdhomerun_config 14104765 get /tuner0/status ch=none lock=none ss=0 snq=0 seq=0 bps=0 pps=0

(homeassistant) ➜ libhdhomerun git:(master) ✗ ./hdhomerun_config 14104765 get /sys/debug
mem: nbm=622811/13653 npf=81918 dmf=1236781 loop: pkt=0 t0: pt=11 cal=-532 t1: pt=11 cal=-529 t2: pt=11 cal=-531 t3: pt=11 cal=-536 eth: link=1000f

florafrisia commented 4 years ago

I've the same issue.

with kind regards,

Peter

burnnat commented 4 years ago

Thanks, according to the get help output it looks like these devices don't support the /tuner/vstatus API so will need to add a fallback to /tuner/status in that case. Will work on an update for this.

burnnat commented 4 years ago

I've pushed a change in version 0.0.4 that should hopefully resolve this. I don't have any actual hardware to test it with though, so if you continue to have issues after updating please let me know.

aptonline commented 4 years ago

I've pushed a change in version 0.0.4 that should hopefully resolve this. I don't have any actual hardware to test it with though, so if you continue to have issues after updating please let me know.

That seems to be working now for me, showing both my tuners. However the state changes to something random when viewing a channel:

t8qam64:714000000

Is this expected behaviour?

EDIT: After a quick google search I see that this is the modulation t8qam64 and frequency 714000000 for the channel the tuner is tuned to. How can this be made more meaningful in HA if at all?

burnnat commented 4 years ago

Yes, when the tuner is active the state will be the raw QAM channel in use. The vstatus API is what provides the user-friendly "virtual" channel number, but since your device apparently doesn't support it, the raw channel number is used instead. If you can find a way to get a friendly number using the hdhomerun_config CLI, post the command(s) and I should be able to figure out the corresponding API.

burnnat commented 4 years ago

On closer reading of the documentation, it looks like it may be possible to determine the virtual channel number using a combination of the streaminfo and program APIs (assuming this info is populated by your TV provider). Could you run the following commands on an active tuner and paste the output here?

hdhomerun_config <device> get /tuner<n>/streaminfo
hdhomerun_config <device> get /tuner<n>/program

Thanks!

pssc commented 4 years ago

hdhomerun_config 1251E8E2 get /tuner0/streaminfo| grep $(hdhomerun_config 1251E8E2 get /tuner0/program)

Will give channel selected on the tuner by name, I was using this already ;-)

Phill.

On Sun, 12 Jan 2020 at 20:27, Nat Burns notifications@github.com wrote:

On closer reading of the documentation, it looks like it may be possible to determine the virtual channel number using a combination of the streaminfo and program APIs (assuming this info is populated by your TV provider). Could you run the following commands on an active tuner and paste the output here?

hdhomerun_config get /tuner/streaminfo hdhomerun_config get /tuner/program

Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/burnnat/ha-hdhomerun/issues/2?email_source=notifications&email_token=AANORYNGNQ3AM2TOPJDSYW3Q5N4KBA5CNFSM4KCXTEMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIXDLNY#issuecomment-573453751, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANORYJ5ZJOQNR6NG4JY6STQ5N4KBANCNFSM4KCXTEMA .

-- I Can Resist Everything Except Temptation -- Oscar Wilde