Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: incorrect Media Player state messages on hass.agent/media_player/hostname/state MQTT topic #224

Open
3 of 6 tasks
shineangelic opened this issue Jan 21, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@shineangelic
Copy link

shineangelic commented Jan 21, 2025

Media player is not reporting/unavailable. Several MQTT messages are being pushed, all "empty":

{
  "duration": 0,
  "currentposition": 0,
  "state": "off",
  "volume": 0,
  "muted": false
}

Hass.Agent2 is working overall, both Media controls (volume, play/pause) and sensors/commands are working correctly, even tho the media player is always reported as "idle"

To Reproduce
Well, a long story started with an unfortunate hostname change, at first it was working. Had to start over many times, reinstalling both the agent and the integration. Had some luck removing \AppData\Local\HASS.Agent\ and also followed LAB02-Research/HASS.Agent-Integration#23 (comment) in order to 'clean' stale mqtt topics, but now I'm stuck with no luck making the media player reporting its state via MQTT. Other topics are ok (homeassistant/sensor-tag-button etc.)

Expected behavior
MQTT messages published reporting correct media player status (ie. from MusicBee or others), not empty ones. I would expect to see the artist picture as shown in the docs page.

Screenshots

Image

quite strangely, if I execute a 'mute' command from HA Device, it's correctly executed (it mutes win media player) but the reported "muted" state is again incorrect thereafter:

Image

Misc info (please complete the following information):

  • Windows 11
  • Hass Integration 2.1.1
  • HASS.Agent version: 2.1.0

Please check what's applicable (multiple answers possible):

  • Installed via installer
  • Installed manually
  • Problem occurs in HASS.Agent
  • Problem occurs in Satellite Service
  • MQTT messages are published under HASS.Agent topic
  • MQTT state message reflects actual media player status

Additional context
I'm inspecting the mqtt published messages via MQTT explorer, seeing many 'empty' media player state messages. The commands somewhat works, but I'm of course not seeing any info on HA side.

Logs

2025-01-21 23:29:47.534 +01:00 [INF] [MAIN] HASS.Agent version: 2.1.0
2025-01-21 23:29:47.537 +01:00 [INF] [MAIN] Extended logging enabled
2025-01-21 23:29:47.541 +01:00 [INF] [SETTINGS] Config storage path: C:\Users\Ale\AppData\Local\HASS.Agent\Client\config
2025-01-21 23:29:47.557 +01:00 [FTL] [PROGRAM] FirstChanceException: The process cannot access the file 'C:\Users\Ale\AppData\Local\HASS.Agent\Client\logs\[2025-01-21] HASS.Agent_20250121.log' because it is being used by another process.
System.IO.IOException: The process cannot access the file 'C:\Users\Ale\AppData\Local\HASS.Agent\Client\logs\[2025-01-21] HASS.Agent_20250121.log' because it is being used by another process.
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.File.Open(String path, FileMode mode, FileAccess access, FileShare share)
   at Serilog.Sinks.File.FileSink..ctor(String path, ITextFormatter textFormatter, Nullable`1 fileSizeLimitBytes, Encoding encoding, Boolean buffered, FileLifecycleHooks hooks)
   at Serilog.Sinks.File.RollingFileSink.OpenFile(DateTime now, Nullable`1 minSequence)
2025-01-21 23:29:47.642 +01:00 [INF] [SETTINGS] Configuration loaded
2025-01-21 23:29:47.646 +01:00 [INF] [LOCALIZATION] Selected UI culture: [en] English
2025-01-21 23:29:47.814 +01:00 [DBG] [RADIOMGR] Initialization started
2025-01-21 23:29:47.856 +01:00 [INF] [RADIOMGR] Radio management permission granted
2025-01-21 23:29:47.856 +01:00 [DBG] [RADIOMGR] Enumerating proximity/NFC devices
2025-01-21 23:29:47.875 +01:00 [INF] [RADIOMGR] Ready
2025-01-21 23:29:49.906 +01:00 [INF] [INTERNALSENSORS] Ready
2025-01-21 23:29:51.923 +01:00 [FTL] [PROGRAM] FirstChanceException: Access to the path 'Global\Access_ISABUS.HTP.Method' is denied.
System.UnauthorizedAccessException: Access to the path 'Global\Access_ISABUS.HTP.Method' is denied.
   at System.Threading.Mutex.CreateMutexCore(Boolean initiallyOwned, String name, Boolean& createdNew)
   at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name)
   at LibreHardwareMonitor.Hardware.Mutexes.<Open>g__CreateOrOpenExistingMutex|4_0(String name)

