Hello
J’ai vu le sujet getCmdByName existe? que @Mips et @sigalou ont fait sur pratiquement le même sujet.
J’arrive à créer mes commandes mais je n’arrive pas à lier
public static function addcommande() {
$info = $TEST->AddCommandeONOFF('ETAT',$Commande['ep_id'],"info","binary");
$info = $TEST->AddCommandeONOFF('ON',$Commande['ep_id'],"action","other");
$info = $TEST->AddCommandeONOFF('OFF',$Commande['ep_id'],"action","other");
}
Je créer mes commandes
public function AddCommandeONOFF($Name,$_logicalId, $Type="info", $SubType='binary') {
$_eqName = $this->getid();
if ($Name =="ETAT") {
$_logicalId_COM = $_logicalId;
} else {
$_logicalId_COM = $Name .'_'.$_logicalId;
}
$Commande = $this->getCmd(null,$Name.'_'.$_logicalId_COM);
if (!is_object($Commande)){
$Commande = new roseeCmd();
$Commande->setId(null);
$Commande->setLogicalId($_logicalId_COM); // Id de la commande
$Commande->setEqLogic_id($this->getId());
$Commande->setName($Name);// nom de la commande;
$Commande->setUnite(''); // Unité
$Commande->setType($Type); // Type
$Commande->setIsVisible(1); // Visibilité
$Commande->setIsHistorized(0);
$Commande->setSubType($SubType); // Sous type
$Commande->setDisplay('generic_type','');
if ($Name !="ETAT" && $Name =="ON"){
$Liaison = $this->getCmd(null, 'ETAT');
$commande->setValue($Liaison->getId());
} else if ($Name !="ETAT" && $Name =="OFF"){
$Liaison = $this->getCmd(null, 'ETAT');
$commande->setValue($Liaison->getId());
} else{
}
$Commande->save();
}
return $Commande;
}
si je fais cela dans la fonction AddCommandeONOFF je n’arrive pas à les lier. Je ne comprend pas pourquoi.
j’ai pourtant mis un « logicalId » mais là je bloque depuis plusieurs jours
merci de votre aide