Join the webinar on 'Open source GenAI tools for Test Automation' on May 28th or May 30th.
close
Streamlining Testing for Smart Home Devices with HeadSpin AV Box Solution

Testing Smart Home Devices with HeadSpin: Simplifying a Complex Task

March 29, 2024
 by 
David BrokerDavid Broker
David Broker

Testing smart home devices poses a unique challenge for many organizations. From ensuring seamless integration with virtual assistants like Alexa and Google Mini to verifying functionalities such as routine automation and order processing, the intricacies involved can be overwhelming. Factors such as scalability, distributed teams, and the necessity of testing on physical hardware further complicate matters. However, HeadSpin offers a solution to alleviate these challenges through our AV Box solution.

Our AV Box solution empowers users to effortlessly send audio commands, either manually or through automation via HeadSpin's cloud platform, addressing common testing obstacles. For manual users, simply click the microphone icon to interact with the browser. After issuing commands, users can verify the accuracy of audio transmission from the Smart Home device by clicking the speaker icon to listen to the streamed audio. Below is an illustrative example:

To facilitate automated scenarios, it's essential to prepare an audio file suitable for uploading onto the HeadSpin Platform, enabling control over smart home devices. For instance, if you intend to inquire about the weather via Google Assistant for testing purposes, you'll require a recorded file with someone saying, "Hey Google, what's the weather like today?" While various tools can aid in generating such audio, it's crucial to ensure its realism, as smart devices are designed to disregard robotic voices.

Since there are not many frameworks that allow for testing against a broad range of real smart home devices, HeadSpin will allow you to use the audio directions described above. To automate the testing for these, we will use the AV Box APIs. https://www.headspin.io/docs/avbox-api We will start recording the session on the Camera Device. We will then prepare and send the audio that contains the instructions for the smart home device that we are testing for the specific use case. Then, observe the outcome of the performance session.

Example of an API flow.

Lock the camera device: https://www.headspin.io/docs/devices-api#lock-a-device


curl -X POST https://<your_api_token>@api-dev.headspin.io/v0/devices/lock --data '{"device_id":"my_device"}' -H "Content-Type: application/json"

Then prepare the audio that you want to send over: https://www.headspin.io/docs/avbox-api#prepare


curl --request POST https://<your_api_token>@api-dev.headspin.io/v0/avbox/prepare --data '{"hostname": "host.headspin.io", "audio_ids": ["6fd55663-0aa4-416e-a752-cfab81a13701"]}'

Then, record the camera device with the create session API for this use case, it is not necessary to capture the network of the device, so typically, just capturing the video is all that is needed: https://www.headspin.io/docs/session-api#create-a-session


curl -X POST https://<your_api_token>@api-dev.headspin.io/v0/sessions -d '{"session_type": "capture",”capture_network”: false, "device_address": "my_device@host.headspin.io"}'

Then send your audio that was prepared before: https://www.headspin.io/docs/avbox-api#playback


curl --request POST https://<your_api_token>@api-dev.headspin.io/v0/avbox/play/start --data '{ "device_address": "my_device@host.headspin.io", "media_id": "6fd55663-0aa4-416e-a752-cfab81a13701", "screen": "self"}'

Then, after the audio has finished, which can be derived by querying the playback worker that results from the playback API above or by explicitly waiting until the audio finishes, you can stop the recording session. The session ID will be passed back from the start session API: https://www.headspin.io/docs/session-api#stop-a-session


curl -X PATCH https://<your_api_token>@api-dev.headspin.io/v0/sessions/{session_id} -d '{"active": false}'

Then, lastly, unlock the device: https://www.headspin.io/docs/devices-api#unlock-a-device


curl -X POST https://<your_api_token>@api-dev.headspin.io/v0/devices/unlock --data ‘{"device_id":"my_device"}’ -H "Content-Type: application/json"

As these functionalities are all API-driven, they can seamlessly integrate with various types of Home Devices using the same script. The primary differentiators lie in the device addresses and audio IDs, facilitating extensive reusability within your testing framework.

Testing Smart Home Devices with HeadSpin: Simplifying a Complex Task

4 Parts

Close

Perfect Digital Experiences with Data Science Capabilities

Utilize HeadSpin's advanced capabilities to proactively improve performance and launch apps with confidence
popup image