-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
755 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "boolean", | ||
"title": { | ||
"en": "Mute" | ||
}, | ||
"getable": false, | ||
"setable": true, | ||
"uiComponent": "button" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "boolean", | ||
"title": { | ||
"en": "Off" | ||
}, | ||
"getable": false, | ||
"setable": true, | ||
"uiComponent": "button" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "boolean", | ||
"title": { | ||
"en": "On" | ||
}, | ||
"getable": false, | ||
"setable": true, | ||
"uiComponent": "button" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "boolean", | ||
"title": { | ||
"en": "Power" | ||
}, | ||
"getable": false, | ||
"setable": true, | ||
"uiComponent": "button" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import TuyaOAuth2Device from '../../lib/TuyaOAuth2Device'; | ||
|
||
class TuyaOAuth2DeviceIrController extends TuyaOAuth2Device { | ||
async onOAuth2Init(): Promise<void> { | ||
await super.onOAuth2Init(); | ||
|
||
if (this.hasCapability('on_button')) { | ||
this.registerCapabilityListener('on_button', () => this.sendKeyCommand(undefined, 'PowerOn').then()); | ||
} | ||
|
||
if (this.hasCapability('off_button')) { | ||
this.registerCapabilityListener('off_button', () => this.sendKeyCommand(undefined, 'PowerOff').then()); | ||
} | ||
|
||
if (this.hasCapability('power_button')) { | ||
this.registerCapabilityListener('power_button', () => this.sendKeyCommand(undefined, 'Power').then()); | ||
} | ||
|
||
if (this.hasCapability('mute_button')) { | ||
this.registerCapabilityListener('mute_button', () => | ||
this.sendKeyCommand(undefined, this.getStoreValue('tuya_mute_key')).then(), | ||
); | ||
} | ||
} | ||
|
||
async sendKeyCommand(keyId?: number, keyString?: string): Promise<boolean> { | ||
const { deviceId, controllerId } = this.getData(); | ||
const categoryId = this.getStoreValue('tuya_remote_category') as number; | ||
return this.oAuth2Client.sendKeyCommand(controllerId, deviceId, categoryId, keyId, keyString); | ||
} | ||
|
||
async sendAircoCommand(code: string, value: number): Promise<boolean> { | ||
const { deviceId, controllerId } = this.getData(); | ||
return this.oAuth2Client.sendAircoCommand(controllerId, deviceId, code, value); | ||
} | ||
} | ||
|
||
export default TuyaOAuth2DeviceIrController; | ||
module.exports = TuyaOAuth2DeviceIrController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"$extends": "tuya", | ||
"class": "remote", | ||
"name": { | ||
"en": "Infrared Remote", | ||
"nl": "Infrarood Afstandsbediening" | ||
}, | ||
"capabilities": ["on_button", "off_button", "mute_button"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"actions": [ | ||
{ | ||
"id": "infrared_remote_press", | ||
"title": { | ||
"en": "Press button" | ||
}, | ||
"titleFormatted": { | ||
"en": "Press [[button]]" | ||
}, | ||
"args": [ | ||
{ | ||
"name": "button", | ||
"type": "autocomplete", | ||
"title": { "en": "Button" } | ||
} | ||
] | ||
}, | ||
{ | ||
"id": "infrared_remote_mute_button", | ||
"title": { | ||
"en": "Press mute button" | ||
}, | ||
"$filter": "capabilities=mute_button" | ||
}, | ||
{ | ||
"id": "infrared_remote_power_button", | ||
"title": { | ||
"en": "Press power button" | ||
}, | ||
"$filter": "capabilities=power_button" | ||
}, | ||
{ | ||
"id": "infrared_remote_on_button", | ||
"title": { | ||
"en": "Press on button" | ||
}, | ||
"$filter": "capabilities=on_button" | ||
}, | ||
{ | ||
"id": "infrared_remote_off_button", | ||
"title": { | ||
"en": "Press off button" | ||
}, | ||
"$filter": "capabilities=off_button" | ||
} | ||
], | ||
"conditions": [], | ||
"triggers": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
{ | ||
"$extends": "deviceSpecification" | ||
} | ||
] |
Oops, something went wrong.