Aller au contenu

Ampli Onkyo Et Hc2


BenjyNet

Messages recommandés

 bonjour,

 

depuis la mise a jour 3.907 ce plugin ne fonctionne plus, est ce que d'autre personne son dans le meme cas que moi? je le trouve tout de meme plus pratique que celui proposé par fibaro, on peut surtout le personalisé.

 

meci de vos reponces.

Lien vers le commentaire
Partager sur d’autres sites

  • 1 mois après...

Normal que la v1.0.2 fonctionne, elle ne fait que envoyer les commandes sans rien vérifier (bien transmis ou pas ?). Sur la dernière version il y a ce contrôle mais ça pose des soucis sur certains amplis, j'attends la v4 pour faire quelque chose de définitif mais je sais pas si ce sera utile, un plugin existant déjà.

Lien vers le commentaire
Partager sur d’autres sites

J'ai la dernière version.

 

Je viens de rajouter mes sources que j'utilise principalement.

CBL/SAT, FM et PC.

 

J'ai un soucis juste avec le Power Status qui n'indique pas ON. Le mutting marche super bien sinon. Mais bon pas grave, il est tout le temps en ON car j'ai mis HDMI (Game) branché sur le pc donc en triple écran et donc pour ne pas avoir des soucis, je dois toujours l'avoir allumer.

Lien vers le commentaire
Partager sur d’autres sites

  • 1 mois après...

J'suis dégoutté ! Malgré le fait de pouvoir écouter mes radios grâce au port ethernet j'étais confiant de pouvoir

piloter mon ONKYO TX-NR808 avec le plugin et bien Nada ! même après avoir rentré son adresse IP et le port 60128,

et bien la télécommande virtuel ne fonctionne pas, aucune touche d’ailleurs !

Lien vers le commentaire
Partager sur d’autres sites

  • 1 an après...

Salut

 

J'ai un souci avec le main loop

 

En debug je recois 

 
[DEBUG] 18:25:13: HC2 start script at Sat Jan 23 18:25:13 2016
[DEBUG] 18:25:13: Start process #0, please wait...
[DEBUG] 18:25:13: Request Power STATUS, #0 please wait...
[DEBUG] 18:25:13: Power STATUS command successufully transmited.
[DEBUG] 18:25:13: Result's lenght : 27 string
[DEBUG] 18:25:13: Result fail, retry process, #0 please wait...
[DEBUG] 18:25:13: Result's lenght : 26 string
[DEBUG] 18:25:13: PWR01
[DEBUG] 18:25:13: Result OK : PWR1
[DEBUG] 18:25:13: Power is ON
[DEBUG] 18:25:13: Request Volume LEVEL, #0 please wait...
[DEBUG] 18:25:13: Request Volume LEVEL command successufully transmited.
[DEBUG] 18:25:13: Result's lenght : 26 string
[DEBUG] 18:25:13: Result OK : MVL32MVL20
[DEBUG] 18:25:13: Volume is 32
[ERROR] 18:25:13: line 430: attempt to concatenate field '?' (a nil value)
Lien vers le commentaire
Partager sur d’autres sites

Donc il n'a pas réussi àrécupérer la source mais normalement j'ai pas de debug sur la ligne 429 parce que c'est lui qui te crée une erreur ! Si la source n'est pas récupérée, tu ne peux pas afficher une variable "nil", logique non ?

J'ai retrouvé mon code du main loop, tu veux que je te le post ?

Lien vers le commentaire
Partager sur d’autres sites


-------------------------------------------------------------

-- Plugin for Onkyo TX-NR626 receiver

-- Use port 60128

-- Version 1.1.1 (04-16-2014)

-- Author : Jean-christophe Vermandé modified by BenjyNet

-------------------------------------------------------------

-- Change log 1.1.0 to 1.1.1 :

-- Infinite loop in main loop rectified

-- Minor bugs fixed

--------------------------------------------------------c[_]-

fibaro:debug('Start process Main Loop v1.1.1');

local _deviceIp = fibaro:get(fibaro:getSelfId(), "IPAddress");

local _devicePort = fibaro:get(fibaro:getSelfId(), "TCPPort");

