GithubHelp home page GithubHelp logo

php-nadc338's Introduction

php-NADC338

php API for NAD C338 Amplifier automation

Here is an API to use/integrate your NAD C338 Amplifier via php. With this API, you can power it on, set it to standby, get used source and change it, same for volume, Bass EQ, etc.

I developed this API specifically to integrate my C338 into my Jeedom. It works perfectly with a Script, both in iOS app and HomeKit. Of course you can use it with lot of automation solutions or alone with any Apache server.

Requirements

  • NAD C338 Amplifier (yes, really!). Your amplifier must be setup on your wifi network.
  • PHP v5+

How-to

  • Download NAD-C338_API.php and put it on your server.
  • Include NAD-C338_API.php in your php script.
  • Start it with your C338 IP.

It is better to connect to your amplifier with a web browser first, to set it to static IP.

Connection

require('NAD-C338_API.php'); //NAD custom API
$ip = '192.168.0.38';

$_C338 = new NADC338($ip);
if (isset($_C338->error)) die('__ERROR__: '.$_C338->error);

Let the fun begin:

OPERATIONS

//Power:
/*
return 0 for off, 1 for on
I have set it like that for easier use in smarthome solutions, as switch are often binary.
*/
$getPower = $_C338->getPower();
echo 'getPower: ', $getPower, "<br>";

$_C338->powerOn();
$_C338->powerOff();

//Volume level:
$getVolume = $_C338->getVolume();
echo 'getVolume: ', $getVolume, "<br>";

$_C338->setVolume(); //Volume goes from -80 to 12

//Mute state:
$getMute = $_C338->getMute();
echo 'getMute: ', $getMute, "<br>";

$_C338->mute();
$_C338->unMute();

//Source:
$getSource = $_C338->getSource();
echo 'getSource: ', $getSource, "<br>";

//Available sources: 'Stream', 'Wireless', 'TV', 'Phono', 'Coax1', 'Coax2', 'Opt1', 'Opt2'
$_C338->setSource('Stream');

//LCD Brightness:
$getBrightness = $_C338->getBrightness();
echo 'getBrightness: ', $getBrightness, "<br>";

//Available value: 0 1 2 3, 0 being off then low, normal, bright
$_C338->setBrightness(2);

//Bass EQ:
$getBass = $_C338->getBass();
echo 'getBass: ', $getBass, "<br>";

$_C338->setBass();
$_C338->unsetBass();

//AutoSense:
$getAutoSense = $_C338->getAutoSense();
echo 'getAutoSense: ', $getAutoSense, "<br>";

$_C338->setAutoSense();
$_C338->unsetAutoSense();

//Auto Standby
$getAutoStandby = $_C338->getAutoStandby();
echo 'getAutoStandby: ', $getAutoStandby, "<br>";

$_C338->setAutoStandby();
$_C338->unsetAutoStandby();

//Firmware Version:
$getVersion = $_C338->getVersion();
echo 'getVersion: ', $getVersion, "<br>";

Finnally, in Jeedom :


Version history

v0.1 (2018-02-10)

  • First public version!

License

The MIT License (MIT)

Copyright (c) 2017 KiboOst

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

php-nadc338's People

Contributors

kiboost avatar niksac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

niksac

php-nadc338's Issues

NAD protocol

Hey!
Nice work. Sorry for contacting you this way, but i am very curious to where you found the documentation for how to communicate with the NAD C338.

I am considering buying this amp in order to control it with my own home automation system, but i will be writing it in Rust instead of php. And I would be more convinced to buy it if i found official documentation.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.