hass-agent / HASS.Agent

Unofficial development project for the HASS.Agent platform.
https://hass-agent.io
MIT License
209 stars 7 forks source link

Bug: error in log - Error while fetching audio info: Element not found. (0x80070490) #96

Open knezmilos13 opened 1 month ago

knezmilos13 commented 1 month ago

I've switched over from the original HASS.Agent to this version a few days ago and now I have a couple of problems, the first being outlined here. I've checked the logs and there appears to be an error every time the audio sensor is read: [FTL] [AUDIO] [audio] Error while fetching audio info: Element not found. (0x80070490) Even with this error appearing in log, it seems that I'm getting correct audio info in home assistant.

To Reproduce Error log entry appears every time audio sensor is read

Misc info

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

Logs

2024-05-29 09:23:23.515 +02:00 [INF] [MAIN] HASS.Agent version: 2.0.1
2024-05-29 09:23:23.523 +02:00 [INF] [SETTINGS] Config storage path: C:\Users\Milos\AppData\Local\HASS.Agent\Client\config
2024-05-29 09:23:23.739 +02:00 [INF] [SETTINGS] Configuration loaded
2024-05-29 09:23:23.742 +02:00 [INF] [LOCALIZATION] Selected UI culture: [en] English
2024-05-29 09:23:24.337 +02:00 [FTL] [RADIOMGR] No permission granted for Bluetooth radio management
2024-05-29 09:23:26.431 +02:00 [INF] [INTERNALSENSORS] Ready
2024-05-29 09:23:29.510 +02:00 [ERR] [VIRTDESKT] Error initializing Virtual Desktop Manager, your Windows version may be unsupported
2024-05-29 09:23:29.561 +02:00 [INF] [SETTINGS_QUICKACTIONS] Loaded 20 entities
2024-05-29 09:23:29.594 +02:00 [INF] [SETTINGS_COMMANDS] Loaded 48 entities
2024-05-29 09:23:29.852 +02:00 [FTL] [AUDIO] [audio] Error while fetching audio info: Element not found. (0x80070490)
System.Runtime.InteropServices.COMException (0x80070490): Element not found. (0x80070490)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
   at CoreAudio.MMDeviceEnumerator.GetDefaultAudioEndpoint(DataFlow dataFlow, Role role)
   at HASS.Agent.Shared.HomeAssistant.Sensors.GeneralSensors.MultiValue.AudioSensors.HandleAudioInputSensors(String parentSensorSafeName, String deviceName) in D:\a\HASS.Agent\HASS.Agent\src\HASS.Agent\HASS.Agent.Shared\HomeAssistant\Sensors\GeneralSensors\MultiValue\AudioSensors.cs:line 127
   at HASS.Agent.Shared.HomeAssistant.Sensors.GeneralSensors.MultiValue.AudioSensors.UpdateSensorValues() in D:\a\HASS.Agent\HASS.Agent\src\HASS.Agent\HASS.Agent.Shared\HomeAssistant\Sensors\GeneralSensors\MultiValue\AudioSensors.cs:line 177
2024-05-29 09:23:29.852 +02:00 [INF] [SETTINGS_SENSORS] Loaded 2 entities
2024-05-29 09:23:29.857 +02:00 [INF] [HOTKEY] Completed bind for global quickaction hotkey
2024-05-29 09:23:29.859 +02:00 [INF] [HOTKEY] Completed bind for 20 individual quickaction hotkeys
2024-05-29 09:23:30.066 +02:00 [INF] [MQTT] Identifying as device: DESKTOP_MILOS
2024-05-29 09:23:30.067 +02:00 [INF] [LOCALAPI] Disabled
2024-05-29 09:23:30.087 +02:00 [INF] [MQTT] Connecting ..
2024-05-29 09:23:30.190 +02:00 [INF] [MEDIA] Ready
2024-05-29 09:23:30.213 +02:00 [INF] [SERVICE] Local install path: C:\Program Files\HASS.Agent\Service\
2024-05-29 09:23:30.340 +02:00 [INF] [MQTT] Connected
2024-05-29 09:23:30.343 +02:00 [INF] [HASS_API] Home Assistant version: 2024.5.5
2024-05-29 09:23:30.428 +02:00 [INF] [NOTIFIER] Ready
2024-05-29 09:23:30.458 +02:00 [INF] [HASS_API] System connected with http://homeassistant.local:8123
2024-05-29 09:23:31.316 +02:00 [FTL] [AUDIO] [audio] Error while fetching audio info: Element not found. (0x80070490)
System.Runtime.InteropServices.COMException (0x80070490): Element not found. (0x80070490)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
   at CoreAudio.MMDeviceEnumerator.GetDefaultAudioEndpoint(DataFlow dataFlow, Role role)
   at HASS.Agent.Shared.HomeAssistant.Sensors.GeneralSensors.MultiValue.AudioSensors.HandleAudioInputSensors(String parentSensorSafeName, String deviceName) in D:\a\HASS.Agent\HASS.Agent\src\HASS.Agent\HASS.Agent.Shared\HomeAssistant\Sensors\GeneralSensors\MultiValue\AudioSensors.cs:line 127
   at HASS.Agent.Shared.HomeAssistant.Sensors.GeneralSensors.MultiValue.AudioSensors.UpdateSensorValues() in D:\a\HASS.Agent\HASS.Agent\src\HASS.Agent\HASS.Agent.Shared\HomeAssistant\Sensors\GeneralSensors\MultiValue\AudioSensors.cs:line 177
2024-05-29 09:23:32.112 +02:00 [INF] [MQTT] Initial registration completed
2024-05-29 19:44:48.093 +02:00 [INF] [HASS_API] [light.radni_prostor] Performing action: toggle
amadeo-alex commented 1 month ago

I've also noticed this some in some cases. I'm reworking audio management with 2.1.0-beta2 so I'll leave this open until this happens.