Skip to content
This repository has been archived by the owner on Aug 24, 2024. It is now read-only.

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveicedgreentea committed Mar 19, 2022
1 parent 1b3031a commit fbcf313
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 78 deletions.
4 changes: 2 additions & 2 deletions custom_components/jvc_projectors/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"config_flow": false,
"documentation": "https://www.home-assistant.io/integrations/jvc_projector",
"requirements": [
"jvc-projector-remote-improved==1.2.81"
"jvc-projector-remote-improved==2.0.0"
],
"ssdp": [],
"zeroconf": [],
Expand All @@ -14,5 +14,5 @@
"@iloveicedgreentea"
],
"iot_class": "local_polling",
"version": "1.2.81"
"version": "2.0.0"
}
9 changes: 1 addition & 8 deletions custom_components/jvc_projectors/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,19 @@ def __init__(
self,
name: str,
host: str,
password: str,
timeout: str = None,
jvc_client: JVCProjector = None,
) -> None:
"""JVC Init."""
self._name = name
self._host = host
# Timeout for connections. Everything takes less than 3 seconds to run
if timeout is None:
self.timeout = 5
else:
self.timeout = int(timeout)
# use 5 second timeout, try to prevent error loops
self._state = False
self._ll_state = False
# Because we can only have one connection at a time, we need to lock every command
# otherwise JVC's server implementation will cancel the running command
# and just confuse everything, then cause HA to freak out
self._lock = asyncio.Lock()
self.jvc_client = jvc_client

@property
def should_poll(self):
Expand All @@ -129,7 +123,6 @@ def extra_state_attributes(self):
"power_state": self._state,
"low_latency": self._ll_state,
"host_ip": self._host,
"timeout": self.timeout,
}

