From b14766238163c6db1a4c7ca206d5454386770108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sat, 21 Nov 2020 16:52:04 +0000 Subject: [PATCH] Add NTP commands. --- neohub.py | 15 +++++++++++++++ test.py | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/neohub.py b/neohub.py index ce579e2..ce86bab 100644 --- a/neohub.py +++ b/neohub.py @@ -146,6 +146,8 @@ class NeoHub: Puts thermostats into frost mode and timeclocks are set to off. 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} @@ -168,6 +170,7 @@ class NeoHub: result = await self._send(message) return result + async def get_holiday(self): """ Get list of holidays @@ -243,3 +246,15 @@ class NeoHub: result = await self._send(message) 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 diff --git a/test.py b/test.py index d3da8c5..4bef39e 100755 --- a/test.py +++ b/test.py @@ -15,7 +15,7 @@ async def run(): hub = neohub.NeoHub() await hub.connect() system = await hub.get_system() - result = await hub.devices_sn() + result = await hub.set_ntp(True) print(result)