Open joshuar opened 9 months ago
I'm not 100% sure if you have access to this on your end, but a couple things that might be helpful:
You can see a list of all microphones using arecord
:
jay@Navua-Neon:/dev/snd$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Ultimate [Razer Nari Ultimate], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Generic [HD-Audio Generic], device 0: ALC1220 Analog [ALC1220 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Generic [HD-Audio Generic], device 2: ALC1220 Alt Analog [ALC1220 Alt Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 3: C930e [Logitech Webcam C930e], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
If the microphone is in use, lsof
will return an output associated with it - assuming you know the microphone ID (capture information on card 1, device 0 here - aka C1D0c or Card1Device0capture).
jay@Navua-Neon:/dev/snd$ lsof /dev/snd/pcmC1D0c
lsof: WARNING: can't stat() overlay file system /var/lib/docker/overlay2/5fded3f178384781127daf6c34fabba88f8e1146d286fd8fbe0db0c59229a534/merged
Output information may be incomplete.
lsof: WARNING: can't stat() overlay file system /var/lib/docker/overlay2/452460be3173a7bd5e56d88f8a2ca775a4c6fad529d6216c671fbad21873c55c/merged
Output information may be incomplete.
lsof: WARNING: can't stat() nsfs file system /run/docker/netns/997e324acb67
Output information may be incomplete.
lsof: WARNING: can't stat() nsfs file system /run/docker/netns/3c6298a7ffce
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
pulseaudi 1284 jay mem CHR 116,17 1218 /dev/snd/pcmC1D0c
pulseaudi 1284 jay 91u CHR 116,17 0t0 1218 /dev/snd/pcmC1D0c
If the machine has PulseAudio, you can do that to get cleaner output without needing to fumble through figuring out which devices are available:
jay@Navua-Neon:/dev/snd$ pactl list source-outputs
Source Output #33
Driver: protocol-native.c
Owner Module: 10
Client: 29
Source: 3
Sample Specification: s16le 1ch 44100Hz
Channel Map: mono
Format: pcm, format.sample_format = "\"s16le\"" format.rate = "44100" format.channels = "1" format.channel_map = "\"mono\""
Corked: no
Mute: no
Volume: mono: 65536 / 100% / 0.00 dB
balance 0.00
Buffer Latency: 0 usec
Source Latency: 2507 usec
Resample method: n/a
Properties:
media.name = "recStream"
application.name = "ZOOM VoiceEngine"
native-protocol.peer = "UNIX socket client"
native-protocol.version = "35"
application.process.id = "61602"
application.process.user = "jay"
application.process.host = "Navua-Neon"
application.process.binary = "zoom"
application.language = "en_US.UTF-8"
window.x11.display = ":1"
application.process.machine_id = "b6874eae2f1547e582d67dd83ca49e8e"
application.process.session_id = "1"
module-stream-restore.id = "source-output-by-application-name:ZOOM VoiceEngine"
In this case, Zoom is using my microphone (process 61602).
Output is empty when nothing is using the Pulseaudio microphone:
jay@Navua-Neon:/dev/snd$ pactl list source-outputs
jay@Navua-Neon:/dev/snd$
What are the sensors you would like to see in Go Hass Agent? What do they measure? Why are they useful? How would you use them in Home Assistant?
How do you access the sensor(s) currently?