Skip to content

Commit

Permalink
feat: enable alarm setting in config (#97)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
cdnninja and pre-commit-ci[bot] authored Sep 28, 2024
1 parent 7a55ecc commit 4560238
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions yoto_api/YotoAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 4560238

Please sign in to comment.