diff --git a/lib.js b/lib.js index 618d263..ffdca48 100644 --- a/lib.js +++ b/lib.js @@ -98,7 +98,8 @@ var ENTITIES = { expire_after: 5, name: "Flichub Connected", device_class: "connectivity", - unit_of_measurement: "s" + unit_of_measurement: "s", + payload_not_available: "OFF" } ], connected: [ @@ -107,7 +108,8 @@ var ENTITIES = { entity_category: "diagnostic", expire_after: 5, device_class: "connectivity", - name: "Connection Established" + name: "Connection Established", + payload_not_available: "OFF" } ], ready: [ @@ -165,12 +167,12 @@ function makeButtonController(ha, buttonModule) { availability: [ { payload_available: "ON", - payload_not_available: "OFF", + payload_not_available: "unavailable", topic: ha.genFlicPrefix(genButtonUniqueId(button.bdaddr), "ready") }, { payload_available: "ON", - payload_not_available: "OFF", + payload_not_available: "unavailable", topic: ha.genFlicPrefix(genButtonUniqueId(button.bdaddr), "lifeline") } ], @@ -452,7 +454,7 @@ var makeIRController = function(ir, ha, mqtt) { var availability = [ { payload_available: "ON", - payload_not_available: "OFF", + payload_not_available: "unavailable", topic: LIFELINE_SGINAL } ]; @@ -470,7 +472,10 @@ var makeIRController = function(ir, ha, mqtt) { ha.registerEntity("IR Available", "binary_sensor", nodeId, "lifeline", haDevice, { device_class: "connectivity", expire_after: 5, - entity_category: "diagnostic" + off_delay: 3, + entity_category: "diagnostic", + payload_available: "ON", + payload_not_available: "OFF" }); ha.registerEntity("Record Signal", "switch", nodeId, "record", haDevice, { icon: "mdi:record-rec", diff --git a/src/ButtonController.ts b/src/ButtonController.ts index 72488dd..de5c526 100644 --- a/src/ButtonController.ts +++ b/src/ButtonController.ts @@ -17,8 +17,8 @@ const ENTITIES: Record]> = { "state": ['sensor', { icon: 'mdi:radiobox-indeterminate-variant' }], "battery": ['sensor', { expire_after: 5, unit_of_measurement: '%', device_class: 'battery' }], "batteryLastUpdate": ['sensor', { entity_category: "diagnostic", expire_after: 5, name: "Battery Last Update Time", device_class: "duration", unit_of_measurement: "s" }], - "lifeline": ['binary_sensor', { entity_category: "diagnostic", expire_after: 5, name: "Flichub Connected", device_class: "connectivity", unit_of_measurement: "s" }], - "connected": ['binary_sensor', { entity_category: "diagnostic", expire_after: 5, device_class: 'connectivity', name: "Connection Established" }], + "lifeline": ['binary_sensor', { entity_category: "diagnostic", expire_after: 5, name: "Flichub Connected", device_class: "connectivity", unit_of_measurement: "s", payload_not_available: "OFF" }], + "connected": ['binary_sensor', { entity_category: "diagnostic", expire_after: 5, device_class: 'connectivity', name: "Connection Established", payload_not_available: "OFF" }], "ready": ['binary_sensor', { entity_category: "config", expire_after: 5, device_class: 'connectivity', name: "Connection Verified" }], "activeDisconnect": ['binary_sensor', { entity_category: "config", expire_after: 5, name: "User Active Disconnect" }], "passive": ['binary_sensor', { entity_category: "config", expire_after: 5, name: "Passive Mode" }], @@ -52,12 +52,12 @@ export function makeButtonController( availability: [ { payload_available: 'ON', - payload_not_available: 'OFF', + payload_not_available: 'unavailable', topic: ha.genFlicPrefix(genButtonUniqueId(button.bdaddr), 'ready') }, { payload_available: 'ON', - payload_not_available: 'OFF', + payload_not_available: 'unavailable', topic: ha.genFlicPrefix(genButtonUniqueId(button.bdaddr), 'lifeline') }, ], diff --git a/src/IRController.ts b/src/IRController.ts index 598a1f6..afcf763 100644 --- a/src/IRController.ts +++ b/src/IRController.ts @@ -47,7 +47,7 @@ export const makeIRController = ( const availability = [ { "payload_available": "ON", - "payload_not_available": "OFF", + "payload_not_available": "unavailable", "topic": LIFELINE_SGINAL, } ] @@ -73,7 +73,10 @@ export const makeIRController = ( { device_class: 'connectivity', expire_after: 5, + off_delay: 3, entity_category: "diagnostic", + payload_available: "ON", + payload_not_available: "OFF", } ) ha.registerEntity(