KiwiHC16 / Abeille

Abeille pour Jeedom (Gateway ZiGate)
GNU Affero General Public License v3.0
60 stars 52 forks source link

Master: mono zigate -> mutli zigate: Call to a member function getHumanName() on boolean #984

Closed edgd1er closed 4 years ago

edgd1er commented 4 years ago

URL page: index.php?v=d&m=Abeille&p=Abeille

For an unknown reason, with the latest master, I have this error. If I remove "->getHumanName()", then the Abeille plugin page can be loaded. I suspect the function Abeille::byLogicalId( 'Abeille'.$i.'/Ruche', 'Abeille') to return a false value.

The code is looking for a Abeille1/Ruche in logicalId, but in the Database, I have only a Abeille/Ruche field content. Hence the error.

Temporary can be either:

UPDATE `jeedom`.`eqLogic` SET `logicalId`='Abeille1/Ruche' WHERE  `name`='Ruche';
echo '<div id="bt_include'.$i.'" > Zigate'.$i . ' - ' . Abeille::byLogicalId( 'Abeille'.$i.'/Ruche', 'Abeille')->getHumanName() . ' <i class="fa fa-plus-circle" style="font-size:160%;color:green" title="Inclusion: clic sur le plus pour mettre la zigate en inclusion."></i> </div>';

I guess the best fix would be to update database, @KiwiHC16 may confirm that before users update their Abeille's config ;)

 if (Abeille::getParameters()['AbeilleSerialPort' . $i] != "none") {
//// added -- start //////
$currentZigate = Abeille::byLogicalId('Abeille' . $i . '/Ruche', 'Abeille');
if ($i == 1 && $currentZigate == "") {
       $currentZigate = Abeille::byLogicalId('Abeille/Ruche', 'Abeille');
       }
//// added -- end //////
      echo '<div id="bt_include' . $i . '" > Zigate' . $i . ' - ' . $currentZigate->getHumanName() . ' <i class="fa fa-plus-circle" style="font-size:160%;color:green" title="Inclusion: clic sur le plus pour mettre la zigate en inclusion."></i> </div>';
KiwiHC16 commented 4 years ago
The code is looking for a Abeille1/Ruche in logicalId, but in the Database, I have only a Abeille/Ruche field content. Hence the error.

Oui il faut passer les "Abeille/xxxx" en "Abeille1/xxxx". La fonction doit être ajouté. Pas encore finalisé. J'ai un draft en cours.

C'est une des raisons qui fait que je n ai pas encore publié une stable multizigate.

KiwiHC16 commented 4 years ago

Should be solved with #974 related push.