inverse / python-aiotomato

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AIOTomato

CI Code style: black

A simple and limited wrapper for Tomato based router firmwares such as FreshTomato.

It's limited to only WIFI enabled devices due to what the API provides.

Usage

Below is an example of how it can be used to print out a list of devices and get their online status.

import os

from aiotomato.client import Client

client = Client(
    os.getenv("ROUTER_HOST", ""),
    os.getenv("ROUTER_USER", ""),
    os.getenv("ROUTER_PASS", ""),
    os.getenv("ROUTER_HTTP_ID", ""),
)

for device in client.fetch_devices():
    print(f"name: {device.name}")
    print(f"ip: {device.ip}")
    print(f"mac: {device.mac}")
    print(f"is_online: {device.is_online}")

Where the HTTP ID can be obtained by inspecting the source code when logged into the admin inteface of the router searching for http_id.

Licence

MIT

About

License:MIT License


Languages

Language:Python 100.0%