Updated based on review feedback from @SweVictor. Thanks!

This commit is contained in:
faanskit 2021-05-11 21:03:48 +02:00
parent d239aacbc1
commit 729559750e
3 changed files with 35 additions and 31 deletions

View file

@ -437,6 +437,7 @@ class PlejdApi {
}
const room = this.siteDetails.rooms.find((x) => x.roomId === device.roomId);
const roomTitle = room ? room.title : undefined;
/** @type {import('types/DeviceRegistry').OutputDevice} */
const outputDevice = {
@ -448,7 +449,7 @@ class PlejdApi {
name: device.title,
output: deviceOutput,
roomId: device.roomId,
roomName: room.title,
roomName: roomTitle,
state: undefined,
type: loadType,
typeName,

View file

@ -4,29 +4,29 @@ Hass.io add-on for Plejd home automation devices. Gives you the ability to contr
It uses MQTT to communicate with Home Assistant and supports auto discovery of the devices in range. Changed made in the Plejd app are propagated to Home Assistant.
Plejd output devices typically appears as either lights or switches in Home Assistant depending on how they are configured.
<table>
<tr><th align=left>Device</th><th align=left>Plejd Configuration</th><th align=left>Home Assistant Role</th><th align=left>Comment</th></tr>
<tr><td>CTR-01</td><td>Relay, Light</td><td>Light</td><td></td></tr>
<tr><td>CTR-01</td><td>Relay, Other</td><td>Switch</td><td></td></tr>
<tr><td>REL-01</td><td>Relay, Light</td><td>Light</td><td></td></tr>
<tr><td>REL-01</td><td>Relay, Other</td><td>Switch</td><td></td></tr>
<tr><td>REL-02</td><td>Relay, Light</td><td>Light</td><td></td></tr>
<tr><td>REL-02</td><td>Relay, Other</td><td>Switch</td><td></td></tr>
<tr><td>SPR-01</td><td>Relay, Light</td><td>Light</td><td>Not tested, not released by Plejd</td></tr>
<tr><td>SPR-01</td><td>Relay, Other</td><td>Switch</td><td>Not tested, not released by Plejd</td></tr>
<tr><td>DIM-01</td><td>-</td><td>Light</td><td></td></tr>
<tr><td>DIM-02</td><td>-</td><td>Light</td><td></td></tr>
<tr><td>LED-10</td><td>-</td><td>Light</td><td></td></tr>
<tr><td>DAL-01</td><td>-</td><td>-</td><td>Not supported, not released by Plejd</td></tr>
<tr><td>WPH-01</td><td>-</td><td>Device Automation</td><td>type:button_short_press, subtype:button_1, button_2,button_3,button_4</td></tr>
<tr><td>WRT-01</td><td>-</td><td>Device Automation</td><td>type:button_short_press, subtype:button_1</td></tr>
<tr><td>GWY-01</td><td>-</td><td>-</td><td></td></tr>
<tr><td>RTR-01</td><td>-</td><td>-</td><td></td></tr>
<tr><td>Scene</td><td>-</td><td>Scene</td><td></td></tr>
<tr><td>Scene</td><td>-</td><td>Device Automation</td><td>type:scene, subtype:trigger</td></tr>
<tr><td>Room</td><td>-</td><td>Area</td><td>Can be changed by Home Assistant</td></tr>
<tr><td>Room</td><td>-</td><td>Light</td><td>If includeRoomsAsLights is set to true</td></tr>
<table>
| Device | Plejd Configuration | Home Assistant Role | Comment |
| ------ | ------------------- | ------------------- | --------------------------------------------------------------------- |
| CTR-01 | Relay, Light | Light | |
| CTR-01 | Relay, Other | Switch | |
| REL-01 | Relay, Light | Light | |
| REL-01 | Relay, Other | Switch | |
| REL-02 | Relay, Light | Light | |
| REL-02 | Relay, Other | Switch | |
| SPR-01 | Relay, Light | Light | Not tested, not supported |
| SPR-01 | Relay, Other | Switch | Not tested, not supported |
| DIM-01 | - | Light | |
| DIM-02 | - | Light | |
| LED-10 | - | Light | |
| DAL-01 | - | - | Not supported, not released by Plejd |
| WPH-01 | - | Device Automation | type:button_short_press, subtype:button_1, button_2,button_3,button_4 |
| WRT-01 | - | Device Automation | type:button_short_press, subtype:button_1 |
| GWY-01 | - | - | |
| RTR-01 | - | - | |
| Scene | - | Scene | |
| Scene | - | Device Automation | type:scene, subtype:trigger |
| Room | - | Area | Can be changed by Home Assistant |
| Room | - | Light | If includeRoomsAsLights is set to true |
Thanks to [ha-plejd](https://github.com/klali/ha-plejd) for inspiration.
@ -133,14 +133,17 @@ If you restore a backup from a 32bit system to a new 64bit system, use the Rebui
### Configuration
#### Simple MQTT Configurations
When you are using the official Mosquitto Broker from Home Assistant Add-on store, minimal configuration is required.
<table>
<tr><td>mqttBroker</td><td>mqtt://localhost</td></tr>
<tr><td>mqttUsername</td><td>homeassistant</td></tr>
<tr><td>mqttPassword</td><td>Mosquitto password, fetched via Configuration->Integrations->Mosquitto broker->Configure->RE-CONFIGURE->Password</td></tr>
</table>
| Parameter | Value |
| ------------ | ---------------------------------------------------------------------------------------------------------------- |
| mqttBroker | mqtt://localhost |
| mqttUsername | homeassistant |
| mqttPassword | Mosquitto password, fetched via Configuration->Integrations->Mosquitto broker->Configure->RE-CONFIGURE->Password |
#### Advanced MQTT Configurations
For more advanced instllations, you need to add the MQTT integration to Home Assistant either by going to Configuration -> Integrations and clicking the Add Integration button, or by adding the following to your `configuration.yaml` file:
```

View file

@ -12,8 +12,8 @@ export interface OutputDevice {
hiddenFromSceneList?: boolean;
name: string;
output: number;
roomId: string;
roomName: string;
roomId: string | undefined;
roomName: string | undefined;
state: boolean | undefined;
type: string;
typeName: string;