remotivelabs-cli 0.0.37__py3-none-any.whl → 0.0.38__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cli/connect/connect.py CHANGED
@@ -27,10 +27,13 @@ def protopie( # pylint: disable=R0913
27
27
  resolve_path=True,
28
28
  help="Configuration file with signal subscriptions and mapping if needed",
29
29
  ),
30
- signal: List[str] = typer.Option(None, help="Signal names to subscribe to, mandatory when not using script"),
30
+ signal: List[str] = typer.Option([], help="Signal names to subscribe to, mandatory when not using script"),
31
31
  signal_name_expression: str = typer.Option(
32
32
  None, help='[Experimental] Python expression to rename signal names, i.e \'lower().replace(".","_")\''
33
33
  ),
34
+ changed_values_only: bool = typer.Option(
35
+ True, help="Only receive signal when its value is changed to minimize amount of data received"
36
+ ),
34
37
  broker_url: str = typer.Option(..., help="Broker URL", envvar="REMOTIVE_BROKER_URL"),
35
38
  api_key: str = typer.Option(None, help="Cloud Broker API-KEY", envvar="REMOTIVE_BROKER_API_KEY"),
36
39
  pp_connect_host: str = typer.Option("http://localhost:9981", help="ProtoPie Connect URL"),
@@ -111,4 +114,5 @@ def protopie( # pylint: disable=R0913
111
114
  expression=signal_name_expression,
112
115
  config=config,
113
116
  signals=signals_to_subscribe_to,
117
+ on_change_only=changed_values_only,
114
118
  )
@@ -85,6 +85,7 @@ def _connect_to_broker(
85
85
  config: Union[Path, None] = None,
86
86
  signals_to_subscribe_to: Union[List[SubscribableSignal], None] = None,
87
87
  expression: str = "",
88
+ on_change_only: bool = False,
88
89
  ) -> None: # noqa: C901
89
90
  signals, namespaces, sub = get_signals_and_namespaces(config, signals_to_subscribe_to)
90
91
 
