Deduplicate blackening (#81802)

pull/81873/head
Aarni Koskela 2022-11-09 17:58:20 +02:00 committed by GitHub
parent f9ff23a2c8
commit f3e85b6492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 1141 additions and 563 deletions

View File

@ -1,4 +1,4 @@
"""Automatically generated by hassfest.
"""This file is automatically generated.
To update, run python3 -m script.hassfest
"""

View File

@ -1,7 +1,8 @@
"""Automatically generated by hassfest.
"""This file is automatically generated.
To update, run python3 -m script.hassfest
"""
from __future__ import annotations
BLUETOOTH: list[dict[str, bool | str | int | list[int]]] = [
@ -10,41 +11,40 @@ BLUETOOTH: list[dict[str, bool | str | int | list[int]]] = [
"manufacturer_id": 820,
},
{
"connectable": False,
"domain": "aranet",
"manufacturer_id": 1794,
"service_uuid": "f0cd1400-95da-4f4b-9ac8-aa55d312af0c",
"connectable": False,
},
{
"connectable": False,
"domain": "aranet",
"manufacturer_id": 1794,
"service_uuid": "0000fce0-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "bluemaestro",
"manufacturer_id": 307,
"connectable": False,
},
{
"domain": "bthome",
"connectable": False,
"domain": "bthome",
"service_data_uuid": "0000181c-0000-1000-8000-00805f9b34fb",
},
{
"domain": "bthome",
"connectable": False,
"domain": "bthome",
"service_data_uuid": "0000181e-0000-1000-8000-00805f9b34fb",
},
{
"domain": "bthome",
"connectable": False,
"domain": "bthome",
"service_data_uuid": "0000fcd2-0000-1000-8000-00805f9b34fb",
},
{
"domain": "fjaraskupan",
"connectable": False,
"manufacturer_id": 20296,
"domain": "fjaraskupan",
"manufacturer_data_start": [
79,
68,
@ -53,143 +53,144 @@ BLUETOOTH: list[dict[str, bool | str | int | list[int]]] = [
65,
82,
],
"manufacturer_id": 20296,
},
{
"connectable": False,
"domain": "govee_ble",
"local_name": "Govee*",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"local_name": "GVH5*",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"local_name": "B5178*",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 6966,
"service_uuid": "00008451-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 63391,
"service_uuid": "00008351-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 26589,
"service_uuid": "00008351-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 57391,
"service_uuid": "00008351-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 18994,
"service_uuid": "00008551-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 818,
"service_uuid": "00008551-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 53579,
"service_uuid": "00008151-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 43682,
"service_uuid": "00008151-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 59970,
"service_uuid": "00008151-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 63585,
"service_uuid": "00008151-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 14474,
"service_uuid": "00008151-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 10032,
"service_uuid": "00008251-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "govee_ble",
"manufacturer_id": 19506,
"service_uuid": "00001801-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"domain": "homekit_controller",
"manufacturer_id": 76,
"manufacturer_data_start": [
6,
],
"manufacturer_id": 76,
},
{
"domain": "ibeacon",
"manufacturer_id": 76,
"manufacturer_data_start": [
2,
21,
],
"manufacturer_id": 76,
},
{
"connectable": False,
"domain": "inkbird",
"local_name": "sps",
"connectable": False,
},
{
"connectable": False,
"domain": "inkbird",
"local_name": "Inkbird*",
"connectable": False,
},
{
"connectable": False,
"domain": "inkbird",
"local_name": "iBBQ*",
"connectable": False,
},
{
"connectable": False,
"domain": "inkbird",
"local_name": "xBBQ*",
"connectable": False,
},
{
"connectable": False,
"domain": "inkbird",
"local_name": "tps",
"connectable": False,
},
{
"domain": "kegtron",
"connectable": False,
"domain": "kegtron",
"manufacturer_id": 65535,
},
{
@ -240,28 +241,28 @@ BLUETOOTH: list[dict[str, bool | str | int | list[int]]] = [
"manufacturer_id": 13,
},
{
"connectable": False,
"domain": "moat",
"local_name": "Moat_S*",
"connectable": False,
},
{
"domain": "oralb",
"manufacturer_id": 220,
},
{
"connectable": False,
"domain": "qingping",
"local_name": "Qingping*",
"connectable": False,
},
{
"connectable": False,
"domain": "qingping",
"local_name": "Lee Guitars*",
"connectable": False,
},
{
"connectable": False,
"domain": "qingping",
"service_data_uuid": "0000fdcd-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"domain": "ruuvitag_ble",
@ -272,31 +273,31 @@ BLUETOOTH: list[dict[str, bool | str | int | list[int]]] = [
"local_name": "Ruuvi *",
},
{
"connectable": False,
"domain": "sensorpro",
"manufacturer_id": 43605,
"manufacturer_data_start": [
1,
1,
164,
193,
],
"connectable": False,
"manufacturer_id": 43605,
},
{
"connectable": False,
"domain": "sensorpro",
"manufacturer_id": 43605,
"manufacturer_data_start": [
1,
5,
164,
193,
],
"connectable": False,
"manufacturer_id": 43605,
},
{
"connectable": False,
"domain": "sensorpush",
"local_name": "SensorPush*",
"connectable": False,
},
{
"domain": "snooz",
@ -307,65 +308,64 @@ BLUETOOTH: list[dict[str, bool | str | int | list[int]]] = [
"service_uuid": "729f0608-496a-47fe-a124-3a62aaa3fbc0",
},
{
"connectable": False,
"domain": "switchbot",
"service_data_uuid": "00000d00-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "switchbot",
"service_data_uuid": "0000fd3d-0000-1000-8000-00805f9b34fb",
"connectable": False,
},
{
"connectable": False,
"domain": "switchbot",
"service_uuid": "cba20d00-224d-11e6-9fb8-0002a5d5c51b",
"connectable": False,
},
{
"connectable": False,
"domain": "thermobeacon",
"service_uuid": "0000fff0-0000-1000-8000-00805f9b34fb",
"manufacturer_data_start": [
0,
],
"manufacturer_id": 16,
"service_uuid": "0000fff0-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "thermobeacon",
"manufacturer_data_start": [
0,
],
"connectable": False,
},
{
"domain": "thermobeacon",
"service_uuid": "0000fff0-0000-1000-8000-00805f9b34fb",
"manufacturer_id": 17,
"manufacturer_data_start": [
0,
],
"connectable": False,
},
{
"domain": "thermobeacon",
"service_uuid": "0000fff0-0000-1000-8000-00805f9b34fb",
"manufacturer_id": 21,
},
{
"connectable": False,
"domain": "thermobeacon",
"manufacturer_data_start": [
0,
],
"connectable": False,
"manufacturer_id": 21,
"service_uuid": "0000fff0-0000-1000-8000-00805f9b34fb",
},
{
"connectable": False,
"domain": "thermobeacon",
"local_name": "ThermoBeacon",
"connectable": False,
},
{
"connectable": False,
"domain": "thermopro",
"local_name": "TP35*",
"connectable": False,
},
{
"connectable": False,
"domain": "thermopro",
"local_name": "TP39*",
"connectable": False,
},
{
"domain": "tilt_ble",
"manufacturer_id": 76,
"manufacturer_data_start": [
2,
21,
@ -373,10 +373,11 @@ BLUETOOTH: list[dict[str, bool | str | int | list[int]]] = [
149,
187,
],
"manufacturer_id": 76,
},
{
"domain": "xiaomi_ble",
"connectable": False,
"domain": "xiaomi_ble",
"service_data_uuid": "0000fe95-0000-1000-8000-00805f9b34fb",
},
{

View File

@ -1,9 +1,19 @@
"""Automatically generated by hassfest.
"""This file is automatically generated.
To update, run python3 -m script.hassfest
"""
FLOWS = {
"helper": [
"derivative",
"group",
"integration",
"min_max",
"switch_as_x",
"threshold",
"tod",
"utility_meter",
],
"integration": [
"abode",
"accuweather",
@ -473,14 +483,4 @@ FLOWS = {
"zwave_js",
"zwave_me",
],
"helper": [
"derivative",
"group",
"integration",
"min_max",
"switch_as_x",
"threshold",
"tod",
"utility_meter",
],
}

View File

@ -1,4 +1,4 @@
"""Automatically generated by currencies.py.
"""This file is automatically generated.
To update, run python3 -m script.currencies
"""

View File

@ -1,128 +1,522 @@
"""Automatically generated by hassfest.
"""This file is automatically generated.
To update, run python3 -m script.hassfest
"""
from __future__ import annotations
DHCP: list[dict[str, str | bool]] = [
{"domain": "august", "hostname": "connect", "macaddress": "D86162*"},
{"domain": "august", "hostname": "connect", "macaddress": "B8B7F1*"},
{"domain": "august", "hostname": "connect", "macaddress": "2C9FFB*"},
{"domain": "august", "hostname": "august*", "macaddress": "E076D0*"},
{"domain": "awair", "macaddress": "70886B1*"},
{"domain": "axis", "registered_devices": True},
{"domain": "axis", "hostname": "axis-00408c*", "macaddress": "00408C*"},
{"domain": "axis", "hostname": "axis-accc8e*", "macaddress": "ACCC8E*"},
{"domain": "axis", "hostname": "axis-b8a44f*", "macaddress": "B8A44F*"},
{"domain": "blink", "hostname": "blink*", "macaddress": "B85F98*"},
{"domain": "blink", "hostname": "blink*", "macaddress": "00037F*"},
{"domain": "blink", "hostname": "blink*", "macaddress": "20A171*"},
{"domain": "broadlink", "registered_devices": True},
{"domain": "broadlink", "macaddress": "34EA34*"},
{"domain": "broadlink", "macaddress": "24DFA7*"},
{"domain": "broadlink", "macaddress": "A043B0*"},
{"domain": "broadlink", "macaddress": "B4430D*"},
{"domain": "broadlink", "macaddress": "C8F742*"},
{"domain": "elkm1", "registered_devices": True},
{"domain": "elkm1", "macaddress": "00409D*"},
{"domain": "emonitor", "hostname": "emonitor*", "macaddress": "0090C2*"},
{"domain": "emonitor", "registered_devices": True},
{"domain": "esphome", "registered_devices": True},
{"domain": "flume", "hostname": "flume-gw-*"},
{"domain": "flux_led", "registered_devices": True},
{"domain": "flux_led", "macaddress": "18B905*", "hostname": "[ba][lk]*"},
{"domain": "flux_led", "macaddress": "249494*", "hostname": "[ba][lk]*"},
{"domain": "flux_led", "macaddress": "7CB94C*", "hostname": "[ba][lk]*"},
{"domain": "flux_led", "macaddress": "ACCF23*", "hostname": "[hba][flk]*"},
{"domain": "flux_led", "macaddress": "B4E842*", "hostname": "[ba][lk]*"},
{"domain": "flux_led", "macaddress": "F0FE6B*", "hostname": "[hba][flk]*"},
{"domain": "flux_led", "macaddress": "8CCE4E*", "hostname": "lwip*"},
{"domain": "flux_led", "hostname": "hf-lpb100-zj*"},
{"domain": "flux_led", "hostname": "zengge_[0-9a-f][0-9a-f]_*"},
{"domain": "flux_led", "macaddress": "C82E47*", "hostname": "sta*"},
{"domain": "fronius", "macaddress": "0003AC*"},
{"domain": "fully_kiosk", "registered_devices": True},
{"domain": "goalzero", "registered_devices": True},
{"domain": "goalzero", "hostname": "yeti*"},
{"domain": "gogogate2", "hostname": "ismartgate*"},
{"domain": "guardian", "hostname": "gvc*", "macaddress": "30AEA4*"},
{"domain": "guardian", "hostname": "gvc*", "macaddress": "B4E62D*"},
{"domain": "guardian", "hostname": "guardian*", "macaddress": "30AEA4*"},
{"domain": "hunterdouglas_powerview", "registered_devices": True},
{
"domain": "august",
"hostname": "connect",
"macaddress": "D86162*",
},
{
"domain": "august",
"hostname": "connect",
"macaddress": "B8B7F1*",
},
{
"domain": "august",
"hostname": "connect",
"macaddress": "2C9FFB*",
},
{
"domain": "august",
"hostname": "august*",
"macaddress": "E076D0*",
},
{
"domain": "awair",
"macaddress": "70886B1*",
},
{
"domain": "axis",
"registered_devices": True,
},
{
"domain": "axis",
"hostname": "axis-00408c*",
"macaddress": "00408C*",
},
{
"domain": "axis",
"hostname": "axis-accc8e*",
"macaddress": "ACCC8E*",
},
{
"domain": "axis",
"hostname": "axis-b8a44f*",
"macaddress": "B8A44F*",
},
{
"domain": "blink",
"hostname": "blink*",
"macaddress": "B85F98*",
},
{
"domain": "blink",
"hostname": "blink*",
"macaddress": "00037F*",
},
{
"domain": "blink",
"hostname": "blink*",
"macaddress": "20A171*",
},
{
"domain": "broadlink",
"registered_devices": True,
},
{
"domain": "broadlink",
"macaddress": "34EA34*",
},
{
"domain": "broadlink",
"macaddress": "24DFA7*",
},
{
"domain": "broadlink",
"macaddress": "A043B0*",
},
{
"domain": "broadlink",
"macaddress": "B4430D*",
},
{
"domain": "broadlink",
"macaddress": "C8F742*",
},
{
"domain": "elkm1",
"registered_devices": True,
},
{
"domain": "elkm1",
"macaddress": "00409D*",
},
{
"domain": "emonitor",
"hostname": "emonitor*",
"macaddress": "0090C2*",
},
{
"domain": "emonitor",
"registered_devices": True,
},
{
"domain": "esphome",
"registered_devices": True,
},
{
"domain": "flume",
"hostname": "flume-gw-*",
},
{
"domain": "flux_led",
"registered_devices": True,
},
{
"domain": "flux_led",
"hostname": "[ba][lk]*",
"macaddress": "18B905*",
},
{
"domain": "flux_led",
"hostname": "[ba][lk]*",
"macaddress": "249494*",
},
{
"domain": "flux_led",
"hostname": "[ba][lk]*",
"macaddress": "7CB94C*",
},
{
"domain": "flux_led",
"hostname": "[hba][flk]*",
"macaddress": "ACCF23*",
},
{
"domain": "flux_led",
"hostname": "[ba][lk]*",
"macaddress": "B4E842*",
},
{
"domain": "flux_led",
"hostname": "[hba][flk]*",
"macaddress": "F0FE6B*",
},
{
"domain": "flux_led",
"hostname": "lwip*",
"macaddress": "8CCE4E*",
},
{
"domain": "flux_led",
"hostname": "hf-lpb100-zj*",
},
{
"domain": "flux_led",
"hostname": "zengge_[0-9a-f][0-9a-f]_*",
},
{
"domain": "flux_led",
"hostname": "sta*",
"macaddress": "C82E47*",
},
{
"domain": "fronius",
"macaddress": "0003AC*",
},
{
"domain": "fully_kiosk",
"registered_devices": True,
},
{
"domain": "goalzero",
"registered_devices": True,
},
{
"domain": "goalzero",
"hostname": "yeti*",
},
{
"domain": "gogogate2",
"hostname": "ismartgate*",
},
{
"domain": "guardian",
"hostname": "gvc*",
"macaddress": "30AEA4*",
},
{
"domain": "guardian",
"hostname": "gvc*",
"macaddress": "B4E62D*",
},
{
"domain": "guardian",
"hostname": "guardian*",
"macaddress": "30AEA4*",
},
{
"domain": "hunterdouglas_powerview",
"registered_devices": True,
},
{
"domain": "hunterdouglas_powerview",
"hostname": "hunter*",
"macaddress": "002674*",
},
{"domain": "insteon", "macaddress": "000EF3*"},
{"domain": "insteon", "registered_devices": True},
{"domain": "intellifire", "hostname": "zentrios-*"},
{"domain": "isy994", "registered_devices": True},
{"domain": "isy994", "hostname": "isy*", "macaddress": "0021B9*"},
{"domain": "isy994", "hostname": "polisy*", "macaddress": "000DB9*"},
{"domain": "lametric", "registered_devices": True},
{"domain": "lifx", "macaddress": "D073D5*"},
{"domain": "lifx", "registered_devices": True},
{"domain": "litterrobot", "hostname": "litter-robot4"},
{"domain": "lyric", "hostname": "lyric-*", "macaddress": "48A2E6*"},
{"domain": "lyric", "hostname": "lyric-*", "macaddress": "B82CA0*"},
{"domain": "lyric", "hostname": "lyric-*", "macaddress": "00D02D*"},
{"domain": "motion_blinds", "registered_devices": True},
{"domain": "motion_blinds", "hostname": "motion_*"},
{"domain": "motion_blinds", "hostname": "brel_*"},
{"domain": "motion_blinds", "hostname": "connector_*"},
{"domain": "myq", "macaddress": "645299*"},
{"domain": "nest", "macaddress": "18B430*"},
{"domain": "nest", "macaddress": "641666*"},
{"domain": "nest", "macaddress": "D8EB46*"},
{"domain": "nexia", "hostname": "xl857-*", "macaddress": "000231*"},
{"domain": "nuheat", "hostname": "nuheat", "macaddress": "002338*"},
{"domain": "nuki", "hostname": "nuki_bridge_*"},
{"domain": "oncue", "hostname": "kohlergen*", "macaddress": "00146F*"},
{"domain": "overkiz", "hostname": "gateway*", "macaddress": "F8811A*"},
{"domain": "powerwall", "hostname": "1118431-*"},
{"domain": "prusalink", "macaddress": "109C70*"},
{"domain": "qnap_qsw", "macaddress": "245EBE*"},
{"domain": "rachio", "hostname": "rachio-*", "macaddress": "009D6B*"},
{"domain": "rachio", "hostname": "rachio-*", "macaddress": "F0038C*"},
{"domain": "rachio", "hostname": "rachio-*", "macaddress": "74C63B*"},
{"domain": "radiotherm", "hostname": "thermostat*", "macaddress": "5CDAD4*"},
{"domain": "radiotherm", "registered_devices": True},
{"domain": "rainforest_eagle", "macaddress": "D8D5B9*"},
{"domain": "ring", "hostname": "ring*", "macaddress": "0CAE7D*"},
{"domain": "roomba", "hostname": "irobot-*", "macaddress": "501479*"},
{"domain": "roomba", "hostname": "roomba-*", "macaddress": "80A589*"},
{"domain": "roomba", "hostname": "roomba-*", "macaddress": "DCF505*"},
{"domain": "roomba", "hostname": "roomba-*", "macaddress": "204EF6*"},
{"domain": "samsungtv", "registered_devices": True},
{"domain": "samsungtv", "hostname": "tizen*"},
{"domain": "samsungtv", "macaddress": "4844F7*"},
{"domain": "samsungtv", "macaddress": "606BBD*"},
{"domain": "samsungtv", "macaddress": "641CB0*"},
{"domain": "samsungtv", "macaddress": "8CC8CD*"},
{"domain": "samsungtv", "macaddress": "8CEA48*"},
{"domain": "samsungtv", "macaddress": "F47B5E*"},
{"domain": "screenlogic", "registered_devices": True},
{"domain": "screenlogic", "hostname": "pentair*", "macaddress": "00C033*"},
{"domain": "sense", "hostname": "sense-*", "macaddress": "009D6B*"},
{"domain": "sense", "hostname": "sense-*", "macaddress": "DCEFCA*"},
{"domain": "sense", "hostname": "sense-*", "macaddress": "A4D578*"},
{"domain": "senseme", "registered_devices": True},
{"domain": "senseme", "macaddress": "20F85E*"},
{"domain": "sensibo", "hostname": "sensibo*"},
{"domain": "simplisafe", "hostname": "simplisafe*", "macaddress": "30AEA4*"},
{"domain": "sleepiq", "macaddress": "64DBA0*"},
{"domain": "smartthings", "hostname": "st*", "macaddress": "24FD5B*"},
{"domain": "smartthings", "hostname": "smartthings*", "macaddress": "24FD5B*"},
{"domain": "smartthings", "hostname": "hub*", "macaddress": "24FD5B*"},
{"domain": "smartthings", "hostname": "hub*", "macaddress": "D052A8*"},
{"domain": "smartthings", "hostname": "hub*", "macaddress": "286D97*"},
{"domain": "solaredge", "hostname": "target", "macaddress": "002702*"},
{"domain": "somfy_mylink", "hostname": "somfy_*", "macaddress": "B8B7F1*"},
{"domain": "squeezebox", "hostname": "squeezebox*", "macaddress": "000420*"},
{"domain": "steamist", "registered_devices": True},
{"domain": "steamist", "macaddress": "001E0C*", "hostname": "my[45]50*"},
{"domain": "tado", "hostname": "tado*"},
{
"domain": "insteon",
"macaddress": "000EF3*",
},
{
"domain": "insteon",
"registered_devices": True,
},
{
"domain": "intellifire",
"hostname": "zentrios-*",
},
{
"domain": "isy994",
"registered_devices": True,
},
{
"domain": "isy994",
"hostname": "isy*",
"macaddress": "0021B9*",
},
{
"domain": "isy994",
"hostname": "polisy*",
"macaddress": "000DB9*",
},
{
"domain": "lametric",
"registered_devices": True,
},
{
"domain": "lifx",
"macaddress": "D073D5*",
},
{
"domain": "lifx",
"registered_devices": True,
},
{
"domain": "litterrobot",
"hostname": "litter-robot4",
},
{
"domain": "lyric",
"hostname": "lyric-*",
"macaddress": "48A2E6*",
},
{
"domain": "lyric",
"hostname": "lyric-*",
"macaddress": "B82CA0*",
},
{
"domain": "lyric",
"hostname": "lyric-*",
"macaddress": "00D02D*",
},
{
"domain": "motion_blinds",
"registered_devices": True,
},
{
"domain": "motion_blinds",
"hostname": "motion_*",
},
{
"domain": "motion_blinds",
"hostname": "brel_*",
},
{
"domain": "motion_blinds",
"hostname": "connector_*",
},
{
"domain": "myq",
"macaddress": "645299*",
},
{
"domain": "nest",
"macaddress": "18B430*",
},
{
"domain": "nest",
"macaddress": "641666*",
},
{
"domain": "nest",
"macaddress": "D8EB46*",
},
{
"domain": "nexia",
"hostname": "xl857-*",
"macaddress": "000231*",
},
{
"domain": "nuheat",
"hostname": "nuheat",
"macaddress": "002338*",
},
{
"domain": "nuki",
"hostname": "nuki_bridge_*",
},
{
"domain": "oncue",
"hostname": "kohlergen*",
"macaddress": "00146F*",
},
{
"domain": "overkiz",
"hostname": "gateway*",
"macaddress": "F8811A*",
},
{
"domain": "powerwall",
"hostname": "1118431-*",
},
{
"domain": "prusalink",
"macaddress": "109C70*",
},
{
"domain": "qnap_qsw",
"macaddress": "245EBE*",
},
{
"domain": "rachio",
"hostname": "rachio-*",
"macaddress": "009D6B*",
},
{
"domain": "rachio",
"hostname": "rachio-*",
"macaddress": "F0038C*",
},
{
"domain": "rachio",
"hostname": "rachio-*",
"macaddress": "74C63B*",
},
{
"domain": "radiotherm",
"hostname": "thermostat*",
"macaddress": "5CDAD4*",
},
{
"domain": "radiotherm",
"registered_devices": True,
},
{
"domain": "rainforest_eagle",
"macaddress": "D8D5B9*",
},
{
"domain": "ring",
"hostname": "ring*",
"macaddress": "0CAE7D*",
},
{
"domain": "roomba",
"hostname": "irobot-*",
"macaddress": "501479*",
},
{
"domain": "roomba",
"hostname": "roomba-*",
"macaddress": "80A589*",
},
{
"domain": "roomba",
"hostname": "roomba-*",
"macaddress": "DCF505*",
},
{
"domain": "roomba",
"hostname": "roomba-*",
"macaddress": "204EF6*",
},
{
"domain": "samsungtv",
"registered_devices": True,
},
{
"domain": "samsungtv",
"hostname": "tizen*",
},
{
"domain": "samsungtv",
"macaddress": "4844F7*",
},
{
"domain": "samsungtv",
"macaddress": "606BBD*",
},
{
"domain": "samsungtv",
"macaddress": "641CB0*",
},
{
"domain": "samsungtv",
"macaddress": "8CC8CD*",
},
{
"domain": "samsungtv",
"macaddress": "8CEA48*",
},
{
"domain": "samsungtv",
"macaddress": "F47B5E*",
},
{
"domain": "screenlogic",
"registered_devices": True,
},
{
"domain": "screenlogic",
"hostname": "pentair*",
"macaddress": "00C033*",
},
{
"domain": "sense",
"hostname": "sense-*",
"macaddress": "009D6B*",
},
{
"domain": "sense",
"hostname": "sense-*",
"macaddress": "DCEFCA*",
},
{
"domain": "sense",
"hostname": "sense-*",
"macaddress": "A4D578*",
},
{
"domain": "senseme",
"registered_devices": True,
},
{
"domain": "senseme",
"macaddress": "20F85E*",
},
{
"domain": "sensibo",
"hostname": "sensibo*",
},
{
"domain": "simplisafe",
"hostname": "simplisafe*",
"macaddress": "30AEA4*",
},
{
"domain": "sleepiq",
"macaddress": "64DBA0*",
},
{
"domain": "smartthings",
"hostname": "st*",
"macaddress": "24FD5B*",
},
{
"domain": "smartthings",
"hostname": "smartthings*",
"macaddress": "24FD5B*",
},
{
"domain": "smartthings",
"hostname": "hub*",
"macaddress": "24FD5B*",
},
{
"domain": "smartthings",
"hostname": "hub*",
"macaddress": "D052A8*",
},
{
"domain": "smartthings",
"hostname": "hub*",
"macaddress": "286D97*",
},
{
"domain": "solaredge",
"hostname": "target",
"macaddress": "002702*",
},
{
"domain": "somfy_mylink",
"hostname": "somfy_*",
"macaddress": "B8B7F1*",
},
{
"domain": "squeezebox",
"hostname": "squeezebox*",
"macaddress": "000420*",
},
{
"domain": "steamist",
"registered_devices": True,
},
{
"domain": "steamist",
"hostname": "my[45]50*",
"macaddress": "001E0C*",
},
{
"domain": "tado",
"hostname": "tado*",
},
{
"domain": "tesla_wall_connector",
"hostname": "teslawallconnector_*",
@ -138,69 +532,296 @@ DHCP: list[dict[str, str | bool]] = [
"hostname": "teslawallconnector_*",
"macaddress": "4CFCAA*",
},
{"domain": "tolo", "hostname": "usr-tcp232-ed2"},
{"domain": "toon", "hostname": "eneco-*", "macaddress": "74C63B*"},
{"domain": "tplink", "registered_devices": True},
{"domain": "tplink", "hostname": "es*", "macaddress": "54AF97*"},
{"domain": "tplink", "hostname": "ep*", "macaddress": "E848B8*"},
{"domain": "tplink", "hostname": "ep*", "macaddress": "1C61B4*"},
{"domain": "tplink", "hostname": "ep*", "macaddress": "003192*"},
{"domain": "tplink", "hostname": "hs*", "macaddress": "1C3BF3*"},
{"domain": "tplink", "hostname": "hs*", "macaddress": "50C7BF*"},
{"domain": "tplink", "hostname": "hs*", "macaddress": "68FF7B*"},
{"domain": "tplink", "hostname": "hs*", "macaddress": "98DAC4*"},
{"domain": "tplink", "hostname": "hs*", "macaddress": "B09575*"},
{"domain": "tplink", "hostname": "hs*", "macaddress": "C006C3*"},
{"domain": "tplink", "hostname": "lb*", "macaddress": "1C3BF3*"},
{"domain": "tplink", "hostname": "lb*", "macaddress": "50C7BF*"},
{"domain": "tplink", "hostname": "lb*", "macaddress": "68FF7B*"},
{"domain": "tplink", "hostname": "lb*", "macaddress": "98DAC4*"},
{"domain": "tplink", "hostname": "lb*", "macaddress": "B09575*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "60A4B7*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "005F67*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "1027F5*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "B0A7B9*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "403F8C*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "C0C9E3*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "909A4A*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "E848B8*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "003192*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "1C3BF3*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "50C7BF*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "68FF7B*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "98DAC4*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "B09575*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "C006C3*"},
{"domain": "tplink", "hostname": "k[lp]*", "macaddress": "6C5AB0*"},
{"domain": "tuya", "macaddress": "105A17*"},
{"domain": "tuya", "macaddress": "10D561*"},
{"domain": "tuya", "macaddress": "1869D8*"},
{"domain": "tuya", "macaddress": "381F8D*"},
{"domain": "tuya", "macaddress": "508A06*"},
{"domain": "tuya", "macaddress": "68572D*"},
{"domain": "tuya", "macaddress": "708976*"},
{"domain": "tuya", "macaddress": "7CF666*"},
{"domain": "tuya", "macaddress": "84E342*"},
{"domain": "tuya", "macaddress": "D4A651*"},
{"domain": "tuya", "macaddress": "D81F12*"},
{"domain": "twinkly", "hostname": "twinkly_*"},
{"domain": "unifiprotect", "macaddress": "B4FBE4*"},
{"domain": "unifiprotect", "macaddress": "802AA8*"},
{"domain": "unifiprotect", "macaddress": "F09FC2*"},
{"domain": "unifiprotect", "macaddress": "68D79A*"},
{"domain": "unifiprotect", "macaddress": "18E829*"},
{"domain": "unifiprotect", "macaddress": "245A4C*"},
{"domain": "unifiprotect", "macaddress": "784558*"},
{"domain": "unifiprotect", "macaddress": "E063DA*"},
{"domain": "unifiprotect", "macaddress": "265A4C*"},
{"domain": "unifiprotect", "macaddress": "74ACB9*"},
{"domain": "verisure", "macaddress": "0023C1*"},
{"domain": "vicare", "macaddress": "B87424*"},
{"domain": "wiz", "registered_devices": True},
{"domain": "wiz", "macaddress": "A8BB50*"},
{"domain": "wiz", "macaddress": "D8A011*"},
{"domain": "wiz", "macaddress": "444F8E*"},
{"domain": "wiz", "macaddress": "6C2990*"},
{"domain": "wiz", "hostname": "wiz_*"},
{"domain": "yeelight", "hostname": "yeelink-*"},
{
"domain": "tolo",
"hostname": "usr-tcp232-ed2",
},
{
"domain": "toon",
"hostname": "eneco-*",
"macaddress": "74C63B*",
},
{
"domain": "tplink",
"registered_devices": True,
},
{
"domain": "tplink",
"hostname": "es*",
"macaddress": "54AF97*",
},
{
"domain": "tplink",
"hostname": "ep*",
"macaddress": "E848B8*",
},
{
"domain": "tplink",
"hostname": "ep*",
"macaddress": "1C61B4*",
},
{
"domain": "tplink",
"hostname": "ep*",
"macaddress": "003192*",
},
{
"domain": "tplink",
"hostname": "hs*",
"macaddress": "1C3BF3*",
},
{
"domain": "tplink",
"hostname": "hs*",
"macaddress": "50C7BF*",
},
{
"domain": "tplink",
"hostname": "hs*",
"macaddress": "68FF7B*",
},
{
"domain": "tplink",
"hostname": "hs*",
"macaddress": "98DAC4*",
},
{
"domain": "tplink",
"hostname": "hs*",
"macaddress": "B09575*",
},
{
"domain": "tplink",
"hostname": "hs*",
"macaddress": "C006C3*",
},
{
"domain": "tplink",
"hostname": "lb*",
"macaddress": "1C3BF3*",
},
{
"domain": "tplink",
"hostname": "lb*",
"macaddress": "50C7BF*",
},
{
"domain": "tplink",
"hostname": "lb*",
"macaddress": "68FF7B*",
},
{
"domain": "tplink",
"hostname": "lb*",
"macaddress": "98DAC4*",
},
{
"domain": "tplink",
"hostname": "lb*",
"macaddress": "B09575*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "60A4B7*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "005F67*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "1027F5*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "B0A7B9*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "403F8C*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "C0C9E3*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "909A4A*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "E848B8*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "003192*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "1C3BF3*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "50C7BF*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "68FF7B*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "98DAC4*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "B09575*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "C006C3*",
},
{
"domain": "tplink",
"hostname": "k[lp]*",
"macaddress": "6C5AB0*",
},
{
"domain": "tuya",
"macaddress": "105A17*",
},
{
"domain": "tuya",
"macaddress": "10D561*",
},
{
"domain": "tuya",
"macaddress": "1869D8*",
},
{
"domain": "tuya",
"macaddress": "381F8D*",
},
{
"domain": "tuya",
"macaddress": "508A06*",
},
{
"domain": "tuya",
"macaddress": "68572D*",
},
{
"domain": "tuya",
"macaddress": "708976*",
},
{
"domain": "tuya",
"macaddress": "7CF666*",
},
{
"domain": "tuya",
"macaddress": "84E342*",
},
{
"domain": "tuya",
"macaddress": "D4A651*",
},
{
"domain": "tuya",
"macaddress": "D81F12*",
},
{
"domain": "twinkly",
"hostname": "twinkly_*",
},
{
"domain": "unifiprotect",
"macaddress": "B4FBE4*",
},
{
"domain": "unifiprotect",
"macaddress": "802AA8*",
},
{
"domain": "unifiprotect",
"macaddress": "F09FC2*",
},
{
"domain": "unifiprotect",
"macaddress": "68D79A*",
},
{
"domain": "unifiprotect",
"macaddress": "18E829*",
},
{
"domain": "unifiprotect",
"macaddress": "245A4C*",
},
{
"domain": "unifiprotect",
"macaddress": "784558*",
},
{
"domain": "unifiprotect",
"macaddress": "E063DA*",
},
{
"domain": "unifiprotect",
"macaddress": "265A4C*",
},
{
"domain": "unifiprotect",
"macaddress": "74ACB9*",
},
{
"domain": "verisure",
"macaddress": "0023C1*",
},
{
"domain": "vicare",
"macaddress": "B87424*",
},
{
"domain": "wiz",
"registered_devices": True,
},
{
"domain": "wiz",
"macaddress": "A8BB50*",
},
{
"domain": "wiz",
"macaddress": "D8A011*",
},
{
"domain": "wiz",
"macaddress": "444F8E*",
},
{
"domain": "wiz",
"macaddress": "6C2990*",
},
{
"domain": "wiz",
"hostname": "wiz_*",
},
{
"domain": "yeelight",
"hostname": "yeelink-*",
},
]

View File

@ -1,4 +1,4 @@
"""Automatically generated by hassfest.
"""This file is automatically generated.
To update, run python3 -m script.hassfest
"""

View File

@ -1,4 +1,4 @@
"""Automatically generated by hassfest.
"""This file is automatically generated.
To update, run python3 -m script.hassfest
"""

View File

@ -1,14 +1,14 @@
"""Automatically generated by hassfest.
"""This file is automatically generated.
To update, run python3 -m script.hassfest
"""
USB = [
{
"domain": "homeassistant_sky_connect",
"vid": "10C4",
"pid": "EA60",
"description": "*skyconnect v1.0*",
"domain": "homeassistant_sky_connect",
"pid": "EA60",
"vid": "10C4",
},
{
"domain": "insteon",
@ -16,104 +16,104 @@ USB = [
},
{
"domain": "modem_callerid",
"vid": "0572",
"pid": "1340",
"vid": "0572",
},
{
"domain": "velbus",
"vid": "10CF",
"pid": "0B1B",
"vid": "10CF",
},
{
"domain": "velbus",
"vid": "10CF",
"pid": "0516",
"vid": "10CF",
},
{
"domain": "velbus",
"vid": "10CF",
"pid": "0517",
"vid": "10CF",
},
{
"domain": "velbus",
"vid": "10CF",
"pid": "0518",
"vid": "10CF",
},
{
"domain": "zha",
"vid": "10C4",
"pid": "EA60",
"description": "*2652*",
"domain": "zha",
"pid": "EA60",
"vid": "10C4",
},
{
"description": "*sonoff*plus*",
"domain": "zha",
"vid": "1A86",
"pid": "55D4",
"description": "*sonoff*plus*",
},
{
"domain": "zha",
"vid": "10C4",
"pid": "EA60",
"description": "*sonoff*plus*",
},
{
"domain": "zha",
"vid": "10C4",
"pid": "EA60",
"description": "*tubeszb*",
},
{
"domain": "zha",
"vid": "1A86",
"pid": "7523",
"description": "*tubeszb*",
},
{
"description": "*sonoff*plus*",
"domain": "zha",
"pid": "EA60",
"vid": "10C4",
},
{
"description": "*tubeszb*",
"domain": "zha",
"pid": "EA60",
"vid": "10C4",
},
{
"description": "*tubeszb*",
"domain": "zha",
"vid": "1A86",
"pid": "7523",
"vid": "1A86",
},
{
"description": "*zigstar*",
"domain": "zha",
"pid": "7523",
"vid": "1A86",
},
{
"domain": "zha",
"vid": "1CF1",
"pid": "0030",
"description": "*conbee*",
"domain": "zha",
"pid": "0030",
"vid": "1CF1",
},
{
"domain": "zha",
"vid": "10C4",
"pid": "8A2A",
"description": "*zigbee*",
},
{
"domain": "zha",
"vid": "0403",
"pid": "6015",
"description": "*zigate*",
},
{
"domain": "zha",
"vid": "10C4",
"pid": "EA60",
"description": "*zigate*",
},
{
"domain": "zha",
"vid": "10C4",
"pid": "8B34",
"description": "*bv 2010/10*",
},
{
"domain": "zwave_js",
"vid": "0658",
"pid": "0200",
},
{
"domain": "zwave_js",
"vid": "10C4",
"pid": "8A2A",
"vid": "10C4",
},
{
"description": "*zigate*",
"domain": "zha",
"pid": "6015",
"vid": "0403",
},
{
"description": "*zigate*",
"domain": "zha",
"pid": "EA60",
"vid": "10C4",
},
{
"description": "*bv 2010/10*",
"domain": "zha",
"pid": "8B34",
"vid": "10C4",
},
{
"domain": "zwave_js",
"pid": "0200",
"vid": "0658",
},
{
"description": "*z-wave*",
"domain": "zwave_js",
"pid": "8A2A",
"vid": "10C4",
},
]

View File

@ -1,8 +1,70 @@
"""Automatically generated by hassfest.
"""This file is automatically generated.
To update, run python3 -m script.hassfest
"""
HOMEKIT = {
"3810X": "roku",
"3820X": "roku",
"4660X": "roku",
"7820X": "roku",
"819LMB": "myq",
"AC02": "tado",
"Abode": "abode",
"BSB002": "hue",
"C105X": "roku",
"C135X": "roku",
"EB-*": "ecobee",
"Escea": "escea",
"HHKBridge*": "hive",
"Healty Home Coach": "netatmo",
"Iota": "abode",
"LIFX A19": "lifx",
"LIFX BR30": "lifx",
"LIFX Beam": "lifx",
"LIFX Candle": "lifx",
"LIFX Clean": "lifx",
"LIFX Color": "lifx",
"LIFX DLCOL": "lifx",
"LIFX DLWW": "lifx",
"LIFX Dlight": "lifx",
"LIFX Downlight": "lifx",
"LIFX Filament": "lifx",
"LIFX GU10": "lifx",
"LIFX Lightstrip": "lifx",
"LIFX Mini": "lifx",
"LIFX Nightvision": "lifx",
"LIFX Pls": "lifx",
"LIFX Plus": "lifx",
"LIFX Tile": "lifx",
"LIFX White": "lifx",
"LIFX Z": "lifx",
"MYQ": "myq",
"NL29": "nanoleaf",
"NL42": "nanoleaf",
"NL47": "nanoleaf",
"NL48": "nanoleaf",
"NL52": "nanoleaf",
"NL59": "nanoleaf",
"Netatmo Relay": "netatmo",
"PowerView": "hunterdouglas_powerview",
"Presence": "netatmo",
"Rachio": "rachio",
"SPK5": "rainmachine",
"Sensibo": "sensibo",
"Smart Bridge": "lutron_caseta",
"Socket": "wemo",
"TRADFRI": "tradfri",
"Touch HD": "rainmachine",
"Welcome": "netatmo",
"Wemo": "wemo",
"YL*": "yeelight",
"ecobee*": "ecobee",
"iSmartGate": "gogogate2",
"iZone": "izone",
"tado": "tado",
}
ZEROCONF = {
"_Volumio._tcp.local.": [
{
@ -436,65 +498,3 @@ ZEROCONF = {
},
],
}
HOMEKIT = {
"3810X": "roku",
"3820X": "roku",
"4660X": "roku",
"7820X": "roku",
"819LMB": "myq",
"AC02": "tado",
"Abode": "abode",
"BSB002": "hue",
"C105X": "roku",
"C135X": "roku",
"EB-*": "ecobee",
"Escea": "escea",
"HHKBridge*": "hive",
"Healty Home Coach": "netatmo",
"Iota": "abode",
"LIFX A19": "lifx",
"LIFX BR30": "lifx",
"LIFX Beam": "lifx",
"LIFX Candle": "lifx",
"LIFX Clean": "lifx",
"LIFX Color": "lifx",
"LIFX DLCOL": "lifx",
"LIFX DLWW": "lifx",
"LIFX Dlight": "lifx",
"LIFX Downlight": "lifx",
"LIFX Filament": "lifx",
"LIFX GU10": "lifx",
"LIFX Lightstrip": "lifx",
"LIFX Mini": "lifx",
"LIFX Nightvision": "lifx",
"LIFX Pls": "lifx",
"LIFX Plus": "lifx",
"LIFX Tile": "lifx",
"LIFX White": "lifx",
"LIFX Z": "lifx",
"MYQ": "myq",
"NL29": "nanoleaf",
"NL42": "nanoleaf",
"NL47": "nanoleaf",
"NL48": "nanoleaf",
"NL52": "nanoleaf",
"NL59": "nanoleaf",
"Netatmo Relay": "netatmo",
"PowerView": "hunterdouglas_powerview",
"Presence": "netatmo",
"Rachio": "rachio",
"SPK5": "rainmachine",
"Sensibo": "sensibo",
"Smart Bridge": "lutron_caseta",
"Socket": "wemo",
"TRADFRI": "tradfri",
"Touch HD": "rainmachine",
"Welcome": "netatmo",
"Wemo": "wemo",
"YL*": "yeelight",
"ecobee*": "ecobee",
"iSmartGate": "gogogate2",
"iZone": "izone",
"tado": "tado",
}

View File

@ -1,55 +1,44 @@
"""Helper script to update currency list from the official source."""
import pathlib
from pathlib import Path
import black
from bs4 import BeautifulSoup
import requests
BASE = """
\"\"\"Automatically generated by currencies.py.
To update, run python3 -m script.currencies
\"\"\"
ACTIVE_CURRENCIES = {{ {} }}
HISTORIC_CURRENCIES = {{ {} }}
""".strip()
from .hassfest.serializer import format_python_namespace
req = requests.get(
"https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-one.xml"
)
soup = BeautifulSoup(req.content, "xml")
active_currencies = sorted(
{
x.Ccy.contents[0]
for x in soup.ISO_4217.CcyTbl.children
if x.name == "CcyNtry"
and x.Ccy
and x.CcyMnrUnts.contents[0] != "N.A."
and "IsFund" not in x.CcyNm.attrs
and x.Ccy.contents[0] != "UYW"
}
)
active_currencies = {
x.Ccy.contents[0]
for x in soup.ISO_4217.CcyTbl.children
if x.name == "CcyNtry"
and x.Ccy
and x.CcyMnrUnts.contents[0] != "N.A."
and "IsFund" not in x.CcyNm.attrs
and x.Ccy.contents[0] != "UYW"
}
req = requests.get(
"https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list-three.xml"
)
soup = BeautifulSoup(req.content, "xml")
historic_currencies = sorted(
{
x.Ccy.contents[0]
for x in soup.ISO_4217.HstrcCcyTbl.children
if x.name == "HstrcCcyNtry"
and x.Ccy
and "IsFund" not in x.CcyNm.attrs
and x.Ccy.contents[0] not in active_currencies
}
)
historic_currencies = {
x.Ccy.contents[0]
for x in soup.ISO_4217.HstrcCcyTbl.children
if x.name == "HstrcCcyNtry"
and x.Ccy
and "IsFund" not in x.CcyNm.attrs
and x.Ccy.contents[0] not in active_currencies
}
pathlib.Path("homeassistant/generated/currencies.py").write_text(
black.format_str(
BASE.format(repr(active_currencies)[1:-1], repr(historic_currencies)[1:-1]),
mode=black.Mode(),
Path("homeassistant/generated/currencies.py").write_text(
format_python_namespace(
{
"ACTIVE_CURRENCIES": active_currencies,
"HISTORIC_CURRENCIES": historic_currencies,
},
generator="script.currencies",
)
)

View File

@ -1,19 +1,8 @@
"""Generate application_credentials data."""
from __future__ import annotations
import black
from .model import Config, Integration
from .serializer import to_string
BASE = """
\"\"\"Automatically generated by hassfest.
To update, run python3 -m script.hassfest
\"\"\"
APPLICATION_CREDENTIALS = {}
""".strip()
from .serializer import format_python_namespace
def generate_and_validate(integrations: dict[str, Integration], config: Config) -> str:
@ -29,7 +18,7 @@ def generate_and_validate(integrations: dict[str, Integration], config: Config)
match_list.append(domain)
return black.format_str(BASE.format(to_string(match_list)), mode=black.Mode())
return format_python_namespace({"APPLICATION_CREDENTIALS": match_list})
def validate(integrations: dict[str, Integration], config: Config) -> None:

View File

@ -1,20 +1,8 @@
"""Generate bluetooth file."""
from __future__ import annotations
import black
from .model import Config, Integration
from .serializer import to_string
BASE = """
\"\"\"Automatically generated by hassfest.
To update, run python3 -m script.hassfest
\"\"\"
from __future__ import annotations
BLUETOOTH: list[dict[str, bool | str | int | list[int]]] = {}
""".strip()
from .serializer import format_python_namespace
def generate_and_validate(integrations: list[dict[str, str]]):
@ -35,7 +23,10 @@ def generate_and_validate(integrations: list[dict[str, str]]):
for entry in match_types:
match_list.append({"domain": domain, **entry})
return black.format_str(BASE.format(to_string(match_list)), mode=black.Mode())
return format_python_namespace(
{"BLUETOOTH": match_list},
annotations={"BLUETOOTH": "list[dict[str, bool | str | int | list[int]]]"},
)
def validate(integrations: dict[str, Integration], config: Config):

View File

@ -4,20 +4,9 @@ from __future__ import annotations
import json
import pathlib
import black
from .brand import validate as validate_brands
from .model import Brand, Config, Integration
from .serializer import to_string
BASE = """
\"\"\"Automatically generated by hassfest.
To update, run python3 -m script.hassfest
\"\"\"
FLOWS = {}
""".strip()
from .serializer import format_python_namespace
UNIQUE_ID_IGNORE = {"huawei_lte", "mqtt", "adguard"}
@ -91,7 +80,7 @@ def _generate_and_validate(integrations: dict[str, Integration], config: Config)
else:
domains["integration"].append(domain)
return black.format_str(BASE.format(to_string(domains)), mode=black.Mode())
return format_python_namespace({"FLOWS": domains})
def _populate_brand_integrations(

View File

@ -1,19 +1,8 @@
"""Generate dhcp file."""
from __future__ import annotations
import black
from .model import Config, Integration
BASE = """
\"\"\"Automatically generated by hassfest.
To update, run python3 -m script.hassfest
\"\"\"
from __future__ import annotations
DHCP: list[dict[str, str | bool]] = {}
""".strip()
from .serializer import format_python_namespace
def generate_and_validate(integrations: list[dict[str, str]]):
@ -34,7 +23,10 @@ def generate_and_validate(integrations: list[dict[str, str]]):
for entry in match_types:
match_list.append({"domain": domain, **entry})
return black.format_str(BASE.format(str(match_list)), mode=black.Mode())
return format_python_namespace(
{"DHCP": match_list},
annotations={"DHCP": "list[dict[str, str | bool]]"},
)
def validate(integrations: dict[str, Integration], config: Config):

View File

@ -3,19 +3,8 @@ from __future__ import annotations
from collections import defaultdict
import black
from .model import Config, Integration
from .serializer import to_string
BASE = """
\"\"\"Automatically generated by hassfest.
To update, run python3 -m script.hassfest
\"\"\"
MQTT = {}
""".strip()
from .serializer import format_python_namespace
def generate_and_validate(integrations: dict[str, Integration]):
@ -37,7 +26,7 @@ def generate_and_validate(integrations: dict[str, Integration]):
for topic in mqtt:
data[domain].append(topic)
return black.format_str(BASE.format(to_string(data)), mode=black.Mode())
return format_python_namespace({"MQTT": data})
def validate(integrations: dict[str, Integration], config: Config):

View File

@ -1,37 +1,94 @@
"""Hassfest utils."""
from __future__ import annotations
from collections.abc import Collection, Iterable, Mapping
from typing import Any
import black
def _dict_to_str(data: dict) -> str:
"""Return a string representation of a dict."""
items = [f"'{key}':{to_string(value)}" for key, value in data.items()]
result = "{"
for item in items:
result += str(item)
result += ","
result += "}"
return result
DEFAULT_GENERATOR = "script.hassfest"
def _list_to_str(data: dict) -> str:
"""Return a string representation of a list."""
items = [to_string(value) for value in data]
result = "["
for item in items:
result += str(item)
result += ","
result += "]"
return result
def _wrap_items(
items: Iterable[str],
opener: str,
closer: str,
sort=False,
) -> str:
"""Wrap pre-formatted Python reprs in braces, optionally sorting them."""
# The trailing comma is imperative so Black doesn't format some items
# on one line and some on multiple.
if sort:
items = sorted(items)
return f"{opener}{','.join(items)},{closer}"
def _mapping_to_str(data: Mapping) -> str:
"""Return a string representation of a mapping."""
return _wrap_items(
(f"{to_string(key)}:{to_string(value)}" for key, value in data.items()),
opener="{",
closer="}",
sort=True,
)
def _collection_to_str(
data: Collection, opener: str = "[", closer: str = "]", sort=False
) -> str:
"""Return a string representation of a collection."""
items = (to_string(value) for value in data)
return _wrap_items(items, opener, closer, sort=sort)
def to_string(data: Any) -> str:
"""Return a string representation of the input."""
if isinstance(data, dict):
return _dict_to_str(data)
return _mapping_to_str(data)
if isinstance(data, list):
return _list_to_str(data)
if isinstance(data, str):
return "'" + data + "'"
return data
return _collection_to_str(data)
if isinstance(data, set):
return _collection_to_str(data, "{", "}", sort=True)
return repr(data)
def format_python(
content: str,
*,
generator: str = DEFAULT_GENERATOR,
) -> str:
"""Format Python code with Black. Optionally prepend a generator comment."""
if generator:
content = f"""\"\"\"This file is automatically generated.
To update, run python3 -m {generator}
\"\"\"
{content}
"""
return black.format_str(content.strip(), mode=black.Mode())
def format_python_namespace(
content: dict[str, Any],
*,
annotations: dict[str, str] | None = None,
generator: str = DEFAULT_GENERATOR,
) -> str:
"""Generate a nicely formatted "namespace" file.
The keys of the `content` dict will be used as variable names.
"""
def _get_annotation(key: str) -> str:
annotation = (annotations or {}).get(key)
return f": {annotation}" if annotation else ""
code = "\n\n".join(
f"{key}{_get_annotation(key)}" f" = {to_string(value)}"
for key, value in sorted(content.items())
)
if annotations:
# If we had any annotations, add the __future__ import.
code = f"from __future__ import annotations\n{code}"
return format_python(code, generator=generator)

View File

@ -3,24 +3,8 @@ from __future__ import annotations
from collections import defaultdict
import black
from .model import Config, Integration
from .serializer import to_string
BASE = """
\"\"\"Automatically generated by hassfest.
To update, run python3 -m script.hassfest
\"\"\"
SSDP = {}
""".strip()
def sort_dict(value):
"""Sort a dictionary."""
return {key: value[key] for key in sorted(value)}
from .serializer import format_python_namespace
def generate_and_validate(integrations: dict[str, Integration]):
@ -40,9 +24,9 @@ def generate_and_validate(integrations: dict[str, Integration]):
continue
for matcher in ssdp:
data[domain].append(sort_dict(matcher))
data[domain].append(matcher)
return black.format_str(BASE.format(to_string(data)), mode=black.Mode())
return format_python_namespace({"SSDP": data})
def validate(integrations: dict[str, Integration], config: Config):

View File

@ -1,19 +1,8 @@
"""Generate usb file."""
from __future__ import annotations
import black
from .model import Config, Integration
from .serializer import to_string
BASE = """
\"\"\"Automatically generated by hassfest.
To update, run python3 -m script.hassfest
\"\"\"
USB = {}
""".strip()
from .serializer import format_python_namespace
def generate_and_validate(integrations: list[dict[str, str]]) -> str:
@ -39,7 +28,7 @@ def generate_and_validate(integrations: list[dict[str, str]]) -> str:
}
)
return black.format_str(BASE.format(to_string(match_list)), mode=black.Mode())
return format_python_namespace({"USB": match_list})
def validate(integrations: dict[str, Integration], config: Config) -> None:

View File

@ -3,23 +3,10 @@ from __future__ import annotations
from collections import defaultdict
import black
from homeassistant.loader import async_process_zeroconf_match_dict
from .model import Config, Integration
from .serializer import to_string
BASE = """
\"\"\"Automatically generated by hassfest.
To update, run python3 -m script.hassfest
\"\"\"
ZEROCONF = {}
HOMEKIT = {}
""".strip()
from .serializer import format_python_namespace
def generate_and_validate(integrations: dict[str, Integration]):
@ -82,11 +69,11 @@ def generate_and_validate(integrations: dict[str, Integration]):
warned.add(key_2)
break
zeroconf = {key: service_type_dict[key] for key in sorted(service_type_dict)}
homekit = {key: homekit_dict[key] for key in sorted(homekit_dict)}
return black.format_str(
BASE.format(to_string(zeroconf), to_string(homekit)), mode=black.Mode()
return format_python_namespace(
{
"HOMEKIT": {key: homekit_dict[key] for key in homekit_dict},
"ZEROCONF": {key: service_type_dict[key] for key in service_type_dict},
}
)