Add NTP commands.

This commit is contained in:
Andrius Štikonas 2020-11-21 16:52:04 +00:00
parent bb96122a69
commit b147662381
2 changed files with 16 additions and 1 deletions

View File

@ -146,6 +146,8 @@ class NeoHub:
Puts thermostats into frost mode and timeclocks are set to off. Puts thermostats into frost mode and timeclocks are set to off.
Instead of this function it is recommended to use frost on/off commands. Instead of this function it is recommended to use frost on/off commands.
List of devices affected by this can be restricted using GLOBAL_DEV_LIST command
""" """
message = {"AWAY_ON" if state else "AWAY_OFF": 0} message = {"AWAY_ON" if state else "AWAY_OFF": 0}
@ -168,6 +170,7 @@ class NeoHub:
result = await self._send(message) result = await self._send(message)
return result return result
async def get_holiday(self): async def get_holiday(self):
""" """
Get list of holidays Get list of holidays
@ -243,3 +246,15 @@ class NeoHub:
result = await self._send(message) result = await self._send(message)
return result return result
async def set_ntp(self, state: bool):
"""
Enables NTP client on Neohub
"""
message = {"NTP_ON" if state else "NTP_OFF": 0}
reply = {"result": "ntp client started" if state else "ntp client stopped"}
result = await self._send(message, reply)
return result

View File

@ -15,7 +15,7 @@ async def run():
hub = neohub.NeoHub() hub = neohub.NeoHub()
await hub.connect() await hub.connect()
system = await hub.get_system() system = await hub.get_system()
result = await hub.devices_sn() result = await hub.set_ntp(True)
print(result) print(result)