@@ -107,10 +108,12 @@ def _connect_to_broker(
107
108
  signal_name = get_signal_name(expression, s.name())
108
109
  io.emit("ppMessage", {"messageId": signal_name, "value": str(s.value())})
109
110
 
110
- grpc_connect(on_signals, signals_to_subscribe_to)
111
+ grpc_connect(on_signals, signals_to_subscribe_to, on_change_only)
111
112
 
112
113
 
113
- def grpc_connect(on_signals: Any, signals_to_subscribe_to: Union[List[SignalIdentifier], None] = None) -> None:
114
+ def grpc_connect(
115
+ on_signals: Any, signals_to_subscribe_to: Union[List[SignalIdentifier], None] = None, on_change_only: bool = False
116
+ ) -> None:
114
117
  try:
115
118
  pretty_print("Connecting and subscribing to broker...")
116
119
  subscription = None
@@ -121,7 +124,7 @@ def grpc_connect(on_signals: Any, signals_to_subscribe_to: Union[List[SignalIden
121
124
  if signals_to_subscribe_to is None:
122
125
  print("No sigs")
123
126
  return
124
- subscription = client.subscribe(signals_to_subscribe_to=signals_to_subscribe_to, changed_values_only=False)
127
+ subscription = client.subscribe(signals_to_subscribe_to=signals_to_subscribe_to, changed_values_only=on_change_only)
125
128
  pretty_print("Subscription to broker completed")
126
129
  pretty_print("Waiting for signals...")
127
130
 
@@ -158,6 +161,7 @@ def do_connect(
158
161
  config: Union[Path, None],
159
162
  signals: List[SubscribableSignal],
160
163
  expression: Union[str, None],
164
+ on_change_only: bool = False,
161
165
  ) -> None:
162
166
  global broker
163
167
  global x_api_key
@@ -180,7 +184,7 @@ def do_connect(
180
184
  while is_connected is None:
181
185
  time.sleep(1)
182
186
  # if expression is not None:
183
- _connect_to_broker(signals_to_subscribe_to=signals, config=config, expression=expression)
187
+ _connect_to_broker(signals_to_subscribe_to=signals, config=config, expression=expression, on_change_only=on_change_only)
184
188
  except SocketIoConnectionError as e:
185
189
  err_console.print(":boom: [bold red]Failed to connect to ProtoPie Connect[/bold red]")
186
190
  err_console.print(e)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: remotivelabs-cli
3
- Version: 0.0.37
3
+ Version: 0.0.38
4
4
  Summary: CLI for operating RemotiveCloud and RemotiveBroker
5
5
  Author: Johan Rask
6
6
  Author-email: johan.rask@remotivelabs.com
@@ -33,8 +33,8 @@ cli/cloud/storage/copy.py,sha256=4FDBNZVcHKxDI9vU8qawOBcWNYobZu8RdtPUHZsY7iA,325
33
33
  cli/cloud/storage/uri_or_path.py,sha256=DLlyr0RAV-DRlL2C36U-jvUqwiLIlkw7c3mJ7SSGMdI,1158
34
34
  cli/cloud/uri.py,sha256=QZCus--KJQlVwGCOzZqiglvj8VvSRKxfVvN33Pilgyg,3616
35
35
  cli/connect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
- cli/connect/connect.py,sha256=U--6dtHxUlvE81J37rABFez4TbF7AXWOpZYZnL7sPMY,3994
37
- cli/connect/protopie/protopie.py,sha256=xEfCgoW4p0vlWnSBvgBeDN9QSlyKcOcHfa6EyeAyVoM,6364
36
+ cli/connect/connect.py,sha256=UPEdul9lJFfAmaJmWXaduSXOvRiA9Xs35kNRxAbdy-Y,4192
37
+ cli/connect/protopie/protopie.py,sha256=GRFN4P5zxWcgwuIwRKUeJ3ie0HqtHUxN7f6dsWPCfBc,6524
38
38
  cli/errors.py,sha256=8_BcTPX3mrPFDQJKKBg6ERjs6HSOiewrY86K1Jays74,1495
39
39
  cli/remotive.py,sha256=rwCIPFuWn0CNxLU2Sgwug5UVjletC1DTJrxUtGkVGPs,1907
40
40
  cli/settings/__init__.py,sha256=4Mj9DFvRBN0LKn6PPLrb-BmuObP707IYeRmg7t7aycg,288
@@ -46,8 +46,8 @@ cli/tools/can/RemotiveLabs.can1.log,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
46
46
  cli/tools/can/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  cli/tools/can/can.py,sha256=8uATViSFlpkdSiIm4fzbuQi1_m7V9Pym-K17TaJQRHU,2262
48
48
  cli/tools/tools.py,sha256=0KU-hXR1f9xHP4BOG9A9eXfmICLmNuQCOU8ueF6iGg0,198
49
- remotivelabs_cli-0.0.37.dist-info/LICENSE,sha256=qDPP_yfuv1fF-u7EfexN-cN3M8aFgGVndGhGLovLKz0,608
50
- remotivelabs_cli-0.0.37.dist-info/METADATA,sha256=kigJThZ9liO7Qm3yg2u5mw8WPQyx9mb-aFiEbVeeb4Y,1359
51
- remotivelabs_cli-0.0.37.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
52
- remotivelabs_cli-0.0.37.dist-info/entry_points.txt,sha256=lvDhPgagLqW_KTnLPCwKSqfYlEp-1uYVosRiPjsVj10,45
53
- remotivelabs_cli-0.0.37.dist-info/RECORD,,
49
+ remotivelabs_cli-0.0.38.dist-info/LICENSE,sha256=qDPP_yfuv1fF-u7EfexN-cN3M8aFgGVndGhGLovLKz0,608
50
+ remotivelabs_cli-0.0.38.dist-info/METADATA,sha256=4l6EOpR6IQM-uecpwJrIpqoF2SVbZaN6qQ1TimXItfQ,1359
51
+ remotivelabs_cli-0.0.38.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
52
+ remotivelabs_cli-0.0.38.dist-info/entry_points.txt,sha256=lvDhPgagLqW_KTnLPCwKSqfYlEp-1uYVosRiPjsVj10,45
53
+ remotivelabs_cli-0.0.38.dist-info/RECORD,,