v2c-any 0.3.1 → 0.4.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.
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export class EnergyInformationEM1NotifyStatusAdapter {
|
|
2
|
+
adapt(input) {
|
|
3
|
+
const em1Status = input.params['em1:1'];
|
|
4
|
+
return Promise.resolve({ power: em1Status.act_power });
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export const energyInformationEM1NotifyStatusAdapter = new EnergyInformationEM1NotifyStatusAdapter();
|
|
@@ -2,7 +2,9 @@ import { devicesAdapterRegistry, devicesProviderRegistry, } from '../../applicat
|
|
|
2
2
|
import { logger } from '../../utils/logger.js';
|
|
3
3
|
import { energyInformationEM1StatusAdapter } from './energy-information-em1-status-adapter.js';
|
|
4
4
|
import { em1StatusProviderFactory } from './em1-status-provider.js';
|
|
5
|
+
import { energyInformationEM1NotifyStatusAdapter } from './energy-information-em1-notify-status-adapter.js';
|
|
5
6
|
const DEVICE_NAME = 'shelly-pro-em';
|
|
6
7
|
devicesProviderRegistry.register(DEVICE_NAME, em1StatusProviderFactory);
|
|
7
8
|
devicesAdapterRegistry.register(DEVICE_NAME, energyInformationEM1StatusAdapter);
|
|
9
|
+
devicesAdapterRegistry.register(`${DEVICE_NAME}-notification`, energyInformationEM1NotifyStatusAdapter);
|
|
8
10
|
logger.info('Shelly Pro EM registered');
|