Skip to content

Commit

Permalink
oppo plugin: set command class automatically, remove some unneccessar…
Browse files Browse the repository at this point in the history
…y entries from plugin.yaml
  • Loading branch information
onkelandy committed Aug 16, 2024
1 parent 801a455 commit 4595ec8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
4 changes: 3 additions & 1 deletion oppo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SmartPluginWebIf():

else:
builtins.SDP_standalone = False
from lib.model.sdp.globals import (PLUGIN_ATTR_NET_HOST, PLUGIN_ATTR_CONNECTION, PLUGIN_ATTR_SERIAL_PORT, PLUGIN_ATTR_CONN_TERMINATOR, CONN_NET_TCP_CLI, CONN_SER_ASYNC)
from lib.model.sdp.globals import (PLUGIN_ATTR_NET_HOST, PLUGIN_ATTR_CONNECTION, PLUGIN_ATTR_SERIAL_PORT, PLUGIN_ATTR_CONN_TERMINATOR, CONN_NET_TCP_CLI, CONN_SER_ASYNC, PLUGIN_ATTR_CMD_CLASS)
from lib.model.smartdeviceplugin import SmartDevicePlugin, Standalone

CUSTOM_INPUT_NAME_COMMAND = 'custom_inputnames'
Expand All @@ -63,6 +63,8 @@ def _set_device_defaults(self):
self._parameters[PLUGIN_ATTR_CONNECTION] = CONN_NET_TCP_CLI
elif PLUGIN_ATTR_SERIAL_PORT in self._parameters and self._parameters[PLUGIN_ATTR_SERIAL_PORT]:
self._parameters[PLUGIN_ATTR_CONNECTION] = CONN_SER_ASYNC

self._parameters[PLUGIN_ATTR_CMD_CLASS] = SDPCommandParseStr

b = self._parameters[PLUGIN_ATTR_CONN_TERMINATOR].encode()
b = b.decode('unicode-escape').encode()
Expand Down
30 changes: 0 additions & 30 deletions oppo/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,6 @@ parameters:
de: Serieller Anschluss (z.B. /dev/ttyUSB0 oder COM1)
en: serial port (e.g. /dev/ttyUSB0 or COM1)

conn_type:
type: str
mandatory: false
valid_list:
- ''
- net_tcp_request
- net_tcp_client
- net_tcp_jsonrpc
- net_udp_server
- serial
- serial_async

description:
de: Verbindungstyp
en: connection type

command_class:
type: str
default: SDPCommandParseStr
valid_list:
- SDPCommand
- SDPCommandStr
- SDPCommandParseStr
- SDPCommandJSON
- SDPCommandViessmann

description:
de: Klasse für Verarbeitung von Kommandos
en: class for command processing

model:
type: str
mandatory: false
Expand Down

0 comments on commit 4595ec8

Please sign in to comment.