Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
homebridge: Use sendCommand (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
panusoi authored Apr 23, 2023
1 parent 7aa9da6 commit f12d8e8
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-dolls-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'homebridge-tasmota-commands': minor
---

change to use the new `sendCommand` method
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const createBrightnessListener: CreateCharacteristicListener = ({
return;
}

commands.Light.setDimmer(value)
commands
.sendCommand('Light', 'Dimmer', value)
.then((response) => {
if (response?.Dimmer && isValidBrightness(response?.Dimmer)) {
callback(HAPStatus.SUCCESS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const createColorTemperatureListener: CreateCharacteristicListener = ({
return;
}

commands.Light.setColorTemperature(tasmotaCTValue)
commands
.sendCommand('Light', 'CT', tasmotaCTValue)
.then((response) => {
if (response?.CT) {
const homebridgeCTValue = convertTasmotaColorTemperatureForHomebridge(response.CT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const createHueListener: CreateCharacteristicListener = ({
return;
}

commands.Light.setHSBColor1(value)
commands
.sendCommand('Light', 'HSBColor1', value)
.then((response) => {
if (response?.HSBColor && isHSB(response?.HSBColor)) {
callback(HAPStatus.SUCCESS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const createOnListener: CreateCharacteristicListener = ({
verbose && logger.debug("Creating 'On' characteristic listener");
return {
set: (value, callback) => {
commands.Control.setPower0(value === true ? 'on' : 'off')
commands
.sendCommand('Control', 'Power0', value === true ? 'on' : 'off')
.then((response) => {
if (response?.POWER) {
callback(HAPStatus.SUCCESS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const createSaturationListener: CreateCharacteristicListener = ({
return;
}

commands.Light.setHSBColor2(value)
commands
.sendCommand('Light', 'HSBColor2', value)
.then((response) => {
if (response?.HSBColor && isHSB(response?.HSBColor)) {
callback(HAPStatus.SUCCESS);
Expand Down

0 comments on commit f12d8e8

Please sign in to comment.