Skip to content

Commit

Permalink
Update connectorUpdate()
Browse files Browse the repository at this point in the history
- Updated connectorUpdate() connectorValue needs to be a String Also for connectorId It needs a prefix of "pc_pluginid_" + connectorid
  • Loading branch information
KillerBOSS2019 committed Jan 11, 2022
1 parent c965b44 commit 0875075
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions TouchPortalAPI/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,9 @@ def connectorUpdate(self, connectorId:str, connectorValue:int):
Args:
`connectorId`: Cannot be longer then 200 characters.
connectorId have syntax that you need to follow https://www.touch-portal.com/api/index.php?section=connectors
Also according to that site It requires you to have prefix "pc_yourPluginId_" + connectorid however This already provide
you the prefix and the pluginId so you just need you take care the rest eg connectorid|setting1=aValue
`connectorValue`: Must be an integer between 0-100.
"""
if not isinstance(connectorId, str):
Expand All @@ -443,8 +446,8 @@ def connectorUpdate(self, connectorId:str, connectorValue:int):
if 0 <= connectorValue <= 100:
self.send({
"type": "connectorUpdate",
"connectorId": connectorId,
"value": connectorValue
"connectorId": f"pc_{self.pluginId}_{connectorId}",
"value": str(connectorValue)
})
else:
raise TypeError(f"connectorValue needs to be between 0-100 not {connectorValue}")
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9'
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10'
]

setup(
Expand Down

0 comments on commit 0875075

Please sign in to comment.