diff --git a/composer.json b/composer.json index 6f00826..c6f59c8 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "ext-simplexml": "*", "ext-zip": "*", "bnussbau/laravel-trmnl-blade": "2.3.*", - "bnussbau/trmnl-pipeline-php": "0.7.*", + "bnussbau/trmnl-pipeline-php": "^0.6.0", "keepsuit/laravel-liquid": "^0.5.2", "laravel/fortify": "^1.30", "laravel/framework": "^12.1", diff --git a/composer.lock b/composer.lock index b22316d..1789c64 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "909d7acdf3f0ace9fb6d20b4de1eeaca", + "content-hash": "a4438c591a5d746f546eab261e9e1efc", "packages": [ { "name": "aws/aws-crt-php", @@ -298,16 +298,16 @@ }, { "name": "bnussbau/trmnl-pipeline-php", - "version": "0.7.0", + "version": "0.6.0", "source": { "type": "git", "url": "https://github.com/bnussbau/trmnl-pipeline-php.git", - "reference": "da80de2b6456776eeabc1fb95fd42e5f3357d865" + "reference": "228505afa8a39a5033916e9ae5ccbf1733092c1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bnussbau/trmnl-pipeline-php/zipball/da80de2b6456776eeabc1fb95fd42e5f3357d865", - "reference": "da80de2b6456776eeabc1fb95fd42e5f3357d865", + "url": "https://api.github.com/repos/bnussbau/trmnl-pipeline-php/zipball/228505afa8a39a5033916e9ae5ccbf1733092c1f", + "reference": "228505afa8a39a5033916e9ae5ccbf1733092c1f", "shasum": "" }, "require": { @@ -349,7 +349,7 @@ ], "support": { "issues": "https://github.com/bnussbau/trmnl-pipeline-php/issues", - "source": "https://github.com/bnussbau/trmnl-pipeline-php/tree/0.7.0" + "source": "https://github.com/bnussbau/trmnl-pipeline-php/tree/0.6.0" }, "funding": [ { @@ -357,7 +357,7 @@ "type": "buy_me_a_coffee" }, { - "url": "https://trmnl.com/?ref=laravel-trmnl", + "url": "https://usetrmnl.com/?ref=laravel-trmnl", "type": "custom" }, { @@ -365,7 +365,7 @@ "type": "github" } ], - "time": "2026-02-07T22:22:18+00:00" + "time": "2025-12-02T15:18:51+00:00" }, { "name": "brick/math", @@ -9066,16 +9066,16 @@ }, { "name": "laravel/boost", - "version": "v2.1.3", + "version": "v2.1.2", "source": { "type": "git", "url": "https://github.com/laravel/boost.git", - "reference": "b96e0ab547d51d3810498dcc4d5535486991df6f" + "reference": "81ecf79e82c979efd92afaeac012605cc7b2f31f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/boost/zipball/b96e0ab547d51d3810498dcc4d5535486991df6f", - "reference": "b96e0ab547d51d3810498dcc4d5535486991df6f", + "url": "https://api.github.com/repos/laravel/boost/zipball/81ecf79e82c979efd92afaeac012605cc7b2f31f", + "reference": "81ecf79e82c979efd92afaeac012605cc7b2f31f", "shasum": "" }, "require": { @@ -9086,7 +9086,7 @@ "illuminate/support": "^11.45.3|^12.41.1", "laravel/mcp": "^0.5.1", "laravel/prompts": "^0.3.10", - "laravel/roster": "^0.4.0", + "laravel/roster": "^0.2.9", "php": "^8.2" }, "require-dev": { @@ -9128,7 +9128,7 @@ "issues": "https://github.com/laravel/boost/issues", "source": "https://github.com/laravel/boost" }, - "time": "2026-02-11T19:22:04+00:00" + "time": "2026-02-10T17:40:45+00:00" }, { "name": "laravel/mcp", @@ -9352,31 +9352,31 @@ }, { "name": "laravel/roster", - "version": "v0.4.0", + "version": "v0.2.9", "source": { "type": "git", "url": "https://github.com/laravel/roster.git", - "reference": "77e6c1187952d0eef50a54922db47893f5e7c986" + "reference": "82bbd0e2de614906811aebdf16b4305956816fa6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/roster/zipball/77e6c1187952d0eef50a54922db47893f5e7c986", - "reference": "77e6c1187952d0eef50a54922db47893f5e7c986", + "url": "https://api.github.com/repos/laravel/roster/zipball/82bbd0e2de614906811aebdf16b4305956816fa6", + "reference": "82bbd0e2de614906811aebdf16b4305956816fa6", "shasum": "" }, "require": { - "illuminate/console": "^11.0|^12.0|^13.0", - "illuminate/contracts": "^11.0|^12.0|^13.0", - "illuminate/routing": "^11.0|^12.0|^13.0", - "illuminate/support": "^11.0|^12.0|^13.0", - "php": "^8.2", - "symfony/yaml": "^7.2|^8.0" + "illuminate/console": "^10.0|^11.0|^12.0", + "illuminate/contracts": "^10.0|^11.0|^12.0", + "illuminate/routing": "^10.0|^11.0|^12.0", + "illuminate/support": "^10.0|^11.0|^12.0", + "php": "^8.1|^8.2", + "symfony/yaml": "^6.4|^7.2" }, "require-dev": { "laravel/pint": "^1.14", "mockery/mockery": "^1.6", - "orchestra/testbench": "^9.0|^10.0|^11.0", - "pestphp/pest": "^3.0|^4.1", + "orchestra/testbench": "^8.22.0|^9.0|^10.0", + "pestphp/pest": "^2.0|^3.0", "phpstan/phpstan": "^2.0" }, "type": "library", @@ -9409,7 +9409,7 @@ "issues": "https://github.com/laravel/roster/issues", "source": "https://github.com/laravel/roster" }, - "time": "2026-02-11T07:24:41+00:00" + "time": "2025-10-20T09:56:46+00:00" }, { "name": "laravel/sail", diff --git a/resources/views/recipes/zen.blade.php b/resources/views/recipes/zen.blade.php index cc62c63..0ae920f 100644 --- a/resources/views/recipes/zen.blade.php +++ b/resources/views/recipes/zen.blade.php @@ -1,13 +1,15 @@ {{--@dump($data)--}} @props(['size' => 'full']) - -
{{$data['data'][0]['a'] ?? ''}}
- @if (strlen($data['data'][0]['q'] ?? '') < 300 && $size != 'quadrant') -

{{ $data['data'][0]['q'] ?? '' }}

- @else -

{{ $data['data'][0]['q'] ?? '' }}

- @endif + + +
{{$data['data'][0]['a'] ?? ''}}
+ @if (strlen($data['data'][0]['q'] ?? '') < 300 && $size != 'quadrant') +

{{ $data['data'][0]['q'] ?? '' }}

+ @else +

{{ $data['data'][0]['q'] ?? '' }}

+ @endif +
diff --git a/routes/api.php b/routes/api.php index c759d61..73b2749 100644 --- a/routes/api.php +++ b/routes/api.php @@ -49,9 +49,8 @@ Route::get('/display', function (Request $request) { 'last_refreshed_at' => now(), ]); - $batteryPercent = $request->header('battery-percent') ?? $request->header('percent-charged'); - if ($batteryPercent !== null) { - $batteryPercent = (int) $batteryPercent; + if ($request->hasHeader('battery-percent')) { + $batteryPercent = (int) $request->header('battery-percent'); $batteryVoltage = $device->calculateVoltageFromPercent($batteryPercent); $device->update([ 'last_battery_voltage' => $batteryVoltage, diff --git a/tests/Feature/Api/DeviceEndpointsTest.php b/tests/Feature/Api/DeviceEndpointsTest.php index f64d203..44fb651 100644 --- a/tests/Feature/Api/DeviceEndpointsTest.php +++ b/tests/Feature/Api/DeviceEndpointsTest.php @@ -725,40 +725,6 @@ test('display endpoint updates last_refreshed_at timestamp', function (): void { ->and($device->last_refreshed_at->diffInSeconds(now()))->toBeLessThan(2); }); -test('display endpoint accepts battery-percent header and updates device', function (): void { - $device = Device::factory()->create([ - 'mac_address' => '00:11:22:33:44:56', - 'api_key' => 'test-api-key-battery', - 'last_battery_voltage' => null, - ]); - - $this->withHeaders([ - 'id' => $device->mac_address, - 'access-token' => $device->api_key, - 'battery-percent' => '67', - ])->get('/api/display')->assertOk(); - - $device->refresh(); - expect($device->battery_percent)->toEqual(67); -}); - -test('display endpoint accepts Percent-Charged header and updates device', function (): void { - $device = Device::factory()->create([ - 'mac_address' => '00:11:22:33:44:57', - 'api_key' => 'test-api-key-percent-charged', - 'last_battery_voltage' => null, - ]); - - $this->withHeaders([ - 'id' => $device->mac_address, - 'access-token' => $device->api_key, - 'Percent-Charged' => '51', - ])->get('/api/display')->assertOk(); - - $device->refresh(); - expect($device->battery_percent)->toEqual(51); -}); - test('display endpoint updates last_refreshed_at timestamp for mirrored devices', function (): void { // Create source device $sourceDevice = Device::factory()->create([