@@ -1307,34 +1307,26 @@ protected function ShowMissingTranslations(): bool
13071307 *
13081308 * @see \Zigbee2MQTT\ModulBase::processPayload()
13091309 */
1310- protected function flattenPayload (array $ payload , string $ prefix = '' ): array
1310+ protected function flattenPayload (array $ payload , string $ prefix = '' , int $ depth = 0 ): array
13111311 {
13121312 $ result = [];
13131313
13141314 foreach ($ payload as $ key => $ value ) {
13151315 $ newKey = $ prefix ? $ prefix . '__ ' . $ key : $ key ;
13161316
1317- // Composite-Keys überspringen, die in SKIP_COMPOSITES definiert sind
1318- if (in_array ($ key , self ::SKIP_COMPOSITES ) && is_array ($ value )) {
1319- $ this ->SendDebug (__FUNCTION__ , "Überspringe Composite-Key: $ key " , 0 );
1317+ // Composite-Keys überspringen, die in SKIP_COMPOSITES definiert sind und auf oberster Ebene gesetzt sind
1318+ if ($ depth === 0 && in_array ($ key , self ::SKIP_COMPOSITES ) && is_array ($ value )) {
1319+ $ this ->SendDebug (__FUNCTION__ , "Überspringe Composite-Key auf oberster Ebene : $ key " , 0 );
13201320 continue ;
13211321 }
13221322
1323- // Spezialbehandlung für color-Properties
1323+ // Spezialbehandlung für color-Properties, da zur Farbberechnung nicht als flatten benötigt
13241324 if ($ key === 'color ' && is_array ($ value )) {
13251325 // Übernehme die color-Properties direkt ins color-Array
13261326 $ result ['color ' ] = $ value ;
13271327 continue ;
13281328 }
13291329
1330- // Update-Properties zusammenfassen
1331- if ($ key === 'update ' && is_array ($ value )) {
1332- foreach ($ value as $ updateKey => $ updateValue ) {
1333- $ result ['update__ ' . $ updateKey ] = $ updateValue ;
1334- }
1335- continue ;
1336- }
1337-
13381330 if (is_array ($ value )) {
13391331 $ result = array_merge ($ result , $ this ->flattenPayload ($ value , $ newKey ));
13401332 } else {
0 commit comments