JurajNyiri / HomeAssistant-Tapo-Control

Control for Tapo cameras as a Home Assistant component
Apache License 2.0
968 stars 81 forks source link

Feature Request: Modify microphone level #417

Closed Charles-HL closed 8 months ago

Charles-HL commented 9 months ago

Is your feature request related to a problem? Please describe. N/A

Describe the solution you'd like The Tapo app gives the ability to modify the microphone level of the camera. It would be nice to be able to modify it through home assistant too.

Describe alternatives you've considered N/A

Additional context N/A

JurajNyiri commented 9 months ago

Where is this done in the app? Could you please post pictures?

Gabba-63 commented 9 months ago

Tapo mic

JurajNyiri commented 9 months ago

Someone will need to find the correct call that happens from phone to camera once this is adjusted and then we can implement this.

kobrata0912 commented 8 months ago

@JurajNyiri I've played around for a few days with pytapo and read through the documentation that helped create it, and I've come up with a solution that was working for me to change the microphone level and disable the Privacy mode locally. Here it is below. I hope it helps you, and you can implement it!

from pytapo import Tapo user = USERNAME password = PASSWORD host = HOST_IP tapo_one = Tapo(host, user, password) tapo_one.setPrivacyMode(False) tapo_one.executeFunction('setMicrophoneVolume', {'method':'set', 'audio_config': {'microphone': {'volume': '100'}}})

JurajNyiri commented 8 months ago

Thank you that is great! I will implement it soon. We will need to also find if there's a function to get the current volume.

kobrata0912 commented 8 months ago

@JurajNyiri This will help you find all current values for the microphone and the speaker.

tapo.executeFunction('getAudioConfig', {'method':'get', 'audio_config': {'name':['speaker', 'microphone']}})

This is the reply back: {'audio_config': {'speaker': {'.name': 'speaker', '.type': 'audio_config', 'volume': '100'}, 'microphone': {'.name': 'microphone', '.type': 'audio_config', 'sampling_rate': '8', 'channels': '1', 'encode_type': 'G711alaw', 'mute': 'off', 'noise_cancelling': 'on', 'volume': '100'}}}

You could also add implementation for controlling the camera speaker. This would be the command to set the speaker volume: tapo.executeFunction('setSpeakerVolume', {'method':'set', 'audio_config': {'speaker': {'volume': '50'}}})

JurajNyiri commented 8 months ago

Implemented in https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/releases/tag/5.4.2