Skip to main content

keiko

https://badge.fury.io/py/keiko.png https://travis-ci.org/lanius/keiko.png https://coveralls.io/repos/lanius/keiko/badge.png

keiko is Python and Web API clients for Keiko-chan.

Installation

keiko can be installed via pip or easy_install:

$ pip install keiko

Or:

$ easy_install keiko

Usage

Firstly, setup Keiko-chan and assign IP address.

Python

Specify the address of Keiko-chan and instantiate the client:

>>> import keiko
>>> address = '192.168.1.2'  # example address of Keiko-chan
>>> client = keiko.Client(address)

Control the lamps:

>>> client.lamps.green.on()  # turns on the lamp
>>> client.lamps.green.status
'on'
>>> client.lamps.green.off()  # turns off the lamp
>>> client.lamps.green.status
'off'
>>> client.lamps.yellow.blink()  # blinks the lamp
>>> client.lamps.yellow.status
'blink'
>>> client.lamps.red.quickblink()  # blinks the lamp quickly
>>> client.lamps.red.status
'quickblink'
>>> client.lamps.off()  # turns off the all lamps

With delay and duration time:

>>> client.lamps.red.on(wait=2, time=4)  # wait 2 second, light 4 seconds

Control the buzzer:

>>> client.buzzer.on()  # turns on the buzzer
>>> client.buzzer.status
'continuous'
>>> client.buzzer.off()  # turns off the buzzer
>>> client.buzzer.status
'off'

Control the direct inputs and outputs:

>>> client.di.status
{1: 'off', 2: 'off', 3: 'off', 4: 'off'}
>>> client.do.status
{1: 'off', 2: 'off', 3: 'off', 4: 'off'}
>>> client.do(2).on()
>>> client.do(2).status
'on'
>>> client.do.status
{1: 'off', 2: 'on', 3: 'off', 4: 'off'}

Control the voices:

>>> client.voices.status
'stop'
>>> client.voices(1).play()  # plays #1 voice
>>> client.voices.stop()  # stops the voice
>>> client.voices(5).play(3)  # plays #5 voice 3 times
>>> client.voices.stop()
>>> client.voices(10).repeat()  # plays #10 voice repeatedly
>>> client.voices.stop()

Web API

Specify the address of Keiko-chan and run Web API server:

$ keiko 192.168.1.2
 * Running on http://127.0.0.1:8080/

Pass optional parameters to the server:

$ keiko 192.168.1.2 --server myhost:5000
 * Running on http://myhost:5000/

Control the lamps:

$ curl http://127.0.0.1:8080/lamps
{
  "lamps": {
    "green": "off",
    "red": "off",
    "yellow": "off"
  }
}

$ curl http://127.0.0.1:8080/lamps/green/on
{
  "result": "success"
}

$ curl http://127.0.0.1:8080/lamps/green
{
  "lamps": {
    "green": "on"
  }
}

With delay and duration time:

$ curl http://127.0.0.1:8080/lamps/yellow/on?wait=2&time=4
{
  "result": "success"
}

Control the buzzer:

$ curl http://127.0.0.1:8080/buzzer
{
  "buzzer": "off"
}

$ curl http://127.0.0.1:8080/buzzer/on
{
  "result": "success"
}

Control the direct inputs and outputs:

$ curl http://127.0.0.1:8080/di
{
  "di": {
    "1": "off",
    "2": "off",
    "3": "off",
    "4": "off"
  }
}

$ curl http://127.0.0.1:8080/do
{
  "do": {
    "1": "off",
    "2": "off",
    "3": "off",
    "4": "off"
  }
}

$ curl http://127.0.0.1:8080/do/2/on
{
  "result": "success"
}

Control the voices:

$ curl http://127.0.0.1:8080/voices
{
  "voices": "stop"
}

$ curl http://127.0.0.1:8080/voices/10/play
{
  "result": "success"
}

Caveats

This module is unofficial and tested with only Keiko-chan 4G+ (DN-1510GL) yet. For more details, see the official documentation.

Metadata

Release files for keiko 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distributions (sdists)

Source distribution for keiko 0.2.0
File Size Uploaded Provenance Actions
keiko-0.2.0.zip 17.4 kB Without provenance Details for keiko-0.2.0.zip
keiko-0.2.0.tar.gz 11.2 kB Without provenance Details for keiko-0.2.0.tar.gz

Release files / keiko-0.2.0.zip

Download URL keiko-0.2.0.zip
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
886f4a1b66a0f6b5f2a364a417d31053f2cae134392345b38433071e9ef9092f
BLAKE2b-256 checksum
How to use checksums
b6e0a15538261a6801f88d2c50202270ffc384d06e27edb4a8df919b7d2da637
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / keiko-0.2.0.tar.gz

Download URL keiko-0.2.0.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e1dfe93094cc4896dc11e818b7e3aeead2fb3e6c14351525c7dee24b17347b92
BLAKE2b-256 checksum
How to use checksums
366bd90b5ba3575001649d24ca2883d95886fd26a8eba5b4aeb8ae801399a94f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for keiko 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page