summaryrefslogtreecommitdiff
path: root/include/py
diff options
context:
space:
mode:
Diffstat (limited to 'include/py')
-rw-r--r--include/py/homekit/camera/config.py9
-rw-r--r--include/py/homekit/config/_configs.py1
-rw-r--r--include/py/homekit/util.py9
3 files changed, 19 insertions, 0 deletions
diff --git a/include/py/homekit/camera/config.py b/include/py/homekit/camera/config.py
index 8e9bfd5..8aeb392 100644
--- a/include/py/homekit/camera/config.py
+++ b/include/py/homekit/camera/config.py
@@ -73,6 +73,15 @@ class IpcamConfig(ConfigUnit):
'login': {'type': 'string', 'required': True},
'password': {'type': 'string', 'required': True},
}
+ },
+
+ 'web_creds': {
+ 'required': True,
+ 'type': 'dict',
+ 'schema': {
+ 'login': {'type': 'string', 'required': True},
+ 'password': {'type': 'string', 'required': True},
+ }
}
}
diff --git a/include/py/homekit/config/_configs.py b/include/py/homekit/config/_configs.py
index f88c8ea..2cd2aca 100644
--- a/include/py/homekit/config/_configs.py
+++ b/include/py/homekit/config/_configs.py
@@ -26,6 +26,7 @@ class LinuxBoardsConfig(ConfigUnit):
'schema': {
'mdns': {'type': 'string', 'required': True},
'board': {'type': 'string', 'required': True},
+ 'location': {'type': 'string', 'required': True},
'network': {
'type': 'list',
'required': True,
diff --git a/include/py/homekit/util.py b/include/py/homekit/util.py
index 78a78a0..2b06600 100644
--- a/include/py/homekit/util.py
+++ b/include/py/homekit/util.py
@@ -10,6 +10,7 @@ import string
import random
import re
import os
+import ipaddress
from enum import Enum
from datetime import datetime
@@ -37,6 +38,14 @@ def validate_ipv4_or_hostname(address: str, raise_exception: bool = False) -> bo
return False
+def validate_ipv4(address: str) -> bool:
+ try:
+ ipaddress.IPv6Address(address)
+ return True
+ except ipaddress.AddressValueError:
+ return False
+
+
def validate_mac_address(mac_address: str) -> bool:
mac_pattern = r'^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$'
if re.match(mac_pattern, mac_address):