Compare commits
4 Commits
async-reqw
...
master
Author | SHA1 | Date | |
---|---|---|---|
77d8f0375c | |||
6202522acd | |||
|
66a7ec5127 | ||
|
8a898b5cf8 |
9
.github/workflows/rust.yml
vendored
9
.github/workflows/rust.yml
vendored
@ -15,6 +15,15 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name : Install ARM compiler
|
||||||
|
run: sudo apt-get install gcc-arm-linux-gnueabihf -y
|
||||||
|
- name: Set ARM compiler as environment variable
|
||||||
|
run: export CC=arm-linux-gnueabihf-gcc
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
target: armv7-unknown-linux-gnueabihf
|
||||||
|
override: true
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --verbose
|
run: cargo build --verbose
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
authors = ["Wyatt J. Miller <wjmiller2016@gmail.com>"]
|
authors = ["Wyatt J. Miller <wjmiller2016@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
name = "bleak"
|
name = "bleak"
|
||||||
version = "0.3.1"
|
version = "0.3.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
chrono = "0.4.11"
|
chrono = "0.4.11"
|
||||||
@ -15,15 +15,12 @@ serde_json = "1.0.53"
|
|||||||
smart-leds = "0.3.0"
|
smart-leds = "0.3.0"
|
||||||
ws2812-spi = "0.3.0"
|
ws2812-spi = "0.3.0"
|
||||||
|
|
||||||
[dependencies.async-std]
|
|
||||||
version = "1.8.0"
|
|
||||||
|
|
||||||
[dependencies.rppal]
|
[dependencies.rppal]
|
||||||
features = ["hal"]
|
features = ["hal"]
|
||||||
version = "0.11.3"
|
version = "0.11.3"
|
||||||
|
|
||||||
[dependencies.reqwest]
|
[dependencies.reqwest]
|
||||||
version = "0.10.9"
|
version = "0.9.24"
|
||||||
|
|
||||||
[dependencies.openssl]
|
[dependencies.openssl]
|
||||||
features = ["vendored"]
|
features = ["vendored"]
|
||||||
|
21
README.md
21
README.md
@ -1,7 +1,5 @@
|
|||||||
![Bleak logo](docs/img/bleak_logo.png)
|
![Bleak logo](docs/img/bleak_logo.png)
|
||||||
|
|
||||||
[![Build Status](https://cicd.wyattjmiller.com/api/badges/wyatt/bleak/status.svg)](https://cicd.wyattjmiller.com/wyatt/bleak)
|
|
||||||
|
|
||||||
Change the aura of the room with your smart TV!
|
Change the aura of the room with your smart TV!
|
||||||
|
|
||||||
This project is licensed by the [Mozilla Public License v2](https://www.mozilla.org/en-US/MPL/2.0/). A copy of this license is in the project's root directory for your convenience.
|
This project is licensed by the [Mozilla Public License v2](https://www.mozilla.org/en-US/MPL/2.0/). A copy of this license is in the project's root directory for your convenience.
|
||||||
@ -10,21 +8,18 @@ The logo is licensed by the [CC BY-NC-ND 4.0](https://creativecommons.org/licens
|
|||||||
|
|
||||||
## What is this??
|
## What is this??
|
||||||
|
|
||||||
This came from an idea in high school where one could change a channel and some LEDs could change color. This project is just that, only with Smart TV's (Roku TV's and Roku devices supported). One changes the application to Netflix, the LEDs turn red. Another changes the application to Hulu, the LEDs turn green.
|
This came from an idea in high school where one could change a channel and some LEDs could change color based on the channel selected. This project is just that, only with smart TV's (see the [supported devices](#smart-tv-support) for a list of supported devices). One changes the application to Netflix, the LEDs turn red. Another changes the application to Hulu, the LEDs turn green.
|
||||||
|
|
||||||
## How does it work?
|
## How does it work?
|
||||||
|
|
||||||
`bleak` sends out a API request to your Roku TV/Roku device you specify in a JSON file, which is read by `bleak`, and based on that response, the LEDs will change color. These requests happen at one second intervals.
|
`bleak` sends out a network request to your smart TV's IP address that you specify in a JSON file, which is read by `bleak`, and based on that response, the LEDs will change color. These requests happen at one second intervals.
|
||||||
|
|
||||||
TL;DR
|
|
||||||
|
|
||||||
Read the source code.
|
|
||||||
|
|
||||||
## Pre-requisites
|
## Pre-requisites
|
||||||
|
|
||||||
* A Raspberry Pi (tested with a Raspberry Pi 4)
|
* A Raspberry Pi (tested with a Raspberry Pi 4)
|
||||||
* A WS2818 LED light strip (you can order this from [Amazon](https://www.amazon.com/s?k=ws2818+led+strip))
|
* A WS2818 LED light strip (you can order this from [Amazon](https://www.amazon.com/s?k=ws2818+led+strip))
|
||||||
* Rust 1.40+ (this is the version of Rust `bleak` was written in) However, any version of Rust 2018 will most likely be fine
|
* Rust 1.40+ (this is the version of Rust `bleak` was written in) However, any version of Rust 2018 will most likely be fine
|
||||||
|
* [Supported](#smart-tv-support) smart TV
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@ -106,7 +101,7 @@ or you can:
|
|||||||
|
|
||||||
to run this program as one is hacking away.
|
to run this program as one is hacking away.
|
||||||
|
|
||||||
I wrote a systmed service file so starting and stopping would be like I'm starting and stopping any service on a Linux machine. I also didn't like `bleak` taking control of my terminal session :)
|
I wrote a systemd service file so starting and stopping would be like I'm starting and stopping any service on a Linux machine. I also didn't like `bleak` taking control of my terminal session :)
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
@ -119,13 +114,17 @@ If you find any other issues with `bleak`, please send them my way in the form o
|
|||||||
|
|
||||||
## Smart TV support
|
## Smart TV support
|
||||||
|
|
||||||
In development:
|
Supported:
|
||||||
|
|
||||||
* Roku devices and Roku TV's
|
* Roku devices and Roku TV's
|
||||||
|
|
||||||
|
In development:
|
||||||
|
|
||||||
|
* Apple TV 4K/HD
|
||||||
|
|
||||||
Future possibilities:
|
Future possibilities:
|
||||||
|
|
||||||
* Samsung SmartThings TV
|
* Samsung TV (probably utilizing SmartThings API)
|
||||||
* Android TV
|
* Android TV
|
||||||
* Amazon's Fire TV
|
* Amazon's Fire TV
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use async_std::{prelude::*, task};
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@ -39,7 +38,7 @@ impl Configuration {
|
|||||||
port = self.port
|
port = self.port
|
||||||
);
|
);
|
||||||
|
|
||||||
let response = task::block_on(request::get_request(&request));
|
let response = request::get_request(&request);
|
||||||
|
|
||||||
match response {
|
match response {
|
||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
@ -62,7 +61,7 @@ impl Configuration {
|
|||||||
port = self.port
|
port = self.port
|
||||||
);
|
);
|
||||||
|
|
||||||
let response = task::block_on(request::get_request(&request));
|
let response = request::get_request(&request);
|
||||||
match response {
|
match response {
|
||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
let document = Document::from_read(res)
|
let document = Document::from_read(res)
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
use async_std::{prelude::*, io};
|
pub fn get_request(request: &String) -> Result<reqwest::Response, reqwest::Error> {
|
||||||
|
let response = reqwest::get(request);
|
||||||
pub async fn get_request(request: &String) -> io::Result<reqwest::Response, reqwest::Error> {
|
|
||||||
let response = reqwest::get(request).await?;
|
|
||||||
response
|
response
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user