Skip to content

Commit

Permalink
Added: TouchGo support
Browse files Browse the repository at this point in the history
Fixed: Example code
  • Loading branch information
ualex73 committed May 25, 2024
1 parent 821a0bc commit 4939116
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import asyncio
from goslideapi import GoSlideLocal

loop = asyncio.get_event_loop()
goslide = GoSlideLocal
goslide = GoSlideLocal()

result = loop.run_until_complete(goslide.slide_add("192.168.1.1", "anypassword", 2))
slide = loop.run_until_complete(goslide.slide_info("192.168.1.1"))
Expand All @@ -27,7 +27,7 @@ loop.run_until_complete(goslide.slide_close("192.168.1.1"))
```python

import asyncio
from goslideapi import GoSlideCloud
from goslideapi import GoSlideCloud()

loop = asyncio.get_event_loop()
goslide = GoSlideCloud('email', 'password')
Expand Down
29 changes: 28 additions & 1 deletion goslideapi/goslideapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,33 @@ async def slide_configwifi(self, hostname, ssid, password):
self._slide_api[hostname],
"POST",
"/rpc/Slide.Config.Wifi",
{"ssid": ssid, "pass": password},
data={"ssid": ssid, "pass": password},
)
return bool(resp)

async def slide_get_touchgo(self, hostname):
"""Retrieve the slide TouchGo setting."""
result = await self.slide_info(hostname)
if result:
if "touch_go" in result:
return result["touch_go"]
_LOGGER.error(
"SlideGetTouchGo: Missing key 'touch_go' in JSON=%s", json.dumps(result)
)

return None

async def slide_set_touchgo(self, hostname, value):
"""Change Touch-Go of a slide."""
if not await self._slide_exist(hostname):
return False

resp = await self._request(
hostname,
self._slide_passwd[hostname],
self._slide_api[hostname],
"POST",
"/rpc/Slide.touchGo",
data={"touch_go": value},
)
return bool(resp)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setuptools.setup(
name='goslide-api',
version='0.6.8',
version='0.6.9',
url='https://github.com/ualex73/goslide-api',
license='Apache License 2.0',
author='Alexander Kuiper',
Expand Down

0 comments on commit 4939116

Please sign in to comment.