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 room = this.siteDetails.rooms.find((x) => x.roomId === device.roomId);
const roomTitle = room ? room.title : undefined;
/** @type {import('types/DeviceRegistry').OutputDevice} */ /** @type {import('types/DeviceRegistry').OutputDevice} */
const outputDevice = { const outputDevice = {
@ -448,7 +449,7 @@ class PlejdApi {
name: device.title, name: device.title,
output: deviceOutput, output: deviceOutput,
roomId: device.roomId, roomId: device.roomId,
roomName: room.title, roomName: roomTitle,
state: undefined, state: undefined,
type: loadType, type: loadType,
typeName, 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. 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. 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> | Device | Plejd Configuration | Home Assistant Role | Comment |
<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> | CTR-01 | Relay, Light | Light | |
<tr><td>REL-01</td><td>Relay, Light</td><td>Light</td><td></td></tr> | CTR-01 | Relay, Other | Switch | |
<tr><td>REL-01</td><td>Relay, Other</td><td>Switch</td><td></td></tr> | REL-01 | Relay, Light | Light | |
<tr><td>REL-02</td><td>Relay, Light</td><td>Light</td><td></td></tr> | REL-01 | Relay, Other | Switch | |
<tr><td>REL-02</td><td>Relay, Other</td><td>Switch</td><td></td></tr> | REL-02 | Relay, Light | Light | |
<tr><td>SPR-01</td><td>Relay, Light</td><td>Light</td><td>Not tested, not released by Plejd</td></tr> | REL-02 | Relay, Other | Switch | |
<tr><td>SPR-01</td><td>Relay, Other</td><td>Switch</td><td>Not tested, not released by Plejd</td></tr> | SPR-01 | Relay, Light | Light | Not tested, not supported |
<tr><td>DIM-01</td><td>-</td><td>Light</td><td></td></tr> | SPR-01 | Relay, Other | Switch | Not tested, not supported |
<tr><td>DIM-02</td><td>-</td><td>Light</td><td></td></tr> | DIM-01 | - | Light | |
<tr><td>LED-10</td><td>-</td><td>Light</td><td></td></tr> | DIM-02 | - | Light | |
<tr><td>DAL-01</td><td>-</td><td>-</td><td>Not supported, not released by Plejd</td></tr> | LED-10 | - | Light | |
<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> | DAL-01 | - | - | Not supported, not released by Plejd |
<tr><td>WRT-01</td><td>-</td><td>Device Automation</td><td>type:button_short_press, subtype:button_1</td></tr> | WPH-01 | - | Device Automation | type:button_short_press, subtype:button_1, button_2,button_3,button_4 |
<tr><td>GWY-01</td><td>-</td><td>-</td><td></td></tr> | WRT-01 | - | Device Automation | type:button_short_press, subtype:button_1 |
<tr><td>RTR-01</td><td>-</td><td>-</td><td></td></tr> | GWY-01 | - | - | |
<tr><td>Scene</td><td>-</td><td>Scene</td><td></td></tr> | RTR-01 | - | - | |
<tr><td>Scene</td><td>-</td><td>Device Automation</td><td>type:scene, subtype:trigger</td></tr> | Scene | - | Scene | |
<tr><td>Room</td><td>-</td><td>Area</td><td>Can be changed by Home Assistant</td></tr> | Scene | - | Device Automation | type:scene, subtype:trigger |
<tr><td>Room</td><td>-</td><td>Light</td><td>If includeRoomsAsLights is set to true</td></tr> | Room | - | Area | Can be changed by Home Assistant |
<table> | Room | - | Light | If includeRoomsAsLights is set to true |
Thanks to [ha-plejd](https://github.com/klali/ha-plejd) for inspiration. 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 ### Configuration
#### Simple MQTT Configurations #### Simple MQTT Configurations
When you are using the official Mosquitto Broker from Home Assistant Add-on store, minimal configuration is required. 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> | Parameter | Value |
<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> | mqttBroker | mqtt://localhost |
</table> | mqttUsername | homeassistant |
| mqttPassword | Mosquitto password, fetched via Configuration->Integrations->Mosquitto broker->Configure->RE-CONFIGURE->Password |
#### Advanced MQTT Configurations #### 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: 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; hiddenFromSceneList?: boolean;
name: string; name: string;
output: number; output: number;
roomId: string; roomId: string | undefined;
roomName: string; roomName: string | undefined;
state: boolean | undefined; state: boolean | undefined;
type: string; type: string;
typeName: string; typeName: string;