hassio-plejd/README.md

191 lines
7.4 KiB
Markdown
Raw Normal View History

2019-12-04 11:09:09 +01:00
# Hass.io Plejd add-on
2019-12-13 18:07:35 +01:00
Hass.io add-on for Plejd home automation devices. Gives you the ability to control the Plejd home automation devices through Home Assistant.
2019-12-04 11:09:09 +01:00
It uses MQTT to communicate with Home Assistant and supports auto discovery of the devices in range.
2019-12-04 11:21:51 +01:00
It also supports notifications so that changed made in the Plejd app are propagated to Home Assistant.
2019-12-04 11:09:09 +01:00
Thanks to [ha-plejd](https://github.com/klali/ha-plejd) for inspiration.
2019-12-11 19:58:48 +01:00
Disclaimer:
I am in no way affiliated with Plejd and am solely doing this as a hobby project.
2019-12-23 13:09:38 +01:00
**Did you like this? Consider helping me continue the development:**
[Buy me a coffee](https://www.buymeacoffee.com/w1ANTUb)
2020-01-24 18:09:02 +01:00
[![Gitter](https://badges.gitter.im/hassio-plejd/community.svg)](https://gitter.im/hassio-plejd/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
2019-12-04 11:09:09 +01:00
## Getting started
To get started, make sure that the following requirements are met:
### Requirements
* A Bluetooth device (BLE), for eg. the built-in device in Raspberry Pi 4.
* An MQTT broker (the Mosquitto Hass.io add-on works perfectly well).
### Tested on
The add-on has been tested on the following platforms:
* Mac OS Catalina 10.15.1 with Node v. 13.2.0
* Raspberry Pi 4 with Hass.io
2019-12-04 11:31:17 +01:00
#### Tested Plejd devices
* DIM-01
2019-12-11 09:05:39 +01:00
* DIM-02
2019-12-04 11:31:17 +01:00
* LED-10
* CTR-01
2019-12-13 14:15:49 +01:00
* REL-01
* REL-02
2020-02-29 16:57:09 +01:00
* WPH-01
2019-12-04 11:31:17 +01:00
2019-12-13 18:07:35 +01:00
### Easy Installation
Browse to your Home Assistant installation in a web browser and click on `Hass.io` in the navigation bar to the left.
* Open the Home Assistant web console and click `Hass.io` in the menu on the left side.
* Click on `Add-on Store` in the top navigation bar of that page.
2019-12-19 21:32:45 +01:00
* Paste the URL to this repo https://github.com/icanos/hassio-plejd.git in the `Add new repository by URL` field and hit `Add`.
2019-12-13 18:07:35 +01:00
* Scroll down and you should find a Plejd add-on that can be installed. Open that and install.
* Enjoy!
### Manual Installation
2019-12-04 11:09:09 +01:00
Browse your Hass.io installation using a tool that allows you to manage files, for eg. SMB or an SFTP client etc.
* Open the `/addon` directory
* Create a new folder named `hassio-plejd`
* Copy all files from this repository into that newly created one.
* Open the Home Assistant web console and click `Hass.io` in the menu on the left side.
* Click on `Add-on Store` in the top navigation bar of that page.
* Click on the refresh button in the upper right corner.
* A new Local Add-on should appear named Plejd. Open that and install.
2019-12-13 18:07:35 +01:00
* Enjoy!
2019-12-04 11:09:09 +01:00
2020-01-30 13:19:15 +01:00
### IMPORTANT INFORMATION
#### Startup error message
2019-12-23 12:20:08 +01:00
When starting the add-on, the log displays this message:
```
parse error: Expected string key before ':' at line 1, column 4
[08:56:24] ERROR: Unknown HTTP error occured
```
However, the add-on still works as expected and this is something I'm looking into, but not with that much effort yet though.
2020-01-30 13:19:15 +01:00
#### Running the Plejd add-on outside of HassOS
If you're planning on running this add-on outside of HassOS, you might need to turn off AppArmor in the `config.json` file. This is due to missing AppArmor configuration that is performed in HassOS (if you've manually done it, ignore this).
Open the `config.json` file and locate `host_dbus`, after that line, insert: `"apparmor": "no",` and then restart the add-on.
More information about available parameters can be found here:
https://developers.home-assistant.io/docs/en/hassio_addon_config.html
2019-12-13 18:16:06 +01:00
### Configuration
You need to add the following to your `configuration.yaml` file:
2019-12-11 15:50:55 +01:00
```
mqtt:
2019-12-14 15:59:11 +01:00
broker: [point to your broker IP eg. 'mqtt://localhost']
2019-12-11 15:50:55 +01:00
username: [username of mqtt broker]
password: !secret mqtt_password
discovery: true
discovery_prefix: homeassistant
birth_message:
topic: 'hass/status'
payload: 'online'
will_message:
topic: 'hass/status'
payload: 'offline'
```
The above is used to notify the add-on when Home Assistant has started successfully and let the add-on send the discovery response (containing all devices).
2019-12-13 18:16:06 +01:00
The plugin needs you to configure some settings before working. You find these on the Add-on page after you've installed it.
2019-12-04 11:09:09 +01:00
Parameter | Value
--- | ---
site | Name of your Plejd site, the name is displayed in the Plejd app (top bar).
username | Username of your Plejd account, this is used to fetch the crypto key and devices from the Plejd API.
password | Password of your Plejd account, this is used to fetch the crypto key and devices from the Plejd API.
mqttBroker | URL of the MQTT Broker, eg. mqtt://localhost
mqttUsername | Username of the MQTT broker
mqttPassword | Password of the MQTT broker
2019-12-13 18:16:54 +01:00
includeRoomsAsLights | Adds all rooms as lights, making it possible to turn on/off lights by room instead. Setting this to false will ignore all rooms. *Added in v. 5*.
2020-01-28 09:26:54 +01:00
connectionTimeout | Number of seconds to wait when scanning and connecting. Might need to be tweaked on platforms other than RPi 4. Defaults to: 2 seconds.
2020-03-03 16:24:13 +01:00
writeQueueWaitTime | Wait time between message sent to Plejd over BLE, defaults to 400. If that doesn't work, try changing the value higher in steps of 50.
2019-12-04 11:09:09 +01:00
2019-12-13 18:28:28 +01:00
## I want voice control!
With the Google Home integration in Home Assistant, you can get voice control for your Plejd lights right away, check this out for more information:
https://www.home-assistant.io/integrations/google_assistant/
### I don't want voice, I want HomeKit!
Check this out for more information on how you can get your Plejd lights controlled using HomeKit:
https://www.home-assistant.io/integrations/homekit/
2019-12-13 14:15:49 +01:00
## Changelog
2020-03-19 11:17:12 +01:00
*v 0.4.4*:
2020-03-19 11:13:00 +01:00
* FIX: Disabled AppArmor Policy since there's been a lot of issues with that.
2020-03-13 12:05:02 +01:00
*v 0.4.3*:
* FIX: Updated add-on to work with the API changes made by Plejd.
2020-02-29 16:57:09 +01:00
*v 0.4.0*:
* NEW: Implemented support for Plejd scenes, each scene appears as a switch in Home Assistant.
* NEW: *WPH-01* is supported and generates two switches (left and right button).
* NEW: Write queues, finally able to incorporate Plejd devices in HA automations/scenes etc.
2020-01-28 09:26:54 +01:00
*v 0.3.4*:
* NEW: `connectionTimeout` configuration parameter to enable tweaking of wait time on connection, usable for RPi 3B+.
* FIX: Reworked some logging to get better understanding of what happens.
2020-01-24 10:25:35 +01:00
*v 0.3.0*:
* NEW: New BLE manager, DBus instead of noble
* FIX: Adding entities as devices now as well
* FIX: Bug fixes
2020-01-16 20:12:15 +01:00
*v 0.2.8*:
* FIX: Reset characteristic state on disconnect
2020-01-16 08:53:28 +01:00
*v 0.2.7*:
* FIX: Added exception handling to unsubscribing lastData characteristic if already disconnected
*v 0.2.6*:
* FIX: Added null check to remove listeners for characteristics
2020-01-14 20:04:47 +01:00
*v 0.2.5*:
* FIX: Invalid scene id in events/scene message
*v 0.2.4*:
* Stability improvements
*v 0.2.3*:
* FIX: Container build error fix
*v 0.2.2*:
* Stability improvements
*v 0.2.1*:
* Stability improvements
*v 0.2.0*:
* Stability improvements
* Bugfixes
2019-12-20 07:53:03 +01:00
*v 0.1.1*:
* FIX: Fixed missing reference on startup, preventing add-on from starting
2019-12-20 07:53:37 +01:00
2019-12-19 21:30:53 +01:00
*v 0.1.0*:
* NEW: Rewrote the BLE integration for more stability
* FIX: discovery wasn't always sent
2019-12-13 14:15:49 +01:00
2019-12-19 21:30:53 +01:00
*previous*:
* FIX: bug preventing add-on from building
2019-12-13 14:15:49 +01:00
* NEW: Added support for Plejd devices with multiple outputs (such as DIM-02)
2019-12-04 11:09:09 +01:00
## License
```
Copyright 2019 Marcus Westin <marcus@sekurbit.se>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```