local _maxRetryProcess = 5;

local _trace = false;

-- Polling time (here = 2 min), you can change this

local _polling = 2*60*1000;

-- Name of your inputs, you can change this

input = {

[00] = "VIDEO1 - VCR/DVR",

[01] = "VIDEO2 - CBL/SAT",

[02] = "VIDEO3 - GAME/TV - GAME",

[03] = "VIDEO4 - AUX",

[04] = "VIDEO5 - AUX2",

[05] = "VIDEO6 - PC",

[16] = "BD/DVD",

[34] = "PHONO",

[35] = "TV/CD",

[36] = "TUNER - FM",

[37] = "TUNER - AM",

[38] = "TUNER",

[41] = "FRONT USB",

[42] = "REAR USB",

[43] = "NET",

[46] = "BLUETOOTH"

};

-- Name of your listenning modes, you can change this

mode = {

[00] = "STEREO",

[01] = "DIRECT",

[02] = "SURROUND",

[03] = "GAME-RPG",

[04] = "THX",

[05] = "GAME-ACTION",

[06] = "GAME-ROCK",

[08] = "ORCHESTRA",

[09] = "UNPLUGGED",

[10] = "STUDIO-MIX",

[11] = "TV LOGIC",

[12] = "ALL CH STEREO",

[13] = "THEATER-DIMENSIONAL",

[14] = "GAME-SPORT",

[15] = "MONO",

[17] = "PURE AUDIO",

[19] = "FULL MONO",

[22] = "AUDISSEY DSX",

[23] = "WHOLE HOUSE MODE",

[35] = "STAGE",

[37] = "ACTION",

[38] = "MUSIC",

[46] = "SPORTS",

[64] = "STRAIGHT DECODE",

[65] = "DOLBY EX",

[66] = "THX CINEMA",

[67] = "THX SURROUND EX",

[68] = "THX MUSIC",

[69] = "THX GAMES",

[80] = "THX CINEMA 2, U2/S2/II/S CINEMA",

[81] = "THX MUSIC MODE, THX U2/S2/II/S MUSIC",

[82] = "THX GAMES MODE, THX U2/S2/II/S GAMES",

[128] = "PLII/PLIIx MOVIE",

[129] = "PLII/PLIIx MUSIC",

[130] = "NEO:6 CINEMA/NEO:X CINEMA",

[131] = "NEO:6 MUSIC/NEO:X MUSIC",

[132] = "PLII/PLIIx THX CINEMA",

[133] = "NEO:6/NEO:X THX CINEMA",

[134] = "PLII/PLIIx GAME",

[137] = "PLII/PLIIx THX GAMES",

[140] = "NEO:6/NEO:X THX GAMES",

[141] = "PLII/PLIIx THX MUSIC",

[142] = "NEO:6/NEO:X THX MUSIC",

[144] = "PLIIz HEIGHT",

[148] = "PLIIz HEIGHT + THX CINEMA",

[149] = "PLIIz HEIGHT + THX MUSIC",

[150] = "PLIIz HEIGHT + THX GAMES",

[151] = "PLIIz HEIGHT + THX U2/S2 CINEMA",

[152] = "PLIIz HEIGHT + THX U2/S2 MUSIC",

[153] = "PLIIz HEIGHT + THX U2/S2 GAMES",

[154] = "NEO:X GAME",

[160] = "PLIIx/PLII MOVIE + AUDISSEY DSX",

[161] = "PLIIx/PLII MUSIC + AUDISSEY DSX",

[162] = "PLIIx/PLII GAME + AUDISSEY DSX",

[167] = "DOLBY EX + AUDISSEY DSX"

};

-- Device parameters

device = device or {

id = fibaro:getSelfId(),

power = 0,

mute = 0,

volume = 0,

source = "unknown",

lst_mode = "unknown"

};

-- Functions' declarations ------------------------------------

function trace(value)

if (_trace) then

return fibaro:debug(tostring(value));

end

end

function split(pString, pPattern)

local Table = {}

local fpat = "(.-)" .. pPattern

local last_end = 1

