Skip to main content

A python package that makes it a bit easier to work with the yoto play API. Not associated with Yoto in any way.

Project description

Introduction

Early days of this API. Plan is to use this for home assistant. So far basic device data comes back including online. The library of cards is also populated. Pause command functions. Not other commands work yet.

Credit

A big thank you to @buzzeddesign for helping to sniff some of the API and make sense of it. Thank you to @fuatakgun for creating to core architecture is based on over in kia_uvo

Example Test Code

To run this code for test I am doing:

from pathlib import Path
import logging
import sys
import os

path_root = r"C:path to files GitHub\main\yoto_api"
sys.path.append(str(path_root))
from yoto_api import *

logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format='%(asctime)s %(name)s %(levelname)s:%(message)s')
logger = logging.getLogger(__name__)

ym = YotoManager(username="username", password="password")
ym.check_and_refresh_token()
ym.update_player_status()
print (ym.players)
ym.connect_to_events()
# Pauses the first player
ym.pause_player(next(iter(ym.players)))
# Sleep will let the terminal show events coming back. For dev today.
time.sleep(60)

Usage

For additional methods not mentioned below follow the file here for all functionality: https://github.com/cdnninja/yoto_api/blob/master/yoto_api/YotoManager.py

Check and refresh token will pull the first set of data. It also should be run regularly if you keep your code running for days. It will check if the token is valid. If it isn’t it will refresh the token. If this is first run of the command and no data has been pulled it will also run update_player_status() and update_cards() for you.

ym.check_and_refresh_token()

Check and refresh token will pull the first set of data. It also should be run regularly if you keep your code running for days. It will check if the token is valid. If it isn’t it will refresh the token. If this is first run of the command and no data has been pulled it will also run update_player_status() and update_cards() for you.

ym.update_player_status()

Connects to the MQTT broker. This must be run before any command and also get get useful data.

ym.connect_to_events()

Pauses the player for the player ID sent. ID can be found in ym.players.keys()

ym.pause_player(player_id: str)

Updates the library of cards. This is done as part of check_refresh_token so only needed if data is stale.

ym.update_cards()

Contains player object will data values you can access.

ym.players

Contains the library of cards. Each card being an object with the data values you can use.

ym.library

Other Notes

This is not associated or affiliated with yoto play in any way.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yoto_api-1.18.1.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

yoto_api-1.18.1-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file yoto_api-1.18.1.tar.gz.

File metadata

  • Download URL: yoto_api-1.18.1.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for yoto_api-1.18.1.tar.gz
Algorithm Hash digest
SHA256 769fbc6a080ed2036c6b8148f42775982fff6333bcea7f361b00fb8a1818f0ec
MD5 ad49b27a7a78c9348f13b232788991a1
BLAKE2b-256 c8ef8f701ebfb00a00e95bff0e12345a553111ccd4e459dd65d670f43c523edb

See more details on using hashes here.

File details

Details for the file yoto_api-1.18.1-py3-none-any.whl.

File metadata

  • Download URL: yoto_api-1.18.1-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for yoto_api-1.18.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e027e8fe11ccf6df9717b2278e1bd5149fd47b3b3a4a1f2c454263c3e2d2708b
MD5 56d1efc5bfff29e9dcc781f0cb075f2b
BLAKE2b-256 79580917d1bd9e95abb76c8cdcf7287e9223d8cf6dc5a92fe96082e2949e58cd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page