To help improve PyViCare, you can provide device response data for new test cases. Use the dump_secure() method to generate a JSON file that automatically removes sensitive information like installation IDs and serial numbers.
You can provide credentials via environment variables: PYVICARE_CLIENT_ID, PYVICARE_EMAIL, and PYVICARE_PASSWORD.
Steps to create a test dump:
- Run the following script to generate
dump.json. - Sort the JSON using
jq to ensure compatibility with future updates:jq ".data|=sort_by(.feature)" --sort-keys testData.json > testDataSorted.json
- Commit the resulting file to
tests/response using the naming convention <family><model>.
import os
from PyViCare.PyViCare import PyViCare
client_id = os.getenv("PYVICARE_CLIENT_ID", "INSERT_CLIENT_ID")
email = os.getenv("PYVICARE_EMAIL", "email@domain")
password = os.getenv("PYVICARE_PASSWORD", "password")
vicare = PyViCare()
vicare.initWithCredentials(email, password, client_id, "token.save")
with open(f"dump.json", mode='w') as output:
output.write(vicare.devices[0].dump_secure())