local s, e, cap = pString:find(fpat, 1)

while s do

if s ~= 1 or cap ~= "" then

table.insert(Table,cap)

end

last_end = e+1

s, e, cap = pString:find(fpat, last_end)

end

if last_end <= #pString then

cap = pString:sub(last_end)

table.insert(Table, cap)

end

return Table

end

function getPowerState(retry)

local retry = retry or 0;

local cmd = nil;

--notify user

trace("Request Power STATUS, #" .. retry .. " please wait...");

--send packet

bytes, errorCode = _tcpSocket:write("ISCP\0\0\0\16\0\0\0\12\1\0\0\0\!1PWRQSTN\0x1A\r\n");

-- check for error

if errorCode == 0 then

trace("Power STATUS command successufully transmited.");

fibaro:sleep(55);

-- amplifier sould return the string sent if success

while (cmd == nil and retry < _maxRetryProcess) do

local result = _tcpSocket:read();

-- check if result is equal than command to confirm success

trace("Result's lenght : " .. result:len() .. " " .. type(result));

cmd = string.match(result, "PWR%d%d");

if (cmd ~= nil) then

trace(cmd);

local pwr_value = tonumber(cmd:sub(4,5));

trace("Result OK : PWR" .. pwr_value);

return pwr_value;

else

trace("Result fail, retry process, #" .. retry .. " please wait...");

retry = retry + 1;

end

end

return nil;

else

if retry < _maxRetryProcess then

trace("Retry process, please wait...");

fibaro:sleep(2000);

return getPowerState(retry + 1);

end

return nil;

end

end

function getVolumeLevel(retry)

local retry = retry or 0;

local cmd = nil;

--notify user

trace("Request Volume LEVEL, #" .. retry .. " please wait...");

--send packet

bytes, errorCode = _tcpSocket:write("ISCP\0\0\0\16\0\0\0\12\1\0\0\0\!1MVLQSTN\0x1A\r\n");

-- check for error

if errorCode == 0 then

trace("Request Volume LEVEL command successufully transmited.");

fibaro:sleep(55);

retry = 0;

-- amplifier sould return the string sent if success

while (cmd == nil and retry < _maxRetryProcess) do

local result = _tcpSocket:read();

-- check if result is equal than command to confirm success

trace("Result's lenght : " .. result:len() .. " " .. type(result));

cmd = string.match(result, "MVL..");

if (cmd ~= nil) then

local vol_value = tonumber(cmd:sub(4, 5), 16);

trace("Result OK : MVL" .. vol_value .. cmd);

return vol_value;

else

trace("Result fail, retry process, #" .. retry .. " please wait...");

retry = retry + 1;

end

end

return nil;

else

if retry < _maxRetryProcess then

trace("Retry process, please wait...");

fibaro:sleep(2000);

return getVolumeLevel(retry + 1);

end

return nil;

end

end

function getSource(retry)

local retry = retry or 0;

local cmd = nil;

--notify user

trace("Request SOURCE, #" .. retry .. " please wait...");

--send packet

bytes, errorCode = _tcpSocket:write("ISCP\0\0\0\16\0\0\0\12\1\0\0\0\!1SLIQSTN\0x1A\r\n");

-- check for error

if errorCode == 0 then

trace("Request SOURCE command successufully transmited.");

fibaro:sleep(55);

-- amplifier sould return the string sent if success

while (cmd == nil and retry < _maxRetryProcess) do

local result = _tcpSocket:read();

-- check if result is equal than command to confirm success

trace("Result's lenght : " .. result:len() .. " " .. type(result));

cmd = string.match(result, "SLI..");

if (cmd ~= nil) then

local src_value = tonumber(cmd:sub(4, 5), 16);

trace("Result OK : SLI" .. src_value .. cmd);

return src_value;

else

trace("Result fail, retry process, #" .. retry .. " please wait...");

retry = retry + 1;

end

end

return nil;

else

if retry < _maxRetryProcess then

trace("Retry process, please wait...");

fibaro:sleep(2000);

return getSource(retry + 1);

end

return nil;

end

end

function getMute(retry)

local retry = retry or 0;

