shelly script eval

shelly script eval

Evaluate JavaScript code

Synopsis

Evaluate a JavaScript expression in the context of a running script.

The script must be running for eval to work. The code argument can be multiple words that will be joined together.

1
shelly script eval <device> <id> <code> [flags]

Examples

1
2
3
4
5
6
7
8
  # Evaluate a simple expression
  shelly script eval living-room 1 "1 + 2"

  # Print a message
  shelly script eval living-room 1 "print('Hello from CLI!')"

  # Call a function defined in the script
  shelly script eval living-room 1 "myFunction()"

Options

1
  -h, --help   help for eval

Options inherited from parent commands

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
      --config string           Config file (default $HOME/.config/shelly/config.yaml)
      --log-categories string   Filter logs by category (comma-separated: network,api,device,config,auth,plugin)
      --log-json                Output logs in JSON format
      --no-color                Disable colored output
      --no-headers              Hide table headers in output
      --offline                 Only read from cache, error on cache miss
  -o, --output string           Output format (table, json, yaml, template) (default "table")
      --plain                   Disable borders and colors (machine-readable output)
  -q, --quiet                   Suppress non-essential output
      --refresh                 Bypass cache and fetch fresh data from device
      --template string         Go template string for output (use with -o template)
  -v, --verbose count           Increase verbosity (-v=info, -vv=debug, -vvv=trace)

SEE ALSO