Skip to content

Commit

Permalink
restructure for HACS
Browse files Browse the repository at this point in the history
add license, readme and hacs metadata
  • Loading branch information
sehaas committed Mar 28, 2021
1 parent 0e41bf7 commit 59adf11
Show file tree
Hide file tree
Showing 14 changed files with 131 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Sebastian Haas <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
98 changes: 98 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Hisense TV Integration for Home Assistant

Integration an Hisense TV as media player into Home Assistant. The communication is handled via the integrated MQTT broker and wake-on-LAN.

## Current features:
* Turn on / off
* Display current status
* Source (TV, HDMI, Apps)
* Channel name / number
* EPG data of current show
* Volume control
* Media browser
* LNB selector
* Channel selector
* Apps

TBD:
* Expose ON/OFF as switch
* Expose all keys as buttons
* Enhance EPG/guide handling

## Configuration

The TV provides a MQTT broker on port `36669`. Home Assistant can only communicate with one MQTT broker, so you have to create a bridge between the two broker.

## MQTT

The MQTT broker is secured by credentials. Some TVs (like mine) even require client certificates for incomming connections. I won't include them in this repo, but you can find them online or extract them yourself. See [Acknowledgment](https://github.com/sehaas/ha_hisense_tv#acknowledgment).

Connection shema:
```
+-----------+ +-----------+
| Home | client | Mosquitto |
| Assistant |--------->| |
+-----------+ +-----------+
/\
bridge ||
\/
+-------------+
| Hisense TV |
| MQTT Broker |
+-------------+
```

The `mosquitto` bridge configuration using client certificates.

```
connection hisense
address <TV_IP_ADDRESS>:36669
username <HISENSE_MQTT_USERNAME>
password <HISENSE_MQTT_PASSWORD>
clientid HomeAssistant
bridge_tls_version tlsv1.2
bridge_cafile hisense_ca.pem
bridge_certfile hisense_client.pem
bridge_keyfile hisense_client.key
bridge_insecure true
start_type automatic
try_private true
topic /remoteapp/# both 0 <MQTT_PREFIX> ""
```
Replace `<TV_IP_ADDRESS>`, credentials and `<MQTT_PREFIX>` according to your setup. The `<MQTT_PREFIX>` is needed if you have multiple TVs, otherwise you should just use the default `hisense`:
```
topic /remoteapp/# both 0 hisense ""
```

(Optional) If you have multiple TVs you have to replicate the whole configuration for each TV.
The `<MQTT_PREFIX>` must be unique for every TV. For example:
```
topic /remoteapp/# both 0 livingroom_tv ""
```
```
topic /remoteapp/# both 0 kids_tv ""
```

(Optional) This setup uses the same prefix for incoming and outgoing messages. The integration supports separated values. You have to adapt the topic setup accordingly.

## Wake-on-LAN

The TV can be turned on by a Wake-on-LAN packet. The MAC address must be configured during integration setup.

## Setup in Home Assistant

The integration can be added via the Home Assistant UI. Add the integration and setup your TV. During the first setup your TV should be turned on. The integration requires a PIN code from you TV. The PIN will be triggered automatically during setup. This is a onetime step where the client `HomeAssistant` is requesting access to remote controll the TV.

# YMMV

Tested on an [Hisense A71 Series](https://hisenseme.com/product/75-65-58-55-50-43-a71-series/) with mandatory client certificates. `gettvstate` does not return a `state` but can be used to authenticate the client.
The

# Acknowledgment
Everything I needed to write this integration could be gathered from these sources. Information about the MQTT topics, credentials or certificates can be found there.

* [@Krazy998's mqtt-hisensetv](https://github.com/Krazy998/mqtt-hisensetv)
* [@newAM's hisensetv_hass](https://github.com/newAM/hisensetv_hass)
* [HA Community](https://community.home-assistant.io/t/hisense-tv-control/97638/1)
* [RemoteNOW App](https://play.google.com/store/apps/details?id=com.universal.remote.ms)
* [@d3nd3](https://github.com/d3nd3/Hisense-mqtt-keyfiles)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name":"Hisense TV",
"domains": ["media_player"]
}
7 changes: 7 additions & 0 deletions info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Hisense TV

A Hisense TV media player integration for Home Assistant using the embedded MQTT broker.

* [Current Features](https://github.com/sehaas/ha_hisense_tv#current-features)
* [Configuration](https://github.com/sehaas/ha_hisense_tv#configuration)
* [Setup in Home Assistant](https://github.com/sehaas/ha_hisense_tv#setup-in-home-assistant)
Empty file removed readme.md
Empty file.

0 comments on commit 59adf11

Please sign in to comment.