feat(integrations): add mock integration (#3505)
This commit is contained in:
1 parent
350a531d32
commit
58d5b14c51
73 files changed
+1049
-156
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import type { ISmartHomeIntegration } from "../../interfaces/smart-home/smart-home-integration";
|
||||
import type { EntityStateResult } from "../../interfaces/smart-home/smart-home-types";
|
||||
|
||||
export class SmartHomeMockService implements ISmartHomeIntegration {
|
||||
public async getEntityStateAsync(entityId: string): Promise<EntityStateResult> {
|
||||
return await Promise.resolve({
|
||||
success: true as const,
|
||||
data: {
|
||||
entity_id: entityId,
|
||||
state: "on",
|
||||
attributes: {
|
||||
friendly_name: `Mock Entity ${entityId}`,
|
||||
device_class: "light",
|
||||
supported_features: 1,
|
||||
},
|
||||
last_changed: new Date(),
|
||||
last_updated: new Date(),
|
||||
},
|
||||
});
|
||||
}
|
||||
public async triggerAutomationAsync(_entityId: string): Promise<boolean> {
|
||||
return await Promise.resolve(true);
|
||||
}
|
||||
public async triggerToggleAsync(_entityId: string): Promise<boolean> {
|
||||
return await Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user