@smarthome.exchange/integrations 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +49 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/core/classes.configstore.d.ts +2 -0
- package/dist_ts/core/classes.configstore.js +84 -27
- package/dist_ts/core/classes.nativehomeadmission.d.ts +19 -0
- package/dist_ts/core/classes.nativehomeadmission.js +84 -0
- package/dist_ts/core/classes.nativeintegrationowner.d.ts +79 -0
- package/dist_ts/core/classes.nativeintegrationowner.js +269 -0
- package/dist_ts/core/index.d.ts +2 -0
- package/dist_ts/core/index.js +3 -1
- package/dist_ts/core/types.d.ts +14 -0
- package/dist_ts/integrations/braviatv/braviatv.classes.client.d.ts +23 -72
- package/dist_ts/integrations/braviatv/braviatv.classes.client.js +265 -625
- package/dist_ts/integrations/braviatv/braviatv.classes.configflow.d.ts +7 -7
- package/dist_ts/integrations/braviatv/braviatv.classes.configflow.js +51 -68
- package/dist_ts/integrations/braviatv/braviatv.classes.integration.d.ts +8 -11
- package/dist_ts/integrations/braviatv/braviatv.classes.integration.js +186 -135
- package/dist_ts/integrations/braviatv/braviatv.discovery.js +12 -11
- package/dist_ts/integrations/braviatv/braviatv.mapper.d.ts +6 -14
- package/dist_ts/integrations/braviatv/braviatv.mapper.js +37 -131
- package/dist_ts/integrations/braviatv/braviatv.types.d.ts +55 -133
- package/dist_ts/integrations/braviatv/braviatv.validation.d.ts +7 -0
- package/dist_ts/integrations/braviatv/braviatv.validation.js +72 -0
- package/dist_ts/integrations/broadlink/broadlink.actions.d.ts +2 -0
- package/dist_ts/integrations/broadlink/broadlink.actions.js +36 -0
- package/dist_ts/integrations/broadlink/broadlink.classes.client.d.ts +21 -19
- package/dist_ts/integrations/broadlink/broadlink.classes.client.js +185 -124
- package/dist_ts/integrations/broadlink/broadlink.classes.configflow.d.ts +5 -4
- package/dist_ts/integrations/broadlink/broadlink.classes.configflow.js +64 -83
- package/dist_ts/integrations/broadlink/broadlink.classes.integration.d.ts +16 -19
- package/dist_ts/integrations/broadlink/broadlink.classes.integration.js +114 -59
- package/dist_ts/integrations/broadlink/broadlink.mapper.d.ts +3 -2
- package/dist_ts/integrations/broadlink/broadlink.mapper.js +2 -1
- package/dist_ts/integrations/broadlink/broadlink.selected.mapper.d.ts +10 -0
- package/dist_ts/integrations/broadlink/broadlink.selected.mapper.js +41 -0
- package/dist_ts/integrations/broadlink/broadlink.types.d.ts +43 -7
- package/dist_ts/integrations/broadlink/broadlink.validation.d.ts +7 -0
- package/dist_ts/integrations/broadlink/broadlink.validation.js +63 -0
- package/dist_ts/integrations/daikin/daikin.classes.client.d.ts +10 -52
- package/dist_ts/integrations/daikin/daikin.classes.client.js +55 -614
- package/dist_ts/integrations/daikin/daikin.classes.configflow.d.ts +8 -12
- package/dist_ts/integrations/daikin/daikin.classes.configflow.js +77 -138
- package/dist_ts/integrations/daikin/daikin.classes.integration.d.ts +7 -24
- package/dist_ts/integrations/daikin/daikin.classes.integration.js +175 -67
- package/dist_ts/integrations/daikin/daikin.discovery.d.ts +11 -24
- package/dist_ts/integrations/daikin/daikin.discovery.js +98 -305
- package/dist_ts/integrations/daikin/daikin.mapper.d.ts +6 -7
- package/dist_ts/integrations/daikin/daikin.mapper.js +95 -155
- package/dist_ts/integrations/daikin/daikin.types.d.ts +24 -44
- package/dist_ts/integrations/daikin/daikin.types.js +1 -1
- package/dist_ts/integrations/daikin/daikin.validation.d.ts +5 -0
- package/dist_ts/integrations/daikin/daikin.validation.js +53 -0
- package/dist_ts/integrations/denonavr/denonavr.classes.client.d.ts +31 -40
- package/dist_ts/integrations/denonavr/denonavr.classes.client.js +149 -404
- package/dist_ts/integrations/denonavr/denonavr.classes.configflow.d.ts +7 -2
- package/dist_ts/integrations/denonavr/denonavr.classes.configflow.js +44 -36
- package/dist_ts/integrations/denonavr/denonavr.classes.integration.d.ts +6 -11
- package/dist_ts/integrations/denonavr/denonavr.classes.integration.js +192 -113
- package/dist_ts/integrations/denonavr/denonavr.discovery.d.ts +10 -18
- package/dist_ts/integrations/denonavr/denonavr.discovery.js +71 -193
- package/dist_ts/integrations/denonavr/denonavr.mapper.d.ts +5 -13
- package/dist_ts/integrations/denonavr/denonavr.mapper.js +35 -159
- package/dist_ts/integrations/denonavr/denonavr.types.d.ts +55 -90
- package/dist_ts/integrations/denonavr/denonavr.validation.d.ts +10 -0
- package/dist_ts/integrations/denonavr/denonavr.validation.js +86 -0
- package/dist_ts/integrations/kodi/kodi.classes.client.d.ts +11 -45
- package/dist_ts/integrations/kodi/kodi.classes.client.js +84 -310
- package/dist_ts/integrations/kodi/kodi.classes.configflow.d.ts +9 -8
- package/dist_ts/integrations/kodi/kodi.classes.configflow.js +53 -48
- package/dist_ts/integrations/kodi/kodi.classes.integration.d.ts +11 -11
- package/dist_ts/integrations/kodi/kodi.classes.integration.js +114 -171
- package/dist_ts/integrations/kodi/kodi.discovery.js +53 -29
- package/dist_ts/integrations/kodi/kodi.mapper.d.ts +7 -2
- package/dist_ts/integrations/kodi/kodi.mapper.js +48 -10
- package/dist_ts/integrations/kodi/kodi.types.d.ts +32 -28
- package/dist_ts/integrations/kodi/kodi.validation.d.ts +9 -0
- package/dist_ts/integrations/kodi/kodi.validation.js +62 -0
- package/dist_ts/integrations/modbus/modbus.classes.client.d.ts +15 -61
- package/dist_ts/integrations/modbus/modbus.classes.client.js +117 -776
- package/dist_ts/integrations/modbus/modbus.classes.configflow.d.ts +9 -5
- package/dist_ts/integrations/modbus/modbus.classes.configflow.js +70 -38
- package/dist_ts/integrations/modbus/modbus.classes.integration.d.ts +6 -17
- package/dist_ts/integrations/modbus/modbus.classes.integration.js +133 -57
- package/dist_ts/integrations/modbus/modbus.discovery.d.ts +5 -8
- package/dist_ts/integrations/modbus/modbus.discovery.js +38 -93
- package/dist_ts/integrations/modbus/modbus.mapper.d.ts +8 -32
- package/dist_ts/integrations/modbus/modbus.mapper.js +71 -431
- package/dist_ts/integrations/modbus/modbus.types.d.ts +82 -332
- package/dist_ts/integrations/modbus/modbus.validation.d.ts +10 -0
- package/dist_ts/integrations/modbus/modbus.validation.js +128 -0
- package/dist_ts/integrations/nanoleaf/nanoleaf.classes.client.d.ts +12 -34
- package/dist_ts/integrations/nanoleaf/nanoleaf.classes.client.js +143 -231
- package/dist_ts/integrations/nanoleaf/nanoleaf.classes.configflow.d.ts +6 -1
- package/dist_ts/integrations/nanoleaf/nanoleaf.classes.configflow.js +105 -18
- package/dist_ts/integrations/nanoleaf/nanoleaf.classes.integration.d.ts +8 -8
- package/dist_ts/integrations/nanoleaf/nanoleaf.classes.integration.js +141 -155
- package/dist_ts/integrations/nanoleaf/nanoleaf.credentials.d.ts +9 -0
- package/dist_ts/integrations/nanoleaf/nanoleaf.credentials.js +35 -0
- package/dist_ts/integrations/nanoleaf/nanoleaf.mapper.d.ts +6 -18
- package/dist_ts/integrations/nanoleaf/nanoleaf.mapper.js +45 -220
- package/dist_ts/integrations/nanoleaf/nanoleaf.types.d.ts +33 -147
- package/dist_ts/integrations/nanoleaf/nanoleaf.validation.d.ts +6 -0
- package/dist_ts/integrations/nanoleaf/nanoleaf.validation.js +82 -0
- package/dist_ts/integrations/onkyo/onkyo.classes.client.d.ts +15 -20
- package/dist_ts/integrations/onkyo/onkyo.classes.client.js +161 -404
- package/dist_ts/integrations/onkyo/onkyo.classes.configflow.d.ts +9 -4
- package/dist_ts/integrations/onkyo/onkyo.classes.configflow.js +51 -6
- package/dist_ts/integrations/onkyo/onkyo.classes.integration.d.ts +22 -6
- package/dist_ts/integrations/onkyo/onkyo.classes.integration.js +144 -11
- package/dist_ts/integrations/onkyo/onkyo.discovery.d.ts +6 -1
- package/dist_ts/integrations/onkyo/onkyo.discovery.js +40 -4
- package/dist_ts/integrations/onkyo/onkyo.mapper.d.ts +7 -8
- package/dist_ts/integrations/onkyo/onkyo.mapper.js +45 -12
- package/dist_ts/integrations/onkyo/onkyo.types.d.ts +58 -8
- package/dist_ts/integrations/onkyo/onkyo.types.js +13 -102
- package/dist_ts/integrations/onkyo/onkyo.validation.d.ts +16 -0
- package/dist_ts/integrations/onkyo/onkyo.validation.js +77 -0
- package/dist_ts/integrations/panasonic_viera/panasonic_viera.classes.client.d.ts +25 -25
- package/dist_ts/integrations/panasonic_viera/panasonic_viera.classes.client.js +116 -360
- package/dist_ts/integrations/panasonic_viera/panasonic_viera.classes.configflow.d.ts +11 -3
- package/dist_ts/integrations/panasonic_viera/panasonic_viera.classes.configflow.js +76 -6
- package/dist_ts/integrations/panasonic_viera/panasonic_viera.classes.integration.d.ts +26 -4
- package/dist_ts/integrations/panasonic_viera/panasonic_viera.classes.integration.js +142 -9
- package/dist_ts/integrations/panasonic_viera/panasonic_viera.discovery.d.ts +2 -1
- package/dist_ts/integrations/panasonic_viera/panasonic_viera.discovery.js +31 -4
- package/dist_ts/integrations/panasonic_viera/panasonic_viera.mapper.d.ts +9 -9
- package/dist_ts/integrations/panasonic_viera/panasonic_viera.mapper.js +31 -149
- package/dist_ts/integrations/panasonic_viera/panasonic_viera.types.d.ts +51 -11
- package/dist_ts/integrations/panasonic_viera/panasonic_viera.types.js +22 -87
- package/dist_ts/integrations/panasonic_viera/panasonic_viera.validation.d.ts +6 -0
- package/dist_ts/integrations/panasonic_viera/panasonic_viera.validation.js +56 -0
- package/dist_ts/integrations/pioneer/pioneer.classes.client.d.ts +31 -16
- package/dist_ts/integrations/pioneer/pioneer.classes.client.js +167 -409
- package/dist_ts/integrations/pioneer/pioneer.classes.configflow.d.ts +10 -3
- package/dist_ts/integrations/pioneer/pioneer.classes.configflow.js +66 -6
- package/dist_ts/integrations/pioneer/pioneer.classes.integration.d.ts +13 -5
- package/dist_ts/integrations/pioneer/pioneer.classes.integration.js +239 -11
- package/dist_ts/integrations/pioneer/pioneer.discovery.d.ts +14 -1
- package/dist_ts/integrations/pioneer/pioneer.discovery.js +51 -4
- package/dist_ts/integrations/pioneer/pioneer.mapper.d.ts +14 -8
- package/dist_ts/integrations/pioneer/pioneer.mapper.js +54 -12
- package/dist_ts/integrations/pioneer/pioneer.types.d.ts +79 -12
- package/dist_ts/integrations/pioneer/pioneer.types.js +12 -76
- package/dist_ts/integrations/pioneer/pioneer.validation.d.ts +10 -0
- package/dist_ts/integrations/pioneer/pioneer.validation.js +85 -0
- package/dist_ts/integrations/soundtouch/soundtouch.classes.client.d.ts +13 -36
- package/dist_ts/integrations/soundtouch/soundtouch.classes.client.js +179 -502
- package/dist_ts/integrations/soundtouch/soundtouch.classes.configflow.d.ts +6 -1
- package/dist_ts/integrations/soundtouch/soundtouch.classes.configflow.js +50 -40
- package/dist_ts/integrations/soundtouch/soundtouch.classes.integration.d.ts +14 -15
- package/dist_ts/integrations/soundtouch/soundtouch.classes.integration.js +108 -128
- package/dist_ts/integrations/soundtouch/soundtouch.discovery.d.ts +2 -20
- package/dist_ts/integrations/soundtouch/soundtouch.discovery.js +23 -113
- package/dist_ts/integrations/soundtouch/soundtouch.mapper.d.ts +3 -12
- package/dist_ts/integrations/soundtouch/soundtouch.mapper.js +35 -189
- package/dist_ts/integrations/soundtouch/soundtouch.types.d.ts +57 -142
- package/dist_ts/integrations/soundtouch/soundtouch.types.js +18 -3
- package/dist_ts/integrations/soundtouch/soundtouch.validation.d.ts +22 -0
- package/dist_ts/integrations/soundtouch/soundtouch.validation.js +65 -0
- package/dist_ts/integrations/wiz/index.d.ts +1 -0
- package/dist_ts/integrations/wiz/index.js +2 -1
- package/dist_ts/integrations/wiz/wiz.classes.client.d.ts +14 -28
- package/dist_ts/integrations/wiz/wiz.classes.client.js +93 -229
- package/dist_ts/integrations/wiz/wiz.classes.configflow.d.ts +6 -4
- package/dist_ts/integrations/wiz/wiz.classes.configflow.js +38 -67
- package/dist_ts/integrations/wiz/wiz.classes.integration.d.ts +10 -21
- package/dist_ts/integrations/wiz/wiz.classes.integration.js +204 -44
- package/dist_ts/integrations/wiz/wiz.discovery.d.ts +10 -31
- package/dist_ts/integrations/wiz/wiz.discovery.js +48 -249
- package/dist_ts/integrations/wiz/wiz.mapper.d.ts +7 -51
- package/dist_ts/integrations/wiz/wiz.mapper.js +82 -668
- package/dist_ts/integrations/wiz/wiz.types.d.ts +34 -208
- package/dist_ts/integrations/wiz/wiz.validation.d.ts +8 -0
- package/dist_ts/integrations/wiz/wiz.validation.js +72 -0
- package/dist_ts/integrations/yamaha/index.d.ts +1 -0
- package/dist_ts/integrations/yamaha/index.js +2 -1
- package/dist_ts/integrations/yamaha/yamaha.classes.client.d.ts +30 -4
- package/dist_ts/integrations/yamaha/yamaha.classes.client.js +162 -6
- package/dist_ts/integrations/yamaha/yamaha.classes.configflow.d.ts +10 -3
- package/dist_ts/integrations/yamaha/yamaha.classes.configflow.js +106 -6
- package/dist_ts/integrations/yamaha/yamaha.classes.integration.d.ts +22 -4
- package/dist_ts/integrations/yamaha/yamaha.classes.integration.js +243 -8
- package/dist_ts/integrations/yamaha/yamaha.discovery.d.ts +13 -1
- package/dist_ts/integrations/yamaha/yamaha.discovery.js +57 -4
- package/dist_ts/integrations/yamaha/yamaha.mapper.d.ts +16 -8
- package/dist_ts/integrations/yamaha/yamaha.mapper.js +58 -12
- package/dist_ts/integrations/yamaha/yamaha.types.d.ts +73 -6
- package/dist_ts/integrations/yamaha/yamaha.types.js +8 -94
- package/dist_ts/integrations/yamaha/yamaha.validation.d.ts +12 -0
- package/dist_ts/integrations/yamaha/yamaha.validation.js +89 -0
- package/package.json +3 -3
- package/readme.md +514 -2
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/core/classes.configstore.ts +84 -27
- package/ts/core/classes.nativehomeadmission.ts +96 -0
- package/ts/core/classes.nativeintegrationowner.ts +297 -0
- package/ts/core/index.ts +2 -0
- package/ts/core/types.ts +16 -0
- package/ts/integrations/braviatv/braviatv.classes.client.ts +245 -709
- package/ts/integrations/braviatv/braviatv.classes.configflow.ts +47 -76
- package/ts/integrations/braviatv/braviatv.classes.integration.ts +167 -147
- package/ts/integrations/braviatv/braviatv.discovery.ts +11 -10
- package/ts/integrations/braviatv/braviatv.mapper.ts +39 -142
- package/ts/integrations/braviatv/braviatv.types.ts +53 -173
- package/ts/integrations/braviatv/braviatv.validation.ts +68 -0
- package/ts/integrations/broadlink/broadlink.actions.ts +31 -0
- package/ts/integrations/broadlink/broadlink.classes.client.ts +170 -144
- package/ts/integrations/broadlink/broadlink.classes.configflow.ts +59 -89
- package/ts/integrations/broadlink/broadlink.classes.integration.ts +110 -64
- package/ts/integrations/broadlink/broadlink.mapper.ts +5 -4
- package/ts/integrations/broadlink/broadlink.selected.mapper.ts +46 -0
- package/ts/integrations/broadlink/broadlink.types.ts +48 -8
- package/ts/integrations/broadlink/broadlink.validation.ts +66 -0
- package/ts/integrations/daikin/daikin.classes.client.ts +52 -661
- package/ts/integrations/daikin/daikin.classes.configflow.ts +72 -152
- package/ts/integrations/daikin/daikin.classes.integration.ts +166 -71
- package/ts/integrations/daikin/daikin.discovery.ts +94 -346
- package/ts/integrations/daikin/daikin.mapper.ts +83 -166
- package/ts/integrations/daikin/daikin.types.ts +27 -48
- package/ts/integrations/daikin/daikin.validation.ts +51 -0
- package/ts/integrations/daikin/readme.md +83 -0
- package/ts/integrations/denonavr/denonavr.classes.client.ts +132 -421
- package/ts/integrations/denonavr/denonavr.classes.configflow.ts +44 -37
- package/ts/integrations/denonavr/denonavr.classes.integration.ts +171 -117
- package/ts/integrations/denonavr/denonavr.discovery.ts +67 -220
- package/ts/integrations/denonavr/denonavr.mapper.ts +36 -182
- package/ts/integrations/denonavr/denonavr.types.ts +48 -111
- package/ts/integrations/denonavr/denonavr.validation.ts +87 -0
- package/ts/integrations/kodi/kodi.classes.client.ts +72 -352
- package/ts/integrations/kodi/kodi.classes.configflow.ts +52 -55
- package/ts/integrations/kodi/kodi.classes.integration.ts +97 -178
- package/ts/integrations/kodi/kodi.discovery.ts +49 -28
- package/ts/integrations/kodi/kodi.mapper.ts +52 -10
- package/ts/integrations/kodi/kodi.types.ts +33 -58
- package/ts/integrations/kodi/kodi.validation.ts +60 -0
- package/ts/integrations/modbus/modbus.classes.client.ts +100 -842
- package/ts/integrations/modbus/modbus.classes.configflow.ts +70 -41
- package/ts/integrations/modbus/modbus.classes.integration.ts +115 -60
- package/ts/integrations/modbus/modbus.discovery.ts +38 -106
- package/ts/integrations/modbus/modbus.mapper.ts +64 -467
- package/ts/integrations/modbus/modbus.types.ts +64 -381
- package/ts/integrations/modbus/modbus.validation.ts +119 -0
- package/ts/integrations/nanoleaf/nanoleaf.classes.client.ts +115 -249
- package/ts/integrations/nanoleaf/nanoleaf.classes.configflow.ts +90 -19
- package/ts/integrations/nanoleaf/nanoleaf.classes.integration.ts +130 -181
- package/ts/integrations/nanoleaf/nanoleaf.credentials.ts +39 -0
- package/ts/integrations/nanoleaf/nanoleaf.mapper.ts +47 -260
- package/ts/integrations/nanoleaf/nanoleaf.types.ts +29 -147
- package/ts/integrations/nanoleaf/nanoleaf.validation.ts +77 -0
- package/ts/integrations/onkyo/onkyo.classes.client.ts +148 -457
- package/ts/integrations/onkyo/onkyo.classes.configflow.ts +52 -6
- package/ts/integrations/onkyo/onkyo.classes.integration.ts +121 -12
- package/ts/integrations/onkyo/onkyo.discovery.ts +41 -3
- package/ts/integrations/onkyo/onkyo.mapper.ts +46 -19
- package/ts/integrations/onkyo/onkyo.types.ts +55 -110
- package/ts/integrations/onkyo/onkyo.validation.ts +85 -0
- package/ts/integrations/onkyo/readme.md +126 -0
- package/ts/integrations/panasonic_viera/panasonic_viera.classes.client.ts +101 -398
- package/ts/integrations/panasonic_viera/panasonic_viera.classes.configflow.ts +69 -5
- package/ts/integrations/panasonic_viera/panasonic_viera.classes.integration.ts +141 -9
- package/ts/integrations/panasonic_viera/panasonic_viera.discovery.ts +32 -3
- package/ts/integrations/panasonic_viera/panasonic_viera.mapper.ts +34 -161
- package/ts/integrations/panasonic_viera/panasonic_viera.types.ts +52 -96
- package/ts/integrations/panasonic_viera/panasonic_viera.validation.ts +56 -0
- package/ts/integrations/pioneer/pioneer.classes.client.ts +132 -428
- package/ts/integrations/pioneer/pioneer.classes.configflow.ts +67 -5
- package/ts/integrations/pioneer/pioneer.classes.integration.ts +225 -11
- package/ts/integrations/pioneer/pioneer.discovery.ts +45 -3
- package/ts/integrations/pioneer/pioneer.mapper.ts +57 -13
- package/ts/integrations/pioneer/pioneer.types.ts +87 -85
- package/ts/integrations/pioneer/pioneer.validation.ts +84 -0
- package/ts/integrations/soundtouch/soundtouch.classes.client.ts +152 -571
- package/ts/integrations/soundtouch/soundtouch.classes.configflow.ts +47 -42
- package/ts/integrations/soundtouch/soundtouch.classes.integration.ts +95 -150
- package/ts/integrations/soundtouch/soundtouch.discovery.ts +21 -133
- package/ts/integrations/soundtouch/soundtouch.mapper.ts +36 -207
- package/ts/integrations/soundtouch/soundtouch.types.ts +50 -195
- package/ts/integrations/soundtouch/soundtouch.validation.ts +60 -0
- package/ts/integrations/wiz/index.ts +1 -0
- package/ts/integrations/wiz/wiz.classes.client.ts +84 -254
- package/ts/integrations/wiz/wiz.classes.configflow.ts +39 -70
- package/ts/integrations/wiz/wiz.classes.integration.ts +189 -45
- package/ts/integrations/wiz/wiz.discovery.ts +48 -291
- package/ts/integrations/wiz/wiz.mapper.ts +81 -754
- package/ts/integrations/wiz/wiz.types.ts +24 -224
- package/ts/integrations/wiz/wiz.validation.ts +73 -0
- package/ts/integrations/yamaha/index.ts +1 -0
- package/ts/integrations/yamaha/yamaha.classes.client.ts +150 -6
- package/ts/integrations/yamaha/yamaha.classes.configflow.ts +100 -5
- package/ts/integrations/yamaha/yamaha.classes.integration.ts +236 -8
- package/ts/integrations/yamaha/yamaha.discovery.ts +52 -3
- package/ts/integrations/yamaha/yamaha.mapper.ts +65 -13
- package/ts/integrations/yamaha/yamaha.types.ts +77 -97
- package/ts/integrations/yamaha/yamaha.validation.ts +86 -0
|
@@ -1,9 +1,71 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IConfigFlow, INativeConfigFlowContext, IConfigFlowStep, IDiscoveryCandidate } from '../../core/types.js';
|
|
2
|
+
import type { INativeAdmissionContext } from '../../core/classes.nativehomeadmission.js';
|
|
3
|
+
import { NativeIntegrationOwner, NativeIntegrationScope, type INativeIntegrationOwnerOptions } from '../../core/classes.nativeintegrationowner.js';
|
|
2
4
|
import type { IPioneerConfig } from './pioneer.types.js';
|
|
3
|
-
import {
|
|
5
|
+
import { PioneerClient } from './pioneer.classes.client.js';
|
|
6
|
+
import { normalizePioneerConfig, pioneerConfigKeys, pioneerRecord } from './pioneer.validation.js';
|
|
4
7
|
|
|
5
|
-
export class PioneerConfigFlow
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
export class PioneerConfigFlow implements IConfigFlow<IPioneerConfig> {
|
|
9
|
+
private readonly owner?: NativeIntegrationOwner;
|
|
10
|
+
private readonly scope: NativeIntegrationScope;
|
|
11
|
+
|
|
12
|
+
public constructor(options: INativeIntegrationOwnerOptions | NativeIntegrationScope = {}) {
|
|
13
|
+
if (options instanceof NativeIntegrationScope) this.scope = options;
|
|
14
|
+
else {
|
|
15
|
+
this.owner = new NativeIntegrationOwner('pioneer', options);
|
|
16
|
+
this.scope = this.owner.createFlowScope();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public async start(input: IDiscoveryCandidate, context: INativeConfigFlowContext): Promise<IConfigFlowStep<IPioneerConfig>> {
|
|
21
|
+
const candidate = pioneerRecord(input);
|
|
22
|
+
if (candidate.integrationDomain !== 'pioneer') return { kind: 'error', error: 'Candidate does not belong to Pioneer.' };
|
|
23
|
+
const metadata = candidate.metadata === undefined ? {} : pioneerRecord(candidate.metadata);
|
|
24
|
+
const hints = Object.freeze({ host: candidate.host, expectedUdn: candidate.id, model: candidate.model, descriptionUrl: metadata.descriptionUrl });
|
|
25
|
+
const captured = this.scope.admit(context);
|
|
26
|
+
return {
|
|
27
|
+
kind: 'form', title: 'Connect selected Pioneer SC-95 receiver',
|
|
28
|
+
description: 'The host selects the owning home. Confirm the private IPv4, UPnP identity and raw owner volume ceiling. HTTP/TCP identity is unauthenticated LAN consistency. Network Standby must already be enabled when needed.',
|
|
29
|
+
fields: [
|
|
30
|
+
{ name: 'host', label: 'Selected receiver IPv4', type: 'text', required: true },
|
|
31
|
+
{ name: 'descriptionUrl', label: 'Selected UPnP description URL', type: 'text', required: true },
|
|
32
|
+
{ name: 'expectedUdn', label: 'Expected UPnP UDN', type: 'text', required: true },
|
|
33
|
+
{ name: 'model', label: 'Documented model', type: 'select', required: true, options: [{ label: 'SC-95', value: 'SC-95' }] },
|
|
34
|
+
{ name: 'allowUnencryptedLan', label: 'Allow plaintext LAN control', type: 'boolean', required: true },
|
|
35
|
+
{ name: 'maximumVolumeRaw', label: 'Owner maximum raw volume (0–185)', type: 'number', required: true },
|
|
36
|
+
{ name: 'name', label: 'Display name', type: 'text' },
|
|
37
|
+
],
|
|
38
|
+
submit: (values) => this.submit(hints, values, captured),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public destroy(): Promise<void> { return this.owner ? this.owner.close() : this.scope.close(); }
|
|
43
|
+
public retryCleanup(): Promise<void> { return this.owner ? this.owner.retryCleanup() : this.scope.retryCleanup(); }
|
|
44
|
+
|
|
45
|
+
private async submit(hints: Readonly<Record<string, unknown>>, input: unknown,
|
|
46
|
+
context: INativeAdmissionContext): Promise<IConfigFlowStep<IPioneerConfig>> {
|
|
47
|
+
this.scope.admit(context);
|
|
48
|
+
try {
|
|
49
|
+
const values = pioneerRecord(input, pioneerConfigKeys);
|
|
50
|
+
if (values.homeId !== undefined && values.homeId !== context.homeId) throw new Error('Pioneer form home conflicts with the host-selected home.');
|
|
51
|
+
const config = normalizePioneerConfig({ ...hints, ...values, homeId: context.homeId });
|
|
52
|
+
return await this.scope.run(context, config.homeId, async (lease) => {
|
|
53
|
+
const client = new PioneerClient(config, lease.context);
|
|
54
|
+
let cleanupStarted = false;
|
|
55
|
+
lease.own(() => {
|
|
56
|
+
const retry = cleanupStarted;
|
|
57
|
+
cleanupStarted = true;
|
|
58
|
+
return retry ? client.retryCleanup() : client.destroy();
|
|
59
|
+
});
|
|
60
|
+
await client.start(lease.signal);
|
|
61
|
+
lease.assertOpen();
|
|
62
|
+
return { kind: 'done', title: 'Selected receiver admitted', config };
|
|
63
|
+
});
|
|
64
|
+
} catch (error) {
|
|
65
|
+
// Cleanup failures remain actionable; the shared owner retains their handles for explicit retry.
|
|
66
|
+
if (error instanceof AggregateError) throw error;
|
|
67
|
+
this.scope.admit(context);
|
|
68
|
+
return { kind: 'error', title: 'Pioneer admission failed', error: 'Confirm exact home scope, SC-95 model, private IPv4 and UPnP identity, readable receiver settings and explicit raw owner volume ceiling.' };
|
|
69
|
+
}
|
|
8
70
|
}
|
|
9
71
|
}
|
|
@@ -1,23 +1,237 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as plugins from '../../plugins.js';
|
|
2
|
+
import { BaseIntegration } from '../../core/classes.baseintegration.js';
|
|
3
|
+
import type { IDeviceFeatureWriteRequest, IIntegrationEntity, IIntegrationEvent, IIntegrationRuntime, INativeIntegrationSetupContext, IServiceCallRequest, IServiceCallResult } from '../../core/types.js';
|
|
4
|
+
import { NativeIntegrationOwner, type INativeIntegrationOwnerOptions, type INativeSetupLease } from '../../core/classes.nativeintegrationowner.js';
|
|
2
5
|
import { PioneerClient } from './pioneer.classes.client.js';
|
|
3
6
|
import { PioneerConfigFlow } from './pioneer.classes.configflow.js';
|
|
4
7
|
import { createPioneerDiscoveryDescriptor } from './pioneer.discovery.js';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
8
|
+
import { PioneerMapper } from './pioneer.mapper.js';
|
|
9
|
+
import { normalizePioneerConfig, pioneerRecord, validatePioneerControl } from './pioneer.validation.js';
|
|
10
|
+
import type { IPioneerConfig, IPioneerSnapshot, TPioneerControl } from './pioneer.types.js';
|
|
11
|
+
import { pioneerProfile } from './pioneer.types.js';
|
|
7
12
|
|
|
8
|
-
export class PioneerIntegration extends
|
|
9
|
-
public readonly domain =
|
|
13
|
+
export class PioneerIntegration extends BaseIntegration<IPioneerConfig> {
|
|
14
|
+
public readonly domain = 'pioneer';
|
|
15
|
+
public readonly displayName = 'Pioneer selected SC-95 receiver';
|
|
16
|
+
public readonly status = 'control-runtime' as const;
|
|
10
17
|
public readonly discoveryDescriptor = createPioneerDiscoveryDescriptor();
|
|
11
|
-
public readonly configFlow
|
|
18
|
+
public readonly configFlow: PioneerConfigFlow;
|
|
19
|
+
public readonly metadata = pioneerProfile.metadata;
|
|
20
|
+
private readonly owner: NativeIntegrationOwner;
|
|
12
21
|
|
|
13
|
-
constructor() {
|
|
14
|
-
super(
|
|
22
|
+
public constructor(options: INativeIntegrationOwnerOptions = {}) {
|
|
23
|
+
super();
|
|
24
|
+
this.owner = new NativeIntegrationOwner('pioneer', options);
|
|
25
|
+
this.configFlow = new PioneerConfigFlow(this.owner.createFlowScope());
|
|
15
26
|
}
|
|
16
27
|
|
|
17
|
-
public
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
public setup(input: IPioneerConfig, context: INativeIntegrationSetupContext): Promise<IIntegrationRuntime> {
|
|
29
|
+
try {
|
|
30
|
+
const config = normalizePioneerConfig(input);
|
|
31
|
+
return this.owner.runSetup(context, config.homeId, async (lease) => {
|
|
32
|
+
const client = new PioneerClient(config, lease.context);
|
|
33
|
+
let runtime: PioneerRuntime | undefined;
|
|
34
|
+
let cleanupStarted = false;
|
|
35
|
+
lease.own(() => {
|
|
36
|
+
const retry = cleanupStarted;
|
|
37
|
+
cleanupStarted = true;
|
|
38
|
+
return runtime ? runtime.cleanupResources(retry) : retry ? client.retryCleanup() : client.destroy();
|
|
39
|
+
});
|
|
40
|
+
const initial = await client.start(lease.signal);
|
|
41
|
+
lease.assertOpen();
|
|
42
|
+
runtime = new PioneerRuntime(client, initial, lease);
|
|
43
|
+
lease.promoteToRuntime();
|
|
44
|
+
return runtime;
|
|
45
|
+
});
|
|
46
|
+
} catch (error) { return Promise.reject(error); }
|
|
20
47
|
}
|
|
48
|
+
|
|
49
|
+
public destroy(): Promise<void> { return this.owner.close(); }
|
|
50
|
+
public retryCleanup(): Promise<void> { return this.owner.retryCleanup(); }
|
|
21
51
|
}
|
|
22
52
|
|
|
23
53
|
export class HomeAssistantPioneerIntegration extends PioneerIntegration {}
|
|
54
|
+
|
|
55
|
+
interface IPioneerSubscription {
|
|
56
|
+
handler: (event: IIntegrationEvent) => void;
|
|
57
|
+
readonly callbacks: Set<Promise<void>>;
|
|
58
|
+
active: boolean;
|
|
59
|
+
failure?: unknown;
|
|
60
|
+
failed: boolean;
|
|
61
|
+
detach(): void;
|
|
62
|
+
stop(): Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
class PioneerRuntime implements IIntegrationRuntime {
|
|
66
|
+
public readonly domain = 'pioneer';
|
|
67
|
+
private readonly subscriptions = new Set<IPioneerSubscription>();
|
|
68
|
+
private readonly parentAbort: () => void;
|
|
69
|
+
private closePromise?: Promise<void>;
|
|
70
|
+
private cleanupPromise?: Promise<void>;
|
|
71
|
+
private closed = false;
|
|
72
|
+
|
|
73
|
+
public constructor(private readonly client: PioneerClient, private snapshot: IPioneerSnapshot,
|
|
74
|
+
private readonly lease: INativeSetupLease) {
|
|
75
|
+
// The lease retains the client and callbacks until cleanup succeeds, including explicit retries.
|
|
76
|
+
this.parentAbort = () => { void this.destroy().catch(() => {}); };
|
|
77
|
+
lease.signal.addEventListener('abort', this.parentAbort, { once: true });
|
|
78
|
+
if (lease.signal.aborted) this.parentAbort();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public isHealthy(): boolean { return !this.closed && this.client.isHealthy(); }
|
|
82
|
+
|
|
83
|
+
public async devices(signal?: AbortSignal): Promise<plugins.shxInterfaces.data.IDeviceDefinition[]> {
|
|
84
|
+
this.assertOpen();
|
|
85
|
+
const snapshot = await this.client.getSnapshot(signal);
|
|
86
|
+
this.publish(snapshot);
|
|
87
|
+
return PioneerMapper.toDevices(snapshot);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
public async entities(): Promise<IIntegrationEntity[]> {
|
|
91
|
+
this.assertOpen();
|
|
92
|
+
const snapshot = await this.client.getSnapshot();
|
|
93
|
+
this.publish(snapshot);
|
|
94
|
+
return PioneerMapper.toEntities(snapshot);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public async writeFeature(input: IDeviceFeatureWriteRequest, signal?: AbortSignal): Promise<IServiceCallResult> {
|
|
98
|
+
this.assertOpen();
|
|
99
|
+
const request = pioneerRecord(input, ['device', 'feature', 'value']);
|
|
100
|
+
const device = pioneerRecord(request.device);
|
|
101
|
+
const feature = pioneerRecord(request.feature);
|
|
102
|
+
const canonical = PioneerMapper.toDevices(this.snapshot)[0];
|
|
103
|
+
if (device.id !== canonical.id || device.integrationDomain !== this.domain) throw new Error('Pioneer feature target is outside the selected home and receiver.');
|
|
104
|
+
const admitted = canonical.features.find((entry) => entry.id === feature.id);
|
|
105
|
+
if (!admitted?.writable || feature.capability !== admitted.capability) throw new Error('Pioneer feature is not writable for the selected receiver.');
|
|
106
|
+
return this.control(validatePioneerControl({ feature: admitted.id, value: request.value }), signal);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
public async callService(input: IServiceCallRequest): Promise<IServiceCallResult> {
|
|
110
|
+
this.assertOpen();
|
|
111
|
+
const request = pioneerRecord(input, ['domain', 'service', 'target', 'data']);
|
|
112
|
+
const target = pioneerRecord(request.target, ['deviceId', 'entityId']);
|
|
113
|
+
const deviceId = PioneerMapper.deviceId(this.snapshot.homeId, this.snapshot.identity.udn);
|
|
114
|
+
const entityId = PioneerMapper.entityId(this.snapshot.homeId, this.snapshot.identity.udn);
|
|
115
|
+
if ((!target.deviceId && !target.entityId) || (target.deviceId !== undefined && target.deviceId !== deviceId)
|
|
116
|
+
|| (target.entityId !== undefined && target.entityId !== entityId)) throw new Error('Pioneer service target is outside the selected home and receiver.');
|
|
117
|
+
if (request.domain !== 'media_player') throw new Error('Pioneer services use media_player.');
|
|
118
|
+
let control: TPioneerControl;
|
|
119
|
+
if (request.service === 'turn_on' || request.service === 'turn_off') {
|
|
120
|
+
pioneerRecord(request.data ?? {}, []);
|
|
121
|
+
control = { feature: 'power', value: request.service === 'turn_on' };
|
|
122
|
+
} else if (request.service === 'set_volume_raw') {
|
|
123
|
+
const data = pioneerRecord(request.data, ['volume_raw']);
|
|
124
|
+
control = validatePioneerControl({ feature: 'volume_raw', value: data.volume_raw });
|
|
125
|
+
} else if (request.service === 'volume_mute') {
|
|
126
|
+
const data = pioneerRecord(request.data, ['is_volume_muted']);
|
|
127
|
+
control = validatePioneerControl({ feature: 'muted', value: data.is_volume_muted });
|
|
128
|
+
} else if (request.service === 'select_source') {
|
|
129
|
+
const data = pioneerRecord(request.data, ['source']);
|
|
130
|
+
control = validatePioneerControl({ feature: 'input', value: data.source });
|
|
131
|
+
} else throw new Error('Pioneer supports explicit power, mute, raw integer volume and observed physical input controls only.');
|
|
132
|
+
return this.control(control);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Emits completed observations only, with no background polling or unsolicited-event claim. */
|
|
136
|
+
public async subscribe(handler: (event: IIntegrationEvent) => void, signal?: AbortSignal): Promise<() => Promise<void>> {
|
|
137
|
+
this.assertOpen();
|
|
138
|
+
if (typeof handler !== 'function' || (signal !== undefined && !(signal instanceof AbortSignal))) throw new TypeError('Pioneer subscription requires a callback and optional AbortSignal.');
|
|
139
|
+
signal?.throwIfAborted();
|
|
140
|
+
if (this.subscriptions.size >= 32) throw new Error('Pioneer subscription capacity reached.');
|
|
141
|
+
const subscription: IPioneerSubscription = {
|
|
142
|
+
handler, callbacks: new Set(), active: true, failed: false,
|
|
143
|
+
detach: () => { subscription.active = false; signal?.removeEventListener('abort', aborted); },
|
|
144
|
+
stop: async () => {
|
|
145
|
+
subscription.detach();
|
|
146
|
+
await Promise.all([...subscription.callbacks]);
|
|
147
|
+
this.subscriptions.delete(subscription);
|
|
148
|
+
if (subscription.failed) throw subscription.failure;
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
const aborted = () => {
|
|
152
|
+
subscription.detach();
|
|
153
|
+
// Allow the current invocation and its tracked callback to settle before automatic removal.
|
|
154
|
+
void Promise.resolve().then(async () => {
|
|
155
|
+
await Promise.all([...subscription.callbacks]);
|
|
156
|
+
if (!subscription.failed) this.subscriptions.delete(subscription);
|
|
157
|
+
});
|
|
158
|
+
};
|
|
159
|
+
signal?.addEventListener('abort', aborted, { once: true });
|
|
160
|
+
this.subscriptions.add(subscription);
|
|
161
|
+
if (signal?.aborted) aborted();
|
|
162
|
+
return subscription.stop;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
public destroy(): Promise<void> {
|
|
166
|
+
if (!this.closePromise) {
|
|
167
|
+
this.closed = true;
|
|
168
|
+
this.closePromise = Promise.resolve().then(() => this.lease.close());
|
|
169
|
+
}
|
|
170
|
+
return this.closePromise;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
public cleanupResources(retry = false): Promise<void> {
|
|
174
|
+
if (retry) this.cleanupPromise = undefined;
|
|
175
|
+
if (!this.cleanupPromise) {
|
|
176
|
+
this.closed = true;
|
|
177
|
+
this.cleanupPromise = Promise.resolve().then(async () => {
|
|
178
|
+
const results = await Promise.allSettled([retry ? this.client.retryCleanup() : this.client.destroy(),
|
|
179
|
+
...[...this.subscriptions].map((subscription) => subscription.stop())]);
|
|
180
|
+
const failures = results.filter((result): result is PromiseRejectedResult => result.status === 'rejected');
|
|
181
|
+
if (failures.length) throw new AggregateError(failures.map((result) => result.reason as unknown), 'Pioneer runtime cleanup failed.');
|
|
182
|
+
});
|
|
183
|
+
this.lease.signal.removeEventListener('abort', this.parentAbort);
|
|
184
|
+
for (const subscription of this.subscriptions) subscription.detach();
|
|
185
|
+
}
|
|
186
|
+
return this.cleanupPromise;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
private async control(control: TPioneerControl, signal?: AbortSignal): Promise<IServiceCallResult> {
|
|
190
|
+
try {
|
|
191
|
+
const result = await this.client.setControl(control, signal);
|
|
192
|
+
try { this.publish(result.snapshot); }
|
|
193
|
+
catch { return { success: false, error: 'Pioneer was closed after dispatch; its effect is indeterminate.',
|
|
194
|
+
data: { dispatch: result.dispatch, effectOutcome: 'indeterminate', commandAcknowledged: false, causalityConfirmed: false } }; }
|
|
195
|
+
return { success: result.outcome === 'observed-target', data: { dispatch: result.dispatch, effectOutcome: result.outcome,
|
|
196
|
+
commandAcknowledged: result.commandAcknowledged, causalityConfirmed: result.causalityConfirmed } };
|
|
197
|
+
} catch (error) {
|
|
198
|
+
return { success: false, error: 'Pioneer control was refused or its observation could not be reconciled.',
|
|
199
|
+
data: { effectOutcome: error instanceof plugins.ecobridgeDeviceManager.PioneerProtocolError ? error.effectOutcome : 'not-sent',
|
|
200
|
+
commandAcknowledged: false, causalityConfirmed: false } };
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
private publish(snapshot: IPioneerSnapshot): void {
|
|
205
|
+
this.assertOpen(); this.snapshot = snapshot;
|
|
206
|
+
for (const subscription of this.subscriptions) {
|
|
207
|
+
if (!subscription.active) continue;
|
|
208
|
+
if (subscription.callbacks.size >= this.client.config.maxPendingOperations) {
|
|
209
|
+
subscription.failed = true;
|
|
210
|
+
subscription.failure = new Error('Pioneer observation callback capacity reached.');
|
|
211
|
+
subscription.detach();
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
let complete: () => void = () => {};
|
|
215
|
+
let fail: (error: unknown) => void = () => {};
|
|
216
|
+
const invoked = new Promise<void>((resolve, reject) => { complete = resolve; fail = reject; });
|
|
217
|
+
const callback = invoked.catch((error: unknown) => {
|
|
218
|
+
subscription.failed = true; subscription.failure = error; subscription.detach();
|
|
219
|
+
}).finally(() => subscription.callbacks.delete(callback));
|
|
220
|
+
// Register before user code can synchronously abort or destroy its owner.
|
|
221
|
+
subscription.callbacks.add(callback);
|
|
222
|
+
try {
|
|
223
|
+
const returned: unknown = subscription.handler({ type: 'state_changed', integrationDomain: this.domain,
|
|
224
|
+
deviceId: PioneerMapper.deviceId(snapshot.homeId, snapshot.identity.udn),
|
|
225
|
+
entityId: PioneerMapper.entityId(snapshot.homeId, snapshot.identity.udn),
|
|
226
|
+
data: { snapshot: structuredClone(snapshot), source: 'completed-receiver-observation' }, timestamp: Date.now() });
|
|
227
|
+
void Promise.resolve(returned).then(complete, fail);
|
|
228
|
+
} catch (error) { fail(error); }
|
|
229
|
+
}
|
|
230
|
+
this.assertOpen();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
private assertOpen(): void {
|
|
234
|
+
if (this.closed) throw new Error('Pioneer runtime is closed.');
|
|
235
|
+
this.lease.assertOpen();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
@@ -1,4 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { DiscoveryDescriptor } from '../../core/classes.discoverydescriptor.js';
|
|
2
|
+
import type { IDiscoveryCandidate, IDiscoveryMatch, IDiscoveryMatcher, IDiscoveryValidator } from '../../core/types.js';
|
|
3
|
+
import type { IPioneerManualEntry } from './pioneer.types.js';
|
|
4
|
+
import { pioneerDescription, pioneerHost, pioneerRecord, pioneerText, pioneerUdn } from './pioneer.validation.js';
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
const miss = (reason: string): IDiscoveryMatch => ({ matched: false, confidence: 'low', reason });
|
|
7
|
+
|
|
8
|
+
export class PioneerManualMatcher implements IDiscoveryMatcher<IPioneerManualEntry> {
|
|
9
|
+
public readonly id = 'pioneer-manual-match';
|
|
10
|
+
public readonly source = 'manual' as const;
|
|
11
|
+
public readonly description = 'Selected SC-95 descriptor setup hints; native admission reads fresh identity.';
|
|
12
|
+
|
|
13
|
+
public async matches(input: IPioneerManualEntry): Promise<IDiscoveryMatch> {
|
|
14
|
+
try {
|
|
15
|
+
const record = pioneerRecord(input, ['source', 'integrationDomain', 'host', 'descriptionUrl', 'expectedUdn', 'id', 'name', 'manufacturer', 'model', 'metadata']);
|
|
16
|
+
if (record.source !== undefined && record.source !== 'manual') return miss('Only selected manual endpoint hints are supported.');
|
|
17
|
+
if (record.integrationDomain !== undefined && record.integrationDomain !== 'pioneer') return miss('Foreign integration hint.');
|
|
18
|
+
const metadata = record.metadata === undefined ? {} : pioneerRecord(record.metadata, ['descriptionUrl', 'identityEvidence']);
|
|
19
|
+
const host = pioneerHost(record.host);
|
|
20
|
+
const descriptionUrl = pioneerDescription(record.descriptionUrl ?? metadata.descriptionUrl, host);
|
|
21
|
+
const id = pioneerUdn(record.expectedUdn ?? record.id);
|
|
22
|
+
if (record.expectedUdn !== undefined && record.id !== undefined && pioneerUdn(record.expectedUdn) !== pioneerUdn(record.id)) return miss('Manual receiver identities conflict.');
|
|
23
|
+
if (record.model !== 'SC-95') return miss('Model has no selected vendor profile.');
|
|
24
|
+
if (record.manufacturer !== undefined && record.manufacturer !== 'Pioneer') return miss('Manufacturer does not match the selected profile.');
|
|
25
|
+
const name = record.name === undefined ? undefined : pioneerText(record.name, 'name', 128);
|
|
26
|
+
return { matched: true, confidence: 'medium', reason: 'Selected SC-95 setup hint; fresh UPnP and receiver state are required for native admission.',
|
|
27
|
+
normalizedDeviceId: id, candidate: { source: 'manual', integrationDomain: 'pioneer', id, host, name, manufacturer: 'Pioneer', model: 'SC-95',
|
|
28
|
+
metadata: { descriptionUrl, identityEvidence: 'unauthenticated-discovery-hint' } } };
|
|
29
|
+
} catch { return miss('Manual setup requires the selected SC-95 model, private endpoint, descriptor URL and exact UDN.'); }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export class PioneerCandidateValidator implements IDiscoveryValidator {
|
|
34
|
+
public readonly id = 'pioneer-candidate-validator';
|
|
35
|
+
public async validate(input: IDiscoveryCandidate): Promise<IDiscoveryMatch> {
|
|
36
|
+
try {
|
|
37
|
+
const record = pioneerRecord(input);
|
|
38
|
+
if (record.integrationDomain !== 'pioneer' || record.source !== 'manual') return miss('Candidate does not belong to selected Pioneer discovery.');
|
|
39
|
+
return new PioneerManualMatcher().matches(input);
|
|
40
|
+
} catch { return miss('Candidate must be a plain selected Pioneer record.'); }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const createPioneerDiscoveryDescriptor = (): DiscoveryDescriptor =>
|
|
45
|
+
new DiscoveryDescriptor({ integrationDomain: 'pioneer', displayName: 'Pioneer selected SC-95 receiver' })
|
|
46
|
+
.addMatcher(new PioneerManualMatcher()).addValidator(new PioneerCandidateValidator());
|
|
@@ -1,26 +1,70 @@
|
|
|
1
|
-
import type * as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import type * as plugins from '../../plugins.js';
|
|
2
|
+
import type { IIntegrationEntity } from '../../core/types.js';
|
|
3
|
+
import { SimpleLocalMapper } from '../../core/classes.simplelocalintegration.js';
|
|
4
|
+
import type { IPioneerOfflineConfig, IPioneerOfflineSnapshot, IPioneerSnapshot, TPioneerRawData } from './pioneer.types.js';
|
|
4
5
|
import { pioneerProfile } from './pioneer.types.js';
|
|
5
6
|
|
|
6
7
|
export class PioneerMapper {
|
|
7
|
-
public static
|
|
8
|
-
return
|
|
8
|
+
public static deviceId(homeId: string, udn: string): string {
|
|
9
|
+
return `pioneer.receiver.${encodeURIComponent(homeId)}.${encodeURIComponent(udn)}`;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
public static
|
|
12
|
-
return
|
|
12
|
+
public static entityId(homeId: string, udn: string): string {
|
|
13
|
+
return `media_player.pioneer.${encodeURIComponent(homeId)}.${encodeURIComponent(udn)}`;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
public static toDevices(
|
|
16
|
-
return
|
|
16
|
+
public static toDevices(snapshot: IPioneerSnapshot): plugins.shxInterfaces.data.IDeviceDefinition[] {
|
|
17
|
+
return [{
|
|
18
|
+
id: this.deviceId(snapshot.homeId, snapshot.identity.udn), integrationDomain: 'pioneer', name: snapshot.name,
|
|
19
|
+
protocol: 'tcp', manufacturer: snapshot.identity.manufacturer, model: snapshot.identity.model, online: true,
|
|
20
|
+
features: [
|
|
21
|
+
{ id: 'power', capability: 'media', name: 'Main-zone power', readable: true, writable: true },
|
|
22
|
+
{ id: 'muted', capability: 'media', name: 'Main-zone mute', readable: true, writable: true },
|
|
23
|
+
{ id: 'volume_raw', capability: 'media', name: 'Main-zone raw volume', unit: 'raw', readable: true, writable: true },
|
|
24
|
+
{ id: 'input', capability: 'media', name: 'Main-zone physical input', readable: true, writable: snapshot.observedInputs.length > 0 },
|
|
25
|
+
],
|
|
26
|
+
state: [
|
|
27
|
+
{ featureId: 'power', value: snapshot.power, updatedAt: snapshot.observedAt },
|
|
28
|
+
{ featureId: 'muted', value: snapshot.muted, updatedAt: snapshot.observedAt },
|
|
29
|
+
{ featureId: 'volume_raw', value: snapshot.volumeRaw, updatedAt: snapshot.observedAt },
|
|
30
|
+
{ featureId: 'input', value: snapshot.inputId, updatedAt: snapshot.observedAt },
|
|
31
|
+
],
|
|
32
|
+
metadata: { homeId: snapshot.homeId, udn: snapshot.identity.udn, host: snapshot.host, port: snapshot.port,
|
|
33
|
+
serialNumber: snapshot.identity.serialNumber, zone: 'main', observedInputs: [...snapshot.observedInputs],
|
|
34
|
+
maximumVolumeRaw: snapshot.maximumVolumeRaw, minimumVolumeRaw: 0, maximumReceiverVolumeRaw: 185,
|
|
35
|
+
identitySource: snapshot.identity.source, identityTrust: snapshot.identity.trust,
|
|
36
|
+
stateSource: 'receiver-observation', commandAcknowledged: false, causalityConfirmed: false },
|
|
37
|
+
}];
|
|
17
38
|
}
|
|
18
39
|
|
|
19
|
-
public static toEntities(
|
|
20
|
-
return
|
|
40
|
+
public static toEntities(snapshot: IPioneerSnapshot): IIntegrationEntity[] {
|
|
41
|
+
return [{
|
|
42
|
+
id: this.entityId(snapshot.homeId, snapshot.identity.udn), uniqueId: this.deviceId(snapshot.homeId, snapshot.identity.udn),
|
|
43
|
+
integrationDomain: 'pioneer', deviceId: this.deviceId(snapshot.homeId, snapshot.identity.udn), platform: 'media_player',
|
|
44
|
+
name: snapshot.name, state: snapshot.power ? 'on' : 'off', available: true,
|
|
45
|
+
attributes: { homeId: snapshot.homeId, udn: snapshot.identity.udn, zone: 'main', power: snapshot.power,
|
|
46
|
+
volumeRaw: snapshot.volumeRaw, muted: snapshot.muted, source: snapshot.inputId,
|
|
47
|
+
observedInputs: [...snapshot.observedInputs], maximumVolumeRaw: snapshot.maximumVolumeRaw,
|
|
48
|
+
observedAt: snapshot.observedAt, stateSource: 'receiver-observation', identityTrust: snapshot.identity.trust,
|
|
49
|
+
commandAcknowledged: false, causalityConfirmed: false },
|
|
50
|
+
}];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Explicitly offline transformation; this helper never creates or admits a native runtime. */
|
|
55
|
+
export class PioneerOfflineMapper {
|
|
56
|
+
public static toSnapshotFromRaw(config: IPioneerOfflineConfig, rawData: TPioneerRawData): IPioneerOfflineSnapshot {
|
|
57
|
+
return this.offline(SimpleLocalMapper.toSnapshot({ profile: pioneerProfile, config: { ...config }, rawData, online: false, source: 'manual' }));
|
|
58
|
+
}
|
|
59
|
+
public static toDevices(snapshot: IPioneerOfflineSnapshot): plugins.shxInterfaces.data.IDeviceDefinition[] {
|
|
60
|
+
return SimpleLocalMapper.toDevices(pioneerProfile, this.offline(snapshot));
|
|
61
|
+
}
|
|
62
|
+
public static toEntities(snapshot: IPioneerOfflineSnapshot): IIntegrationEntity[] {
|
|
63
|
+
return SimpleLocalMapper.toEntities(pioneerProfile, this.offline(snapshot));
|
|
21
64
|
}
|
|
22
65
|
|
|
23
|
-
|
|
24
|
-
return
|
|
66
|
+
private static offline(snapshot: IPioneerOfflineSnapshot): IPioneerOfflineSnapshot {
|
|
67
|
+
return { ...snapshot, online: false, capabilities: { localRead: true, localControl: false, liveControlRequiresExecutor: false },
|
|
68
|
+
entities: snapshot.entities.map((entity) => ({ ...entity, available: false, writable: false })) };
|
|
25
69
|
}
|
|
26
70
|
}
|
|
@@ -1,97 +1,99 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ISimpleLocalIntegrationProfile, ISimpleLocalSnapshot, TSimpleLocalRawData } from '../../core/classes.simplelocalintegration.js';
|
|
2
2
|
|
|
3
|
-
export const pioneerDomain =
|
|
4
|
-
export const pioneerDefaultName =
|
|
3
|
+
export const pioneerDomain = 'pioneer';
|
|
4
|
+
export const pioneerDefaultName = 'Pioneer';
|
|
5
5
|
export const pioneerDefaultPort = 23;
|
|
6
6
|
export const pioneerMaxVolume = 185;
|
|
7
|
-
export
|
|
7
|
+
export type TPioneerModel = 'SC-95';
|
|
8
8
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
export interface IPioneerConfig {
|
|
10
|
+
homeId: string;
|
|
11
|
+
host: string;
|
|
12
|
+
descriptionUrl: string;
|
|
13
|
+
expectedUdn: string;
|
|
14
|
+
model: TPioneerModel;
|
|
15
|
+
allowUnencryptedLan: true;
|
|
16
|
+
maximumVolumeRaw: number;
|
|
17
|
+
name?: string;
|
|
18
|
+
port?: number;
|
|
19
|
+
timeoutMs?: number;
|
|
20
|
+
maxPendingOperations?: number;
|
|
21
|
+
maxDescriptionBytes?: number;
|
|
22
|
+
maxFrameBytes?: number;
|
|
18
23
|
}
|
|
19
24
|
export interface IHomeAssistantPioneerConfig extends IPioneerConfig {}
|
|
20
25
|
|
|
26
|
+
export interface IPioneerIdentity {
|
|
27
|
+
readonly udn: string;
|
|
28
|
+
readonly model: TPioneerModel;
|
|
29
|
+
readonly manufacturer: 'Pioneer';
|
|
30
|
+
readonly reportedManufacturer: string;
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly serialNumber?: string;
|
|
33
|
+
readonly source: 'selected-upnp-description';
|
|
34
|
+
readonly trust: 'unauthenticated-lan';
|
|
35
|
+
readonly observedAt: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface IPioneerSnapshot {
|
|
39
|
+
readonly homeId: string;
|
|
40
|
+
readonly host: string;
|
|
41
|
+
readonly port: number;
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly identity: IPioneerIdentity;
|
|
44
|
+
readonly power: boolean;
|
|
45
|
+
readonly muted: boolean;
|
|
46
|
+
readonly volumeRaw: number;
|
|
47
|
+
readonly inputId: string;
|
|
48
|
+
readonly observedInputs: readonly string[];
|
|
49
|
+
readonly maximumVolumeRaw: number;
|
|
50
|
+
readonly observedAt: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type TPioneerControl =
|
|
54
|
+
| { feature: 'power'; value: boolean }
|
|
55
|
+
| { feature: 'muted'; value: boolean }
|
|
56
|
+
| { feature: 'volume_raw'; value: number }
|
|
57
|
+
| { feature: 'input'; value: string };
|
|
58
|
+
|
|
59
|
+
export interface IPioneerEffectResult {
|
|
60
|
+
readonly dispatch: 'written';
|
|
61
|
+
readonly outcome: 'observed-target' | 'indeterminate';
|
|
62
|
+
readonly commandAcknowledged: false;
|
|
63
|
+
readonly causalityConfirmed: false;
|
|
64
|
+
readonly snapshot: IPioneerSnapshot;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface IPioneerManualEntry {
|
|
68
|
+
host?: string;
|
|
69
|
+
descriptionUrl?: string;
|
|
70
|
+
expectedUdn?: string;
|
|
71
|
+
id?: string;
|
|
72
|
+
name?: string;
|
|
73
|
+
manufacturer?: string;
|
|
74
|
+
model?: string;
|
|
75
|
+
metadata?: Record<string, unknown>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface IPioneerOfflineConfig {
|
|
79
|
+
name?: string;
|
|
80
|
+
uniqueId?: string;
|
|
81
|
+
metadata?: Record<string, unknown>;
|
|
82
|
+
}
|
|
83
|
+
export type TPioneerRawData = TSimpleLocalRawData;
|
|
84
|
+
export interface IPioneerOfflineSnapshot extends ISimpleLocalSnapshot {}
|
|
85
|
+
|
|
21
86
|
export const pioneerProfile: ISimpleLocalIntegrationProfile = {
|
|
22
|
-
domain: pioneerDomain,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
defaultPort: pioneerDefaultPort,
|
|
28
|
-
defaultProtocol: 'telnet',
|
|
29
|
-
status: "control-runtime",
|
|
30
|
-
platforms: [
|
|
31
|
-
"media_player",
|
|
32
|
-
],
|
|
33
|
-
serviceDomains: [
|
|
34
|
-
"media_player",
|
|
35
|
-
],
|
|
36
|
-
controlServices: [
|
|
37
|
-
"select_source",
|
|
38
|
-
"set_volume_level",
|
|
39
|
-
"turn_off",
|
|
40
|
-
"turn_on",
|
|
41
|
-
"volume_mute",
|
|
42
|
-
"volume_down",
|
|
43
|
-
"volume_up",
|
|
44
|
-
],
|
|
45
|
-
discoverySources: [
|
|
46
|
-
'manual',
|
|
47
|
-
'custom',
|
|
48
|
-
],
|
|
49
|
-
discoveryKeywords: [
|
|
50
|
-
"pioneer",
|
|
51
|
-
"Pioneer",
|
|
52
|
-
],
|
|
87
|
+
domain: pioneerDomain, displayName: 'Pioneer selected SC-95 receiver', manufacturer: 'Pioneer', model: 'SC-95',
|
|
88
|
+
defaultName: pioneerDefaultName, defaultPort: pioneerDefaultPort, defaultProtocol: 'tcp', status: 'control-runtime',
|
|
89
|
+
platforms: ['media_player'], serviceDomains: ['media_player'],
|
|
90
|
+
controlServices: ['turn_on', 'turn_off', 'volume_mute', 'set_volume_raw', 'select_source'], discoverySources: ['manual'],
|
|
91
|
+
discoveryKeywords: ['pioneer'],
|
|
53
92
|
metadata: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"qualityScale": "legacy",
|
|
59
|
-
"configFlow": false,
|
|
60
|
-
"requirements": [],
|
|
61
|
-
"documentation": "https://www.home-assistant.io/integrations/pioneer",
|
|
62
|
-
"runtime": {
|
|
63
|
-
"type": "control-runtime",
|
|
64
|
-
"services": [
|
|
65
|
-
"snapshot",
|
|
66
|
-
"status",
|
|
67
|
-
"refresh",
|
|
68
|
-
"select_source",
|
|
69
|
-
"set_volume_level",
|
|
70
|
-
"turn_off",
|
|
71
|
-
"turn_on",
|
|
72
|
-
"volume_mute",
|
|
73
|
-
"volume_down",
|
|
74
|
-
"volume_up",
|
|
75
|
-
],
|
|
76
|
-
"platforms": [
|
|
77
|
-
"media_player",
|
|
78
|
-
],
|
|
79
|
-
"controls": "native Pioneer telnet commands for power, mute, source, and volume; injected executors remain supported",
|
|
80
|
-
},
|
|
81
|
-
"localApi": {
|
|
82
|
-
"implemented": [
|
|
83
|
-
"native Pioneer AVR Telnet/TCP polling on port 23 using ?P, ?V, ?M, ?RGBxx, and ?F",
|
|
84
|
-
"native Pioneer AVR Telnet/TCP control using PO, PF, VU, VD, xxxVL, MO, MF, and xxFN",
|
|
85
|
-
"manual local setup for Pioneer endpoints, snapshots, rawData, snapshotProvider, and injected native clients",
|
|
86
|
-
"runtime mapping for Pioneer device snapshots and Home Assistant platform metadata",
|
|
87
|
-
"safe command delegation to injected client.execute or commandExecutor",
|
|
88
|
-
],
|
|
89
|
-
"explicitUnsupported": [
|
|
90
|
-
"Pioneer pairing, subscriptions, and event streams because the Home Assistant source only documents polling Telnet commands",
|
|
91
|
-
"media_play and media_pause because the Home Assistant Pioneer source declares features but exposes no concrete Telnet command implementation",
|
|
92
|
-
"Home Assistant entity registry migrations and repair flows",
|
|
93
|
-
"claiming write success for commands outside the documented Pioneer Telnet command set without injected client.execute or commandExecutor",
|
|
94
|
-
],
|
|
93
|
+
source: 'native-typescript', upstreamDomain: pioneerDomain, upstreamPath: 'homeassistant/components/pioneer',
|
|
94
|
+
localApi: {
|
|
95
|
+
implemented: ['selected SC-95/CUXJ main-zone protocol', 'exact home-scoped admission', 'absolute raw integer volume', 'receiver-observed physical input selection'],
|
|
96
|
+
explicitUnsupported: ['injected clients or executors', 'native runtime snapshots', 'arbitrary ASCII commands', 'toggles or relative controls', 'dB or percentage volume conversion', 'advanced zones or media playback', 'automatic retry or reconnect'],
|
|
95
97
|
},
|
|
96
98
|
},
|
|
97
99
|
};
|