Nabaztag - A module to interface your nabaztag!


Version 0.04

ABOUT complies with nabaztag API V1 from violet company.

The API tied to this module can be downloaded here

See api mailing list at

See help at


This module is designed to allow you to control a nabaztag with perl programming language. See ABOUT section to know which api it fits.

It has been tested with my own nabaztag and seems to work perfectly.

It also provide a simple command line tool to try your nabaztag: nabaztry (see SYNOPSIS). This tool is install in /usr/bin/

It makes great use of LWP::Simple to interact with the rabbit.

PROXY issues:

 If you're behind a proxy, see LWP::Simple proxy issues to know how to deal with that.
 Basically, set env variable HTTP_PROXY to your proxi url in order to make it work.
 For instance : export HTTP_PROXY=




Perl code:

    use Nabaztag ; # OR
    # use Nabaztag { 'debug' => 1 } ;

    my $nab = Nabaztag->new();


    # See new function to have details about how to get these properties.



    $nab->sayThis("Demain, il pleuvra des grillons jusqu'a extinction totale de la race humaine.");

See detailled methods for full possibilities.

Gory details :

You can access or modify BASE_URL by accessing: $Nabaztag::BASE_URL ;

For application id : $Nabaztag::ID_APP ;



Returns a new software nabaztag with ears position fetched from the hardware one if the mac and token is given.

It has following properties:

  key : The key given here to register your service
  mac : MAC Adress of nabaztag - equivalent to Serial Number ( SN ). Written at the back
        of your nabaztag !!
  token :  TOKEN Given by to allow interaction with you nabaztag. See
  to obtain yours !!
  leftEarPos : position of left ear.
  rightEarPos : position of right ear.
  ttl : how long, in seconds, the message is going to stay on the server, if undefined it will stay until archived.
  speed : choose the speed of speaking in percent - normal is 100, 200 is double speed, 50 is half speed
  pitch : modulate speech frequency in percent - normal is 100

usage: my $nab = Nabaztag->new($mac, $token, $key); print $nab->leftEarPos(); print $nab->rightEarPos();


    my $nab = Nabaztag->new();

    print $nab->leftEarPos();
    print $nab->rightEarPos();


Get/Sets the language the nabaztag is currently speaking.

Usage: $nab->language('en');

The language has to be in the list ('fr', 'en'). Default is 'fr' ;-)


Get/Sets the voice the nabaztag is using to make the Text To Speech conversion by setting the index of the voices list (zero based)

Usage: $nab->voice(0);

The voice index has to be in the range of the list of voices associated to the currently defined language (French and English have a different set) To retrieve the list of voices is currently able to speak: @voices = $nab->voices();


Get/Sets the left ear position of the nabaztag.

Usage: $nab->leftEarPos($newPos);

The new position has to be between 0 (vertical ear) and 16 included


 See leftEarPos. Same but for right.


Given a message number, sends this message to this nabaztag.

To obtain message numbers, go to and choose a message !!

Usage: $nab->sendMessageNumber($num);


Synchronise the current state of the soft nabaztag with the hardware one. Actually sends the state to the hardware nabaztag.




Fetches the real position of ear from the device and fill the leftEarPos and the rightEarPos properties.


Makes the rabbit tell the sentence you give as parameter


    $nab->sayThis("Demain, il pleuvra des grillons jusqu'a extinction totale de la race humaine."); # (example)


Sends a choregraphy to the rabbit, with the optionnaly given title

Please refer to the APIV1 documentation to know how to compose your choregraphy

Usage: my $chor = '10,0,motor,1,20,0,0,0,led,2,0,238,0,2,led,1,250,0,0,3,led,2,0,0,0' ; my $title = 'example' ; $nab->danceThis($chor, $title);


Sends the given message id to the given nabcast id with given title

Please refer to nabaztag website to get these identifiers.

usage: $nab->nabcastMessage($nabcastId, $title, $idMessage);


Sends the given texttosay to the given nabcast id with given title

Please refer to nabaztag website to get these identifiers.

usage: $nab->nabcastText($nabcastId, $title, $texttosay);


Returns a cooked url ready for sending something usefull


    my $url = $this->_cookUrl();


Jerome Eteve, <> Christophe Gevrey << <> >>


Please report any bugs or feature requests to, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.



Copyright 2005 Jerome Eteve, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.