Skip to content

Commit

Permalink
Cmd: formatAttribute() updated for type single/int8/int24/int32
Browse files Browse the repository at this point in the history
  • Loading branch information
tcharp38 committed Jan 17, 2024
1 parent e4356dc commit 16cf9c1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions core/class/AbeilleCmdProcess.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,22 @@ function formatAttribute($valIn, $type) {
case '25':
$valOut = sprintf("%012X", $valIn);
break;
case '28': // int8
$valOut = $this->signed2Hex($valIn, 1);
break;
case '29': // int16
case 'int16':
case '29':
$valOut = $this->signed2Hex($valIn, 2);
break;
case '2A': // int24
$valOut = $this->signed2Hex($valIn, 3);
break;
case '2B': // int32
$valOut = $this->signed2Hex($valIn, 4);
break;
case '39': // Single precision
$valOut = strrev(unpack('h*', pack('f', $valIn))[1]);
break;
case '42': // string
$len = sprintf("%02X", strlen($valIn));
$valOut = $len.bin2hex($valIn);
Expand Down Expand Up @@ -3298,7 +3310,7 @@ function processCmd($Command) {

$this->addCmdToQueue2($priority, $dest, "0110", $data, $addr, $addrMode);
return;
}
} // cmdName == 'writeAttribute'

// ZCL global: Generic 'write attribute request' function based on 0530 zigate msg
// Tcharp38 note: not clear yet why it can be required but 0110 is still a nightmare. Doc is weak and too
Expand Down
1 change: 1 addition & 0 deletions docs/fr_FR/Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ ChangeLog
=========

- Ikea capteur qualité de l'air VINDSTYRKA: Mise-à-jour du modèle (2681).
- Interne: Cmd: Amélioration formatAttribute() pour type x39/single precision + int8/int24/int32.

240116-BETA-1
-------------
Expand Down

0 comments on commit 16cf9c1

Please sign in to comment.