Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/network_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def read_config(props_path: str) -> dict:
# Connect to camera
cam = Camera(ip, un, pw)

# Set NTP
cam.set_ntp(enable=True, interval=1440, port=123, server="time-b.nist.gov")

# Get current network settings
current_settings = cam.get_network_general()
print("Current settings:", current_settings)
Expand Down
21 changes: 21 additions & 0 deletions reolinkapi/mixins/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,27 @@ def set_wifi(self, ssid: str, password: str) -> Dict:
}}}]
return self._execute_command('SetWifi', body)

def set_ntp(self, enable: bool = True, interval: int = 1440, port: int = 123, server: str = "pool.ntp.org") -> Dict:
"""
Set NTP settings.

:param enable: bool
:param interval: int
:param port: int
:param server: str
:return: Dict
"""
body = [{"cmd": "SetNtp", "action": 0, "param": {
"Ntp": {
"enable": int(enable),
"interval": interval,
"port": port,
"server": server
}}}]
response = self._execute_command('SetNtp', body)
print("Successfully Set NTP Settings")
return response

def get_net_ports(self) -> Dict:
"""
Get network ports
Expand Down