diff --git a/yoto_api/YotoAPI.py b/yoto_api/YotoAPI.py index c847a42..2f8bb68 100644 --- a/yoto_api/YotoAPI.py +++ b/yoto_api/YotoAPI.py @@ -327,6 +327,22 @@ def set_player_config(self, token: Token, player_id: str, config: YotoPlayerConf config_payload["nightAmbientColour"] = config.night_ambient_colour if config.night_max_volume_limit: config_payload["nightMaxVolumeLimit"] = str(config.night_max_volume_limit) + if config.alarms: + alarm_payload = [] + for alarm in config.alarms: + payload = ( + str(alarm.days_enabled) + + "," + + str(alarm.time) + + "," + + str(alarm.sound_id) + + ",,," + + str(alarm.volume) + + "," + + str(int(alarm.enabled)) + ) + alarm_payload.append(payload) + config_payload["alarms"] = alarm_payload data = {"deviceId": player_id, "config": config_payload} headers = self._get_authenticated_headers(token) response = requests.put(url, headers=headers, data=json.dumps(data)).json()