# Energy ## Méthodes ### Energy.GetPowerBalance PUBLIC Get the current power balance. That is, production, consumption and acquisition. **Paramètres :** _Aucun paramètre._ **Retour :** | Champ | Type | Notes | | --- | --- | --- | | `currentPowerAcquisition` | `Double` | | | `currentPowerConsumption` | `Double` | | | `currentPowerProduction` | `Double` | | | `currentPowerStorage` | `Double` | | | `totalAcquisition` | `Double` | | | `totalConsumption` | `Double` | | | `totalProduction` | `Double` | | | `totalReturn` | `Double` | | --- ### Energy.GetPowerBalanceLogs PUBLIC Get logs for the power balance. If from is not give, the log will start at the beginning of recording. If to is not given, the logs will and at the last sample for this sample rate before now. **Paramètres :** | Champ | Type | Notes | | --- | --- | --- | | `from` | `Uint` | optionnel | | `to` | `Uint` | optionnel | | `sampleRate` | [SampleRate](../types.md#samplerate) | | **Retour :** | Champ | Type | Notes | | --- | --- | --- | | `powerBalanceLogEntries` | [PowerBalanceLogEntries](../types.md#powerbalancelogentries) | | --- ### Energy.GetRootMeter PUBLIC Get the root meter ID. If there is no root meter set, the params will be empty. **Paramètres :** _Aucun paramètre._ **Retour :** | Champ | Type | Notes | | --- | --- | --- | | `rootMeterThingId` | `Uuid` | optionnel | --- ### Energy.GetThingPowerLogs PUBLIC Get logs for one or more things power values. If thingIds is not given, logs for all energy related things will be returned. If from is not given, the log will start at the beginning of recording. If to is not given, the logs will and at the last sample for this sample rate before now. If the parameter "includeCurrent" is set to true, the result will contain the newest log entries available, regardless of the sample rate (that is, 1 minute). This may be useful to calculate the difference to the newest entry of the fetched sample rate and the current values to display the live value until the current sample is completed. **Paramètres :** | Champ | Type | Notes | | --- | --- | --- | | `from` | `Uint` | optionnel | | `includeCurrent` | `Bool` | optionnel | | `thingIds` | `Uuid`[] | optionnel | | `to` | `Uint` | optionnel | | `sampleRate` | [SampleRate](../types.md#samplerate) | | **Retour :** | Champ | Type | Notes | | --- | --- | --- | | `currentEntries` | [ThingPowerLogEntries](../types.md#thingpowerlogentries) | optionnel | | `thingPowerLogEntries` | [ThingPowerLogEntries](../types.md#thingpowerlogentries) | | --- ### Energy.SetRootMeter ADMIN Set the root meter. **Paramètres :** | Champ | Type | Notes | | --- | --- | --- | | `rootMeterThingId` | `Uuid` | | **Retour :** | Champ | Type | Notes | | --- | --- | --- | | `energyError` | [EnergyError](../types.md#energyerror) | | --- ## Notifications ### Energy.PowerBalanceChanged Emitted whenever the energy balance changes. That is, when the current consumption, production or acquisition changes. Typically they will all change at the same time. **Paramètres :** | Champ | Type | Notes | | --- | --- | --- | | `currentPowerAcquisition` | `Double` | | | `currentPowerConsumption` | `Double` | | | `currentPowerProduction` | `Double` | | | `currentPowerStorage` | `Double` | | | `totalAcquisition` | `Double` | | | `totalConsumption` | `Double` | | | `totalProduction` | `Double` | | | `totalReturn` | `Double` | | --- ### Energy.PowerBalanceLogEntryAdded Emitted whenever an entry is added to the power balance log. **Paramètres :** | Champ | Type | Notes | | --- | --- | --- | | `powerBalanceLogEntry` | [PowerBalanceLogEntry](../types.md#powerbalancelogentry) | | | `sampleRate` | [SampleRate](../types.md#samplerate) | | --- ### Energy.RootMeterChanged Emitted whenever the root meter id changes. If the root meter has been unset, the params will be empty. **Paramètres :** | Champ | Type | Notes | | --- | --- | --- | | `rootMeterThingId` | `Uuid` | optionnel | --- ### Energy.ThingPowerLogEntryAdded Emitted whenever an entry is added to the thing power log. **Paramètres :** | Champ | Type | Notes | | --- | --- | --- | | `sampleRate` | [SampleRate](../types.md#samplerate) | | | `thingPowerLogEntry` | [ThingPowerLogEntry](../types.md#thingpowerlogentry) | | ---