mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-22 02:29:55 +00:00
More availability fixes. #6281
This commit is contained in:
@@ -191,10 +191,10 @@ class AvailabilityNew extends ExtensionTS {
|
||||
for (const keys of keySet) {
|
||||
const converter = rd.definition.toZigbee.find((c) => c.key.find((k) => keys.includes(k)));
|
||||
await converter?.convertGet?.(rd.endpoint, keys[0],
|
||||
{message: this.state.get(rd.device.ieeeAddr) || {}});
|
||||
{message: this.state.get(rd.device.ieeeAddr) || {}, mapped: rd.definition});
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(`Failed to read state of '${rd.name}' after reconnect`);
|
||||
logger.error(`Failed to read state of '${rd.name}' after reconnect (${error.message})`);
|
||||
}
|
||||
}, seconds(2));
|
||||
}
|
||||
|
||||
+6
-4
@@ -126,12 +126,14 @@ declare global {
|
||||
type: 'device' | 'group',
|
||||
}
|
||||
|
||||
interface Definition {
|
||||
model: string
|
||||
toZigbee: {key: string[], convertGet?: (entity: Endpoint, key: string, meta: {message: {}, mapped: Definition}) => Promise<void>}[]
|
||||
}
|
||||
|
||||
interface ResolvedDevice {
|
||||
type: 'device',
|
||||
definition?: {
|
||||
model: string
|
||||
toZigbee: {key: string[], convertGet?: (entity: Endpoint, key: string, meta: {}) => Promise<void>}[]
|
||||
},
|
||||
definition?: Definition,
|
||||
name: string,
|
||||
endpoint: Endpoint,
|
||||
device: Device,
|
||||
|
||||
Reference in New Issue
Block a user