108
custom_components/adguard_control_hub/const.py
Normal file
108
custom_components/adguard_control_hub/const.py
Normal file
@@ -0,0 +1,108 @@
|
||||
"""Constants for the AdGuard Control Hub integration."""
|
||||
from homeassistant.const import Platform
|
||||
|
||||
DOMAIN = "adguard_control_hub"
|
||||
DEFAULT_NAME = "AdGuard Control Hub"
|
||||
DEFAULT_PORT = 3000
|
||||
DEFAULT_SSL = False
|
||||
DEFAULT_VERIFY_SSL = True
|
||||
|
||||
# Configuration
|
||||
CONF_HOST = "host"
|
||||
CONF_PORT = "port"
|
||||
CONF_USERNAME = "username"
|
||||
CONF_PASSWORD = "password"
|
||||
CONF_SSL = "ssl"
|
||||
CONF_VERIFY_SSL = "verify_ssl"
|
||||
|
||||
# AdGuard API endpoints
|
||||
API_STATUS = "/control/status"
|
||||
API_DNS_CONFIG = "/control/dns_config"
|
||||
API_STATS = "/control/stats"
|
||||
API_CLIENTS = "/control/clients"
|
||||
API_REWRITE = "/control/rewrite"
|
||||
API_FILTERING = "/control/filtering"
|
||||
|
||||
# Switch types
|
||||
SWITCH_PROTECTION = "protection"
|
||||
SWITCH_FILTERING = "filtering"
|
||||
SWITCH_SAFEBROWSING = "safebrowsing"
|
||||
SWITCH_PARENTAL = "parental"
|
||||
SWITCH_SAFESEARCH = "safesearch"
|
||||
SWITCH_QUERY_LOG = "query_log"
|
||||
|
||||
SWITCHES = {
|
||||
SWITCH_PROTECTION: {
|
||||
"name": "AdGuard Protection",
|
||||
"icon": "mdi:shield-check",
|
||||
"api_key": "protection_enabled",
|
||||
},
|
||||
SWITCH_FILTERING: {
|
||||
"name": "DNS Filtering",
|
||||
"icon": "mdi:filter",
|
||||
"api_key": "filtering_enabled",
|
||||
},
|
||||
SWITCH_SAFEBROWSING: {
|
||||
"name": "Safe Browsing",
|
||||
"icon": "mdi:shield-bug",
|
||||
"api_key": "safebrowsing_enabled",
|
||||
},
|
||||
SWITCH_PARENTAL: {
|
||||
"name": "Parental Control",
|
||||
"icon": "mdi:account-child-circle",
|
||||
"api_key": "parental_enabled",
|
||||
},
|
||||
SWITCH_SAFESEARCH: {
|
||||
"name": "Safe Search",
|
||||
"icon": "mdi:shield-search",
|
||||
"api_key": "safesearch_enabled",
|
||||
},
|
||||
SWITCH_QUERY_LOG: {
|
||||
"name": "Query Log",
|
||||
"icon": "mdi:file-document-multiple",
|
||||
"api_key": "querylog_enabled",
|
||||
},
|
||||
}
|
||||
|
||||
# Sensor types
|
||||
SENSOR_DNS_QUERIES = "dns_queries"
|
||||
SENSOR_BLOCKED_QUERIES = "blocked_queries"
|
||||
SENSOR_BLOCKED_PERCENTAGE = "blocked_percentage"
|
||||
SENSOR_ACTIVE_FILTERS = "active_filters"
|
||||
SENSOR_AVG_PROCESSING_TIME = "avg_processing_time"
|
||||
|
||||
SENSORS = {
|
||||
SENSOR_DNS_QUERIES: {
|
||||
"name": "DNS Queries",
|
||||
"icon": "mdi:dns",
|
||||
"unit": "queries",
|
||||
"api_key": "num_dns_queries",
|
||||
},
|
||||
SENSOR_BLOCKED_QUERIES: {
|
||||
"name": "Blocked Queries",
|
||||
"icon": "mdi:shield-check",
|
||||
"unit": "queries",
|
||||
"api_key": "num_blocked_filtering",
|
||||
},
|
||||
SENSOR_BLOCKED_PERCENTAGE: {
|
||||
"name": "Blocked Percentage",
|
||||
"icon": "mdi:percent",
|
||||
"unit": "%",
|
||||
"api_key": "blocked_percentage",
|
||||
},
|
||||
SENSOR_ACTIVE_FILTERS: {
|
||||
"name": "Active Filter Rules",
|
||||
"icon": "mdi:filter-check",
|
||||
"unit": "rules",
|
||||
"api_key": "num_replaced_safebrowsing",
|
||||
},
|
||||
SENSOR_AVG_PROCESSING_TIME: {
|
||||
"name": "Average Processing Time",
|
||||
"icon": "mdi:clock-fast",
|
||||
"unit": "ms",
|
||||
"api_key": "avg_processing_time",
|
||||
},
|
||||
}
|
||||
|
||||
# Update interval
|
||||
DEFAULT_SCAN_INTERVAL = 30
|
||||
Reference in New Issue
Block a user