@@ -248,6 +248,7 @@ export default class OTAUpdate extends Extension {
248248 | Zigbee2MQTTAPI [ "bridge/request/device/ota_update/check/downgrade" ]
249249 | Zigbee2MQTTAPI [ "bridge/request/device/ota_update/update" ]
250250 | Zigbee2MQTTAPI [ "bridge/request/device/ota_update/update/downgrade" ]
251+ | Zigbee2MQTTAPI [ "bridge/request/device/ota_update/update/abort" ]
251252 | Zigbee2MQTTAPI [ "bridge/request/device/ota_update/schedule" ]
252253 | Zigbee2MQTTAPI [ "bridge/request/device/ota_update/schedule/downgrade" ]
253254 | Zigbee2MQTTAPI [ "bridge/request/device/ota_update/unschedule" ] ;
@@ -262,14 +263,20 @@ export default class OTAUpdate extends Extension {
262263 const device = this . zigbee . resolveEntity ( ID ) ;
263264 const type = topicMatch [ 1 ] as "check" | "update" | "schedule" | "unschedule" ;
264265 const downgrade = topicMatch [ 2 ] === "downgrade" ;
266+ const abort = topicMatch [ 2 ] === "abort" ;
265267 let error : string | undefined ;
266268 let errorStack : string | undefined ;
267269
268270 if ( ! ( device instanceof Device ) ) {
269271 error = `Device '${ ID } ' does not exist` ;
270272 } else if ( this . #inProgress. has ( device . ieeeAddr ) ) {
271- // also guards against scheduling while check/update op in progress that could result in undesired OTA state
272- error = `OTA update or check for update already in progress for '${ device . name } '` ;
273+ if ( abort ) {
274+ device . zh . abortOta ( ) ;
275+ this . #inProgress. delete ( device . ieeeAddr ) ;
276+ } else {
277+ // also guards against scheduling while check/update op in progress that could result in undesired OTA state
278+ error = `OTA update or check for update already in progress for '${ device . name } '` ;
279+ }
273280 } else {
274281 switch ( type ) {
275282 case "check" : {
@@ -321,6 +328,11 @@ export default class OTAUpdate extends Extension {
321328 }
322329
323330 case "update" : {
331+ if ( abort ) {
332+ error = `No OTA in progress for device '${ device . name } '` ;
333+ break ;
334+ }
335+
324336 this . #inProgress. add ( device . ieeeAddr ) ;
325337
326338 const otaSettings = settings . get ( ) . ota ;
0 commit comments