Skip to content

Commit

Permalink
Allow control of brightness and color for light component, fixes #173
Browse files Browse the repository at this point in the history
  • Loading branch information
DutchmanNL committed Nov 1, 2023
1 parent 7c239aa commit 948e80d
Show file tree
Hide file tree
Showing 5 changed files with 4,387 additions and 79 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ If you like my work, please consider a personal donation
### __WORK IN PROGRESS__
* (DutchmanNL)
-->

### __WORK IN PROGRESS__
* (DutchmanNL) Bugfix: Allow control of brightness and color for light component, fixes #173

### 0.3.1 (2023-10-31)
* (DutchmanNL) Bugfix: Show online state of ESP Device correctly, Fixes #106

Expand Down
2 changes: 1 addition & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"common": {
"name": "esphome",
"version": "0.3.1",
"version": "0.3.2-beta.0",
"news": {
"0.3.1": {
"en": "Bugfix: Show online state of ESP Device correctly, Fixes #106",
Expand Down
10 changes: 5 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ class Esphome extends utils.Adapter {
await client[host].connection.subscribeStatesService();
this.log.debug(`[DeviceInfoData] ${this.deviceInfo[host].deviceInfo.name} ${JSON.stringify(this.deviceInfo[host])}`);

// Listen to state changes an write values to states (create state if not yet exists)
// Listen to state changes and write values to states (create state if not yet exists)
entity.on(`state`, async (/** @type {object} */ state) => {
this.log.debug(`StateData: ${JSON.stringify(state)}`);
try {
Expand Down Expand Up @@ -1129,18 +1129,18 @@ class Esphome extends utils.Adapter {
state: this.deviceInfo[deviceIP][device[4]].states.state,
transitionLength: this.deviceInfo[deviceIP][device[4]].states.transitionLength
};
if (this.deviceInfo[deviceIP][device[4]].config.supportsBrightness === true) {
if (this.deviceInfo[deviceIP][device[4]].config.legacySupportsBrightness === true) {
data.brightness = this.deviceInfo[deviceIP][device[4]].states.brightness;
}
if (this.deviceInfo[deviceIP][device[4]].config.supportsRgb === true) {
if (this.deviceInfo[deviceIP][device[4]].config.legacySupportsRgb === true) {
data.red = this.deviceInfo[deviceIP][device[4]].states.red;
data.green = this.deviceInfo[deviceIP][device[4]].states.green;
data.blue = this.deviceInfo[deviceIP][device[4]].states.blue;
}
if (this.deviceInfo[deviceIP][device[4]].config.supportsWhiteValue === true) {
if (this.deviceInfo[deviceIP][device[4]].config.legacySupportsWhiteValue === true) {
data.white = this.deviceInfo[deviceIP][device[4]].states.white;
}
if (this.deviceInfo[deviceIP][device[4]].config.supportsColorTemperature === true) {
if (this.deviceInfo[deviceIP][device[4]].config.legacySupportsColorTemperature === true) {
data.colorTemperature = this.deviceInfo[deviceIP][device[4]].states.colorTemperature;
}
const effect = this.deviceInfo[deviceIP][device[4]].states.effect;
Expand Down
Loading

0 comments on commit 948e80d

Please sign in to comment.