fix(#176): inject device variables into recipes
Some checks failed
tests / ci (push) Has been cancelled

This commit is contained in:
Benjamin Nussbaum 2026-02-03 22:21:35 +01:00
parent 7adbcc104e
commit 2b919a193d
3 changed files with 47 additions and 2 deletions

View file

@ -143,7 +143,7 @@ class PlaylistItem extends Model
'deviceVariant' => $device?->deviceVariant() ?? 'og',
'scaleLevel' => $device?->scaleLevel(),
'slot' => $this->plugin instanceof Plugin
? $this->plugin->render('full', false)
? $this->plugin->render('full', false, $device)
: throw new Exception('Invalid plugin instance'),
])->render();
}
@ -157,7 +157,7 @@ class PlaylistItem extends Model
foreach ($plugins as $index => $plugin) {
$size = $this->getLayoutSize($index);
$pluginMarkups[] = $plugin->render($size, false);
$pluginMarkups[] = $plugin->render($size, false, $device);
}
return view('trmnl-layouts.mashup', [

View file

@ -447,6 +447,13 @@ class Plugin extends Model
'locale' => 'en',
'time_zone_iana' => $timezone,
],
'device' => [
'friendly_id' => $device?->friendly_id,
'percent_charged' => $device?->battery_percent,
'wifi_strength' => $device?->wifi_strength,
'height' => $device?->height,
'width' => $device?->width,
],
'plugin_settings' => [
'instance_name' => $this->name,
'strategy' => $this->data_strategy,