flexnst/laravel-lgtv

使用 Laravel 控制 LG WebOS 电视

v1.0.5 2019-10-28 13:37 UTC

This package is auto-updated.

Last update: 2024-09-29 05:29:35 UTC


README

该包允许您根据 WebOS 控制LG智能电视的状态,切换频道,控制音量,启动应用程序,并模拟遥控器按键。

安装

composer require flexnst/laravel-lgtv
php artisan vendor:publish --provider="Flexnst\LgTv\LgTvServiceProvider" --tag=config

使用示例

在网络上发现电视IP地址

$ip = \LgTv::device()->discover();

启动电视

\LgTv::device()->turn_on();

关闭电视

\LgTv::device()->turn_off();

在电视屏幕上显示浮动消息

\LgTv::device()->show_float('Hello!');

支持多种设备

// config/lgtv.php
<?php

return [
    'devices' => [
        'tv1' => [
            'ip' => env('LGTV_TV1_IP'),
            'mac' => env('LGTV_TV1_MAC'),
            'key_path' => storage_path('lgtv_tv1.key')
        ]
    ],
    'default' => 'tv1'
];

可用方法

  • discover(bool $as_array = false)
  • is_on()
  • turn_on()
  • turn_off()
  • show_float(string $message)
  • open_browser_at(string $url)
  • get_mute()
  • set_mute(bool $status)
  • toggle_mute()
  • channels($hidden = false)
  • get_channel()
  • set_channel(string $channelId)
  • get_volume()
  • set_volume(int $volumelevel)
  • input_play()
  • input_pause()
  • input_stop()
  • input_forward()
  • input_rewind()
  • input_enter()
  • input_channel_up()
  • input_channel_down()
  • input_volume_up()
  • input_volume_down()
  • input_backspace(int $countCharacters)
  • input_three_d_on()
  • input_three_d_off()
  • get_audio_status()
  • get_sw_info()
  • get_services()
  • get_apps()
  • open_app_with_payload(array $payload)
  • start_app(string $appid)
  • close_app(string $appid)
  • open_youtube_by_url(string $url)
  • open_youtube_by_id(string $id)
  • button(string $button)