diff --git a/README.md b/README.md index 1be06a4..6d0f775 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ to any number of different targets, such as databases or MQTT. * [Installation and usage](#installation-and-usage) + [Running with Docker](#running-with-docker) + [Running as a systemd service](#running-as-a-systemd-service) +* [Caveats](#caveats) * [Development](#development) * [License](#license) @@ -112,6 +113,10 @@ There is a skeleton systemd service available in [systemd/eachwatt.service](syst project to `/opt/eachwatt`, copy the service file to `/etc/systemd/system/eachwatt.service`, modify it as necessary and then start the service using `systemctl start eachwatt.service`. +## Caveats + +* IotaWatt input sensors are always whole numbers, i.e. 2 watts. Output sensors don't have this limitation. + ## Development Install dependencies: diff --git a/src/eachwatt.ts b/src/eachwatt.ts index edd30b3..cd080b0 100644 --- a/src/eachwatt.ts +++ b/src/eachwatt.ts @@ -56,14 +56,14 @@ const mainPollerFunc = async (config: Config) => { // Post-process power sensor data powerSensorData = powerSensorData.map((data) => { + // Apply optional data filters + if (data.circuit.sensor.filters) { + data = applyFilters(data.circuit.sensor.filters, data) + } + if (data.power !== undefined) { // Round all numbers to one decimal point data.power = Number(data.power.toFixed(1)) - - // Apply optional data filters - if (data.circuit.sensor.filters) { - data = applyFilters(data.circuit.sensor.filters, data) - } } return data