@property
Expand Down
159 changes: 96 additions & 63 deletions info.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,75 @@
This is the Home Assistant JVC Component implementing my [JVC library](https://github.com/iloveicedgreentea/jvc_projector_improved)

## Features

All the features in my [JVC library](https://github.com/iloveicedgreentea/jvc_projector_improved) including:
* Power
* Picture Modes
* Laser power and dimming
* Low Latency meta-functions
* Optimal gaming and movie setting meta-functions
* and so on

## Home Assistant Setup
- Power
- Picture Modes
- Laser power and dimming
- Low Latency meta-functions
- Optimal gaming and movie setting meta-functions
- and so on

Because everything is async, it will run each button/command in the order it received. so commands won't disappear from the queue due to JVCs PJ server requiring the handshake. It uses a single persistent connection so any delay you see is because of HA processing.

## Installation

This is currently only a custom component. Unlikely to make it into HA core because their process is just too burdensome.

Install HACS, then install the component by adding this as a custom repo
https://hacs.xyz/docs/faq/custom_repositories

You can also just copy all the files into your custom_components folder but then you won't have automatic updates.

### Home Assistant Setup

```yaml
# configuration.yaml
remote:
- platform: jvc_projectors
name: {friendly name}
password: {password}
host: {IP addr}
scan_interval: 30 # recommend 30-60. Power state will poll in this interval
name: { friendly name }
password: { password }
host: { IP addr }
timeout: { seconds } (optional)
scan_interval: 15 # recommend 15-30. Attributes will poll in this interval
```
## Useful Stuff
I used this to re-create the JVC remote in HA. Add the YAML to your dashboard to get a grid which resembles most of the remote. Other functions can be used via remote.send_command. See the library readme for details.
*Note: the remote.send_command service currently expects a list and the HA UI does not seem to allow you to specify a YAML list in the command param to the entity. If you use UI mode, you will break your config and get an index out of range error*
*Make sure to change your entity ID*
Add this sensor to your configuration.yml. Replace the nz7 with the name of your entity. Restart HA.
```yaml
sensor:
platform: template
sensors:
jvc_low_latency:
value_template: >
{% if is_state('remote.nz7', 'on') %}
{% if states.remote.nz7.attributes.low_latency == false %}
Off
{% elif states.remote.nz7.attributes.low_latency == true %}
On
{% endif %}
{% else %}
Off
{% endif %}
```
Add this to lovelace
```yaml
type: grid
cards:
- type: button
name: Power
show_icon: false
entity: remote.nz7
show_state: true
show_name: true
icon: mdi:power
- type: button
tap_action:
action: call-service
Expand All @@ -43,38 +83,25 @@ cards:
name: Info
hold_action:
action: none
- type: button
tap_action:
action: toggle
show_icon: false
- type: button
tap_action:
action: call-service
service: remote.send_command
service_data:
command:
- menu
- up
command: menu,up
target:
entity_id: remote.nz7
show_name: false
show_icon: true
icon: mdi:arrow-up
hold_action:
action: none
- type: button
tap_action:
action: toggle
show_icon: false
show_name: false
- type: button
tap_action:
action: call-service
service: remote.send_command
service_data:
command:
- menu
- menu
command: menu,menu
target:
entity_id: remote.nz7
show_name: true
Expand All @@ -86,14 +113,22 @@ cards:
tap_action:
action: toggle
show_icon: false
- type: button
tap_action:
action: none
show_icon: false
entity: sensor.jvc_low_latency
show_name: true
show_state: true
name: Low Latency
hold_action:
action: none
- type: button
tap_action:
action: call-service
service: remote.send_command
service_data:
command:
- menu
- left
command: menu,left
target:
entity_id: remote.nz7
show_name: false
Expand All @@ -103,9 +138,7 @@ cards:
action: call-service
service: remote.send_command
service_data:
command:
- menu
- ok
command: menu, ok
target:
entity_id: remote.nz7
name: OK
Expand All @@ -115,13 +148,16 @@ cards:
action: call-service
service: remote.send_command
service_data:
command:
- menu
- right
command: menu, right
target:
entity_id: remote.nz7
show_name: false
icon: mdi:arrow-right
- type: button
tap_action:
action: toggle
show_icon: false
show_name: false
- type: button
tap_action:
action: toggle
Expand All @@ -131,25 +167,17 @@ cards:
action: call-service
service: remote.send_command
service_data:
command:
- menu
- back
command: menu,back
target:
entity_id: remote.nz7
name: Back
show_icon: false
- type: button
tap_action:
action: toggle
show_icon: false
- type: button
tap_action:
action: call-service
service: remote.send_command
service_data:
command:
- menu
- down
command: menu,down
target:
entity_id: remote.nz7
show_name: false
Expand All @@ -161,41 +189,46 @@ cards:
- type: button
tap_action:
action: toggle
name: Setup
show_icon: false
show_name: false
- type: button
tap_action:
action: toggle
action: call-service
service: jvc_projectors.gaming_mode_hdr
service_data: {}
target:
entity_id: remote.nz7
show_icon: false
show_name: true
hold_action:
action: none
name: Game HDR
- type: button
tap_action:
action: call-service
service: remote.send_command
service_data:
command:
- power
- 'off'
service: jvc_projectors.gaming_mode_sdr
service_data: {}
target:
entity_id: remote.nz7
show_icon: false
name: 'Off'
name: Game SDR
- type: button
tap_action:
action: toggle
action: call-service
service: jvc_projectors.hdr_picture_mode
service_data: {}
target:
entity_id: remote.nz7
show_icon: false
name: Film HDR
- type: button
tap_action:
action: call-service
service: remote.send_command
service_data:
command:
- power
- 'on'
service: jvc_projectors.sdr_picture_mode
service_data: {}
target:
entity_id: remote.nz7
name: 'On'
show_icon: false
name: Film SDR
- type: button
tap_action:
action: toggle
Expand Down
11 changes: 6 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ All the features in my [JVC library](https://github.com/iloveicedgreentea/jvc_pr
- Optimal gaming and movie setting meta-functions
- and so on

<!-- Because everything is async, it will run each button/command in the order it received. so commands won't disappear from the queue due to JVCs PJ server requiring the handshake. Currently WIP to use one long running connection to have lightning fast commands. -->
Because everything is async, it will run each button/command in the order it received. so commands won't disappear from the queue due to JVCs PJ server requiring the handshake. It uses a single persistent connection so any delay you see is because of HA processing.

## Installation

This is currently only a custom component. Working on getting this into HA Core
This is currently only a custom component. Unlikely to make it into HA core because their process is just too burdensome.

Install HACS, then install the component by adding this as a custom repo https://hacs.xyz/docs/faq/custom_repositories
Install HACS, then install the component by adding this as a custom repo
https://hacs.xyz/docs/faq/custom_repositories

You can also just copy all the files into your custom_components folder but then you won't have automatic updates.

Expand All @@ -32,8 +33,8 @@ remote:
name: { friendly name }
password: { password }
host: { IP addr }
timeout: { seconds }
scan_interval: 30 # recommend 30-60. Power state will poll in this interval
timeout: { seconds } (optional)
scan_interval: 15 # recommend 15-30. Attributes will poll in this interval
```
## Useful Stuff
Expand Down

0 comments on commit fbcf313

Please sign in to comment.