Beiträge von NicAtNite

    I have a Shelly Plus Plug S and wanted to change the LED color according to the Time of Day .

    Now when trying to create a schedule through the script editor i have hit a seeming limitation where the schedule isn't created if the JSON-RPC params array hits a certain nesting depth. And unfortunately the Plus Plug S's Plugs_UI method has the parameters for rgb and brightness quite deep down it's config tree.

    Following Code shows the last working depth that will successfully create a schedule, highlighted as "LAST_PARAMS":

    [script][/script]

    [script]Shelly.call("Schedule.Create", { [/script]

    [script]
    [/script]

    [script]"enable": true, [/script]

    [script]"timespec": "0 07 23 * * SUN,MON,TUE,WED,THU,FRI,SAT", [/script]

    [script]"calls": [{ [/script]

    [script]"method": "PLUGS_UI.SetConfig", [/script]

    [script]"params": { [/script]

    [script]"config" : { [/script]

    [script]"leds": { [/script]

    [script]"mode": "switch", [/script]

    [script]"colors": { [/script]

    [script]"switch:0": { [/script]

    [script]"on": "LAST_PARAMS", [/script]

    [script]"off": "LAST_PARAMS", [/script]

    [script]}, [/script]

    [script]"power": { [/script]

    [script]"brightness": 100 [/script]

    [script]} [/script]

    [script]}, [/script]

    [script]"night_mode": { [/script]

    [script]"enable": false, [/script]

    [script]"brightness": 10, [/script]

    [script]"active_between": ["22:00","06:00"] [/script]

    [script]} [/script]

    [script]}, [/script]

    [script]"controls": { [/script]

    [script]"switch:0": { [/script]

    [script]"in_mode": "momentary" [/script]

    [script]} [/script]

    [script]} [/script]

    [script]} [/script]

    [script]
    [/script]

    [script]
    [/script]

    [script]} [/script]

    [script]}] [/script]

    [script]});[/script]

    [script][/script]

    The Plus Plug S requires its rgb and brightness parameters to be set within "on" and "off" as follows, but adding those extra values to the code, even though it is just one more level, fails to create the schedule:

    [script][/script]

    [script]"on": { [/script]

    [script]"rgb": [100,100,100], [/script]

    [script]"brightness": 0 [/script]

    [script]}, [/script]

    [script]"off": { [/script]

    [script]"rgb": [100,100,100], [/script]

    [script]"brightness": 0 [/script]

    [script]}[/script]

    [script][/script]

    The documentation for the Schedule methods only mention a limitation for the number of calls made per schedule job (which is 5), but no limitation for the array depth. I find the behavior odd since if this is a limitation, Shelly could have structured their config trees to avoid the issue.

    Generally Shelly should expose the PLus Plug S's LED config to the Web and App Ui's, because setting the colors and brightness according to a schedule shouldn't require scripting, in my opinion.

    I have since created a workaround by creating schedules that trigger scripts that set the config, but since those are extra steps i wonder if someone knows how to get the setup working using just a schedule