mirror of
https://github.com/adrianjagielak/home-assistant-futurehome.git
synced 2025-09-13 15:47:08 +00:00
Poll state every 30s
This commit is contained in:
parent
2fc61ead25
commit
3a65e11948
@ -31,7 +31,7 @@ Devices commonly consist of multiple services: for example, a presence sensor mi
|
||||
Some services are more common than others. Some are deprecated entirely.
|
||||
|
||||
todo periodical refresh of devices
|
||||
todo periodical refresh of state
|
||||
todo links to the .ts service implementations below
|
||||
|
||||
| Service | Example device | Implementation status |
|
||||
| --- | --- | --- |
|
||||
|
@ -175,15 +175,20 @@ import { delay } from "./utils";
|
||||
}
|
||||
});
|
||||
|
||||
const pollState = () => {
|
||||
sendFimpMsg({
|
||||
address: '/rt:app/rn:vinculum/ad:1',
|
||||
service: 'vinculum',
|
||||
cmd: 'cmd.pd7.request',
|
||||
val: { cmd: "get", component: null, param: { components: ['state'] } },
|
||||
val_t: 'object',
|
||||
timeoutMs: 30000,
|
||||
}).catch(e => log.warn("Failed to request state", e));
|
||||
};
|
||||
// Request initial state
|
||||
await sendFimpMsg({
|
||||
address: '/rt:app/rn:vinculum/ad:1',
|
||||
service: 'vinculum',
|
||||
cmd: 'cmd.pd7.request',
|
||||
val: { cmd: "get", component: null, param: { components: ['state'] } },
|
||||
val_t: 'object',
|
||||
timeoutMs: 30000,
|
||||
});
|
||||
pollState();
|
||||
// Then poll every 30 seconds
|
||||
setInterval(pollState, 30000);
|
||||
|
||||
ha.on('message', (topic, buf) => {
|
||||
// Handle Home Assistant command messages
|
||||
|
Loading…
x
Reference in New Issue
Block a user