[....]

2025-01-21 23:40:10.132 +01:00 [FTL] [PROGRAM] FirstChanceException: Access to the path 'Global\Access_ISABUS.HTP.Method' is denied.
System.UnauthorizedAccessException: Access to the path 'Global\Access_ISABUS.HTP.Method' is denied.
   at System.Threading.Mutex.OpenExistingWorker(String name, Mutex& result)
   at System.Threading.Mutex.OpenExisting(String name)
   at LibreHardwareMonitor.Hardware.Mutexes.<Open>g__CreateOrOpenExistingMutex|4_0(String name)
2025-01-21 23:40:10.132 +01:00 [FTL] [PROGRAM] FirstChanceException: Access to the path 'Global\Access_PCI' is denied.
System.UnauthorizedAccessException: Access to the path 'Global\Access_PCI' is denied.
   at System.Threading.Mutex.CreateMutexCore(Boolean initiallyOwned, String name, Boolean& createdNew)
   at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name)
   at LibreHardwareMonitor.Hardware.Mutexes.<Open>g__CreateOrOpenExistingMutex|4_0(String name)
2025-01-21 23:40:10.132 +01:00 [FTL] [PROGRAM] FirstChanceException: Access to the path 'Global\Access_PCI' is denied.
System.UnauthorizedAccessException: Access to the path 'Global\Access_PCI' is denied.
   at System.Threading.Mutex.OpenExistingWorker(String name, Mutex& result)
   at System.Threading.Mutex.OpenExisting(String name)
   at LibreHardwareMonitor.Hardware.Mutexes.<Open>g__CreateOrOpenExistingMutex|4_0(String name)

[...]

2025-01-21 23:40:10.603 +01:00 [INF] [VIRTDESKT] Virtual Desktop Manager initialized
2025-01-21 23:40:10.603 +01:00 [DBG] [AUDIOMGR] initializing
2025-01-21 23:40:10.999 +01:00 [INF] [AUDIOMGR] initialized
2025-01-21 23:40:11.010 +01:00 [INF] [SETTINGS_QUICKACTIONS] Config not found, no entities loaded
2025-01-21 23:40:11.012 +01:00 [INF] [SETTINGS_COMMANDS] Config not found, no entities loaded
2025-01-21 23:40:11.013 +01:00 [INF] [SETTINGS_SENSORS] Config not found, no entities loaded
2025-01-21 23:40:11.017 +01:00 [INF] [LOCALAPI] Disabled
2025-01-21 23:40:11.017 +01:00 [INF] [MQTT] Identifying as device: DRONE
2025-01-21 23:40:11.019 +01:00 [INF] [HOTKEY] Completed bind for global quickaction hotkey
2025-01-21 23:40:11.023 +01:00 [INF] [MQTT] Connecting ..
2025-01-21 23:40:11.030 +01:00 [INF] [SERVICE] Local install path: C:\Program Files\HASS.Agent Satellite Service\Service\
2025-01-21 23:40:11.074 +01:00 [INF] [MEDIA] Ready
2025-01-21 23:40:11.083 +01:00 [WRN] [MEDIA] No MediaSession active
2025-01-21 23:40:11.085 +01:00 [INF] [MQTT] Connected
2025-01-21 23:40:11.088 +01:00 [INF] [HASS_API] Home Assistant version: 2025.1.3
2025-01-21 23:40:11.097 +01:00 [INF] [NOTIFIER] Ready
2025-01-21 23:40:11.128 +01:00 [INF] [HASS_API] System connected with http://homeassistant.local:8123
2025-01-21 23:40:13.039 +01:00 [INF] [MQTT] Initial registration completed
2025-01-21 23:41:28.374 +01:00 [INF] [COMMANDS] Added command: mediamute
2025-01-21 23:41:28.380 +01:00 [INF] [SETTINGS_COMMANDS] Stored 1 entities
@shineangelic shineangelic added the bug Something isn't working label Jan 21, 2025
@shineangelic shineangelic changed the title Bug: Bug: incorrect Media Player state messages on hass.agent/media_player/hostname/state MQTT topic Jan 21, 2025
@amadeo-alex
Copy link
Collaborator

Hmm, I think I need to fully wrap my head around this.
Let's have and example, open Firefox (or other application that is integrated with windows media player controls) while HASS.Agent is running, does it pass on the information to HA or the messages are still empty?

Example of the media player controls I'm talking about:

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants