Beiträge von trulede

    I've solved my own problem. You can send an "array of strings" in a Python Request object as a comma separated string. Code looks something like this:

    Code
    def schedule(self, schedule_rules: List[str] = list()) -> None:
        data = {
            'schedule': True if len(schedule_rules) else False,
            'schedule_rules' : ','.join(schedule_rules)
        }
        self._device.api_post(f'settings/relay/{self.id}', data)
        self.reload()

    Hi,

    I'm attempting to set the PlugS relay schedule_rules (/settings/relay/0) which is documented as an array of strings. I do this with Python code like this:

    Code
    requests.post(url, data={ 
        'schedule': True, 
        'schedule_rules': [
            '0700-0123456-on', 
            '0800-0123456-off',
        ]
    })

    Curriously, that results in only the first schedule_rules array element being set. The subsequent rule(s) are ignored.

    Does anyone have an idea how to encode that array of strings so that the Shelly HTTP API accepts the request?

    Thanks.