local cmd = nil;

--notify user

trace("Request MUTE, #" .. retry .. " please wait...");

--send packet

bytes, errorCode = _tcpSocket:write("ISCP\0\0\0\16\0\0\0\12\1\0\0\0\!1AMTQSTN\0x1A\r\n");

-- check for error

if errorCode == 0 then

trace("Request MUTE command successufully transmited.");

fibaro:sleep(55);

-- amplifier sould return the string sent if success

while (cmd == nil and retry < _maxRetryProcess) do

local result = _tcpSocket:read();

-- check if result is equal than command to confirm success

trace("Result's lenght : " .. result:len() .. " " .. type(result));

cmd = string.match(result, "AMT..");

if (cmd ~= nil) then

local mute_value = tonumber(cmd:sub(4,5));

trace("Result OK : AMT" .. mute_value .. cmd);

return mute_value;

else

trace("Result fail, retry process, #" .. retry .. " please wait...");

retry = retry + 1;

end

end

return nil;

else

if retry < _maxRetryProcess then

trace("Retry process, please wait...");

fibaro:sleep(2000);

return getMute(retry + 1);

end

return nil;

end

end

function getLstMode(retry)

local retry = retry or 0;

local cmd = nil;

--notify user

trace("Request LISTENING MODE, #" .. retry .. " please wait...");

--send packet

bytes, errorCode = _tcpSocket:write("ISCP\0\0\0\16\0\0\0\12\1\0\0\0\!1LMDQSTN\0x1A\r\n");

-- check for error

if errorCode == 0 then

trace("Request LISTENING MODE command successufully transmited.");

fibaro:sleep(55);

-- amplifier sould return the string sent if success

while (cmd == nil and retry < _maxRetryProcess) do

local result = _tcpSocket:read();

-- check if result is equal than command to confirm success

trace("Result's lenght : " .. result:len() .. " " .. type(result));

cmd = string.match(result, "LMD..");

if (cmd ~= nil and cmd ~= "LMDN/") then

local mode_value = tonumber(cmd:sub(4,5), 16);

trace("Result OK : LMD" .. mode_value .. cmd);

return mode_value;

else

trace("Result fail, retry process, #" .. retry .. " please wait...");

retry = retry + 1;

end

end

return nil;

else

if retry < _maxRetryProcess then

trace("Retry process, please wait...");

fibaro:sleep(2000);

return getLstMode(retry + 1);

end

return nil;

end

end

function getAudioOutMode(retry)

local retry = retry or 0;

local cmd = nil;

--notify user

trace("Request AUDIO OUT MODE, #" .. retry .. " please wait...");

--send packet

bytes, errorCode = _tcpSocket:write("ISCP\0\0\0\16\0\0\0\12\1\0\0\0\!1IFAQSTN\0x1A\r\n");

-- check for error

if errorCode == 0 then

trace("Request AUDIO OUT MODE command successufully transmited.");

fibaro:sleep(55);

-- amplifier sould return the string sent if success

while (cmd == nil and retry < _maxRetryProcess) do

local result = _tcpSocket:read();

-- check if result is equal than command to confirm success

trace("Result's lenght : " .. result:len() .. " " .. type(result));

cmd = string.match(result, "IFA(.+)\n");

if (cmd ~= nil and cmd:len() > 5) then

trace(cmd .. cmd:len());

local audio_value = split(cmd,",");

trace("Result OK : LMD" .. audio_value[5] .. cmd);

return audio_value[5];

else

trace("Result fail, retry process, #" .. retry .. " please wait...");

retry = retry + 1;

end

end

return "STRAIGHT DECODE";

else

if retry < _maxRetryProcess then

trace("Retry process, please wait...");

fibaro:sleep(2000);

return getAudioOutMode(retry + 1);

end

return nil;

end

end

function refreshInterface()

if (device.power == true) then

local label = fibaro:getValue(device.id, "ui.lblPowerStatus.value");

if (label == "OFF") then fibaro:call(device.id, "setProperty", "ui.lblPowerStatus.value", "ON"); end

-- update UI volume

if (device.volume ~= nil) then

