Koenkk / zigbee-herdsman

A Node.js Zigbee library
MIT License
483 stars 300 forks source link

Optimize adapter disconnected state #1066

Closed Nerivec closed 6 months ago

Nerivec commented 6 months ago

Logic in the event of adapter disconnected should go from:

zh.onAdapterDisconnected
  - adapter.stop()
  - emit 'adapterDisconnected'
    - z2m.onZigbeeAdapterDisconnected
      - stop()
        - zigbee.stop()
          - herdsman.stop()
            - databaseSave()
            - cleanup
            - permitJoinInternal()
            - backup()
              - databaseSave()
              - adapter.backup()
            - adapter.stop()

to

zh.onAdapterDisconnected
  - adapter.stop()
  - emit 'adapterDisconnected'
    - z2m.onZigbeeAdapterDisconnected
      - stop()
        - zigbee.stop()
          - herdsman.stop()
            - cleanup
            - databaseSave()

Updated some deprecated jest fn names.