Пример #1
0
def test_get_short_uuid_from_name():
    assert ServicesTypes.get_short_uuid("public.hap.service.doorbell") == "121"
Пример #2
0
with open("aiohomekit/model/characteristics/data.py", "w") as fp:
    fp.write(
        textwrap.dedent("""
    # AUTOGENERATED, DO NOT EDIT

    characteristics = 
    """).strip())
    fp.write(" " + json.dumps(characteristics, indent=4))
    fp.write("\n")

from aiohomekit.model.services import ServicesTypes

for serv in data.get('Services', []):
    name = serv['Name'].replace(" ", "_").upper()
    short = ServicesTypes.get_short_uuid(serv['UUID'])
    print(f'{name} = "{short}"')

services = {}

for serv in data.get('Services', []):
    name = serv['Name'].replace(" ", "_").upper()

    s = services[serv['UUID']] = {
        'name': name,
        'description': serv['Name'],
        'required': serv.get("RequiredCharacteristics", []),
        'optional': serv.get("OptionalCharacteristics", []),
    }

with open("aiohomekit/model/services/data.py", "w") as fp:
Пример #3
0
def test_get_short_uuid_from_uuid():
    assert ServicesTypes.get_short_uuid("00000086-0000-1000-8000-0026BB765291") == "86"