fibaro:debug("Volume is "..device.volume);

fibaro:call(device.id, "setProperty", "ui.VolumeSlider.value", device.volume);

else

fibaro:debug("Error, Volume not updated");

end

-- update UI input

if (device.source ~= nil) then

fibaro:debug("Source selected is "..input[device.source]);

fibaro:call(device.id, "setProperty", "ui.lblInput.value", input[device.source]);

else

fibaro:debug("Error, Source not updated");

end

-- update UI mute

if (device.mute ~= nil) then

fibaro:debug("Mute is set to "..device.mute);

if (device.mute == 1 and label:match("Mutting") == nil) then

local labelUpdated = label .. " - Mutting";

fibaro:call(device.id, "setProperty", "ui.lblPowerStatus.value", labelUpdated);

elseif (device.mute == 0 and label:match("Mutting") == "Mutting") then

local labelUpdated = label:gsub("%s[-]%sMutting", "");

fibaro:call(device.id, "setProperty", "ui.lblPowerStatus.value", labelUpdated);

end

else

fibaro:debug("Error, Mute not updated");

end

-- update UI mode

if (device.lst_mode ~= nil) then

fibaro:call(device.id, "setProperty", "ui.lblCurrentMode.value", device.lst_mode);

else

fibaro:debug("Error, Listening mode not updated");

end

else

fibaro:call(device.id, "setProperty", "ui.lblPowerStatus.value", "OFF");

fibaro:call(device.id, "setProperty", "ui.lblInput.value", "unknown");

fibaro:call(device.id, "setProperty", "ui.VolumeSlider.value", "0");

fibaro:call(device.id, "setProperty", "ui.lblCurrentMode.value", "unknown");

end

return true;

end

function main()

-- prepare a global counter

if (_count == nil) then

fibaro:debug("HC2 start script at " .. os.date());

_count = 0;

end

--notify begin of process

fibaro:debug("Start process #".._count..", please wait...");

--open the socket

if (_tcpSocket == nil) then

_tcpSocket = Net.FTcpSocket(_deviceIp, _devicePort);

--set the read timeout

_tcpSocket:setReadTimeout(1000);

end

-- Query power status

local power = getPowerState();

if (power == 1) then

device.power = true;

fibaro:debug("Power is ON ");

fibaro:sleep(100);

-- Query volume

device.volume = getVolumeLevel();

fibaro:sleep(100);

-- Query source

device.source = getSource();

fibaro:sleep(100);

-- Query mute

device.mute = getMute();

fibaro:sleep(100);

-- Query mode

local temp = getLstMode();

if (temp ~= nil) then

fibaro:debug("Listenning Mode is set to "..mode[temp]);

if (temp == 64) then

fibaro:sleep(100);

device.lst_mode = getAudioOutMode();

else

device.lst_mode = mode[temp];

end

end

elseif (power == 0) then

device.power = false;

fibaro:debug("Power is OFF ");

else

fibaro:debug("No Response... check later...");

end

-- call refresh interface to repaint UI

refreshInterface();

-- dispose socket

if (_tcpSocket ~= nil) then

-- close socket

_tcpSocket:disconnect();

-- destroy object

_tcpSocket = nil;

end

--notify end of process

fibaro:debug("Process #".._count.." is finish!");

-- increment global counter

_count = _count + 1;

end

-- Start main loop process

main();

-- Sleep

fibaro:sleep(_polling);

-- EOF Main loop

Lien vers le commentaire
Partager sur d’autres sites

The same error

 

[DEBUG] 19:56:47: Start process Main Loop v1.1.1
[DEBUG] 19:56:47: HC2 start script at Sat Jan 23 19:56:47 2016
[DEBUG] 19:56:47: Start process #0, please wait...
[DEBUG] 19:56:47: Power is ON
[DEBUG] 19:56:48: Listenning Mode is set to THEATER-DIMENSIONAL
[DEBUG] 19:56:48: Volume is 37
[ERROR] 19:56:48: line 377: attempt to concatenate field '?' (a nil value)

Lien vers le commentaire
Partager sur d’autres sites

  • 4 mois après...
×
×
  • Créer...