Fix dim levels
This commit is contained in:
parent
1812642773
commit
b2592a2f4c
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
|||||||
!.gitignore
|
!.gitignore
|
||||||
!custom_components/
|
!custom_components/
|
||||||
**/__pycache__/
|
**/__pycache__/
|
||||||
|
!README.md
|
||||||
|
40
README.md
Normal file
40
README.md
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
Plejd integration for Home Assistant
|
||||||
|
===
|
||||||
|
|
||||||
|
This integration is a work in progress.
|
||||||
|
|
||||||
|
I do not guarantee it will work or even that it will not harm your system. I don't see what harm it *could* cause, but I promise nothing.
|
||||||
|
|
||||||
|
## Installation for testing
|
||||||
|
|
||||||
|
- Make sure you have a working Bluetooth integration in Home Assistant (a bluetooth proxy should work too)
|
||||||
|
- Put the `plejd` directory in your `<config>/custom_components`.
|
||||||
|
- Restart Home Assistant
|
||||||
|
- Hopefully, your Plejd mesh will be auto discovered and you should see a message popping up in your integrations page.
|
||||||
|
- Log in with the credentials you use in the Plejd app when prompted (email address and password)
|
||||||
|
|
||||||
|
## Current limitations
|
||||||
|
|
||||||
|
- I only have a single DIM-01 device, so that's the only one I know for sure works.
|
||||||
|
- Only one channel per device is expected to work right now. E.g. only one lamp connected to a DIM-02 will show up in Home Assistant.
|
||||||
|
|
||||||
|
## About connections
|
||||||
|
|
||||||
|
Plejd devices doesn't seem to like to have multiple connections going.
|
||||||
|
Once a controller like the official Plejd app or Home Assistant connects, they will hide their precense from everyone else until a time after that connection is broken.
|
||||||
|
|
||||||
|
That means that if you only have one Plejd device you may not be able to use Home Assistant and the app to controll the device at the same time, and either may have a hard time connecting while the other is running.
|
||||||
|
|
||||||
|
Even after turning off the app or Home Assistant it may take 30 minutes to several hours before the othe rcan connect again. Turning off bluetooth on the last connected device or cutting power to the Plejd for a minute may help.
|
||||||
|
|
||||||
|
|
||||||
|
## Getting more debug information
|
||||||
|
|
||||||
|
Add this to your Home Assistant configuration.yaml to get as much information as possible
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
logger:
|
||||||
|
default: warn
|
||||||
|
logs:
|
||||||
|
custom_components.plejd: debug
|
||||||
|
```
|
@ -40,7 +40,7 @@ class PlejdLight(LightEntity, CoordinatorEntity):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def available(self):
|
def available(self):
|
||||||
return self._data.get("state", None) is not None
|
return self.device.available
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self):
|
||||||
@ -68,11 +68,11 @@ class PlejdLight(LightEntity, CoordinatorEntity):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
return self._data.get("state")
|
return self.device.state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def brightness(self):
|
def brightness(self):
|
||||||
return self._data.get("dim",0)
|
return self.device.dim
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_color_modes(self):
|
def supported_color_modes(self):
|
||||||
|
@ -20,10 +20,10 @@ HARDWARE_TYPES = {
|
|||||||
"7": Device("REL-01", SWITCH, False),
|
"7": Device("REL-01", SWITCH, False),
|
||||||
"8": Device("SPR-01", SWITCH, False),
|
"8": Device("SPR-01", SWITCH, False),
|
||||||
"10": Device("WRT-01", SWITCH, False),
|
"10": Device("WRT-01", SWITCH, False),
|
||||||
"11": Device("DIM-01", LIGHT, True),
|
"11": Device("DIM-01-2P", LIGHT, True),
|
||||||
"13": Device("Generic", LIGHT, False),
|
"13": Device("Generic", LIGHT, False),
|
||||||
"14": Device("DIM-01", LIGHT, True),
|
"14": Device("DIM-01-LC", LIGHT, True),
|
||||||
"15": Device("DIM-02", LIGHT, True),
|
"15": Device("DIM-02-LC", LIGHT, True),
|
||||||
"17": Device("REL-01-2P", SWITCH, False),
|
"17": Device("REL-01-2P", SWITCH, False),
|
||||||
"18": Device("REL-02", SWITCH, False),
|
"18": Device("REL-02", SWITCH, False),
|
||||||
"20": Device("SPR-01", SWITCH, False),
|
"20": Device("SPR-01", SWITCH, False),
|
||||||
@ -43,13 +43,17 @@ class PlejdDevice:
|
|||||||
self._state = None
|
self._state = None
|
||||||
self._dim = None
|
self._dim = None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def available(self):
|
||||||
|
return self._state is not None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
return self._state
|
return self._state if self.available else False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dim(self):
|
def dim(self):
|
||||||
return self._dim/255
|
return self._dim/255 if self.available else 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def BLE_address(self):
|
def BLE_address(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user