This adapter uses the service Sentry.io to automatically report exceptions and code errors and new device schemas to me as the developer. More details see below!
Detailed analysis of your Energy, gas and liquid consumptions Any source (kWh, Wh, Watt, l/h or m3 )can be used for data analyses :
state | functionality | Description |
---|---|---|
>device<.cumulativeReading | accumulate values | Calculate cumulated values including transformation cumulated value can be change by following these steps |
>Device<.>Year<.>Year statistics< | Yearly statistics | Store statistic information of the Year at level >device.>thisYear<.>selected period< |
>Device<.>Year<.>currentYear | Current Year statistics | Store statistic information of the current Year at level >device.>currentYear<.>selected period< |
>Year<.>currentYear.>Consumption type < | Consumption | Root folder to store consumption data (current value - previous value). Can be consumption or delivery |
>Year<.>currentYear.>Cost type < | Costs | Root folder to store cost data. current value * cost + basic price Can be consumption or delivery |
All state locations are grouped by state name and separated in period and Category structures.
Calculations will be automatically handled and values transformed to the proper unit as defined in Price-Definitions.
If you have any issues, pleae read the Troubleshooting first!
Configuration Item | Description |
---|---|
enabled | Activate state for SourceAnalytix |
Alias | default: name of state, Name of device as shown in SA |
Select Type | mandatory, choose you calculation type to calculate according Price-Definitions |
Select Unit | default: automatically, choose manually if needed (see logs) |
Costs | Cost calculation |
with(out) basic charge | incl;ude basic charge in cost calculation |
consumption | calculate consumption data |
counter values | store current counter values |
Meter reading at |
|
beginning of x : | Start value of counter for specific period to handle calculation current - startValue |
ToDo : Describe logic<
ToDo : Describe logic<
ToDo : Describe logic<
ToDo : Document link to library (document lib also !)
ToDo : Document watt to kWh transformation
ToDo : Document unit transformation (like Watt, to Wh to KWh
Store statistic information of consumption/prices and/or costs/earnings at the Year level
device.>thisYear<.>cathegory<.>selected period
This information is typically used for data storage and historical comparisons.
States are grouped by specified period
(like year 2020 vs 2021, ore february 2019 vs february ect)
Device<.>Year<.>costs/earnings
consumption/delivery<.weeks.weekNr<Device<.>Year<.>costs/earnings
consumption/delivery<.months.Month<Device<.>Year<.>costs/earnings
consumption/delivery<.quarters.Qx<
Store statistic information of the current Year at level :
device.>currentYear<.>selected period
Device<.>Year<.>costs/earnings
consumption/delivery<.weeks.weekNr<Device<.>Year<.>costs/earnings
consumption/delivery<.months.Month<Device<.>Year<.>costs/earnings consumption/delivery<.quarters.Qx<
This information is typically used for daily/weekly/monthly calculation of
costs/earnings and/or consumption/delivery grouped by specified period
ToDo : Add screenshots<
category | type | Description |
---|---|---|
costs | financial | Result of calculation value * cost price + basic price |
earnings | financial | Result of calculation value * earning price + basic price |
consumption | calculations | Result of calculation value as cost - start value of Year/Month/Quarter etc |
delivery | calculations | Result of calculation value as delivery - start value of Year/Month/Quarter etc |
Before we start troubleshooting, it's important to understand how source analytix initialises as here errors may occur, see issue section. The following sequence will be handled :
- Start SourceAnalytix
- List all states activated for SourceAnalytix
- Initiate states, for each state :
- Read current cumulatedReading
(if present) and memory values from state - Check if unit can be handled {Issue 1}
- Check if cost type is chosen {Issue 2}
- Verify if valid price definition is present for cost type {Issue 3}
- Check if previous init value > current cumulated value {Issue 4}
- Check if valid known of previous device reset > current cumulated value {Issue 5}
- Store all data to memory
- Read current cumulatedReading
- Initialise states for each state :
- create state cumulativeReading (to store results of calculation, can also be used for W to kWh only) {Issue 6}
- create states as chosen in state configuration {Issue 7}
- start calculation
- On state change/update
- Verify if information is correct
- transform value to proper unit (unit of state to unit chosen in state configuration)
- check if value input is correct ( current value > previousInit value) {See 7 At device reset Issue 8}
- calculate {Issue 9}
- For Watt : calculate Watt to kWh ,calculate cumulatedReading = currentReading + cumulatedReading
- For other : calculate cumulatedReading = currentReading + previousDeviceReset (if present)
- At night (00.00)
- List all SourceAnalytix enabled states
- Reset start (Day/Week/Year/Month) values
- At device reset
- Store current value as previousDeviceReset and previousInit value
If the device wil be reset again (detected by previousInit value),
currentReading + previousDeviceReset is stored as to previousDeviceReset.
- Store current value as previousDeviceReset and previousInit value
Issue 1 No unit defined for ....., cannot execute calculations
Please select correct unit in state settings
Issue 2 No cost type defined for ....., please Select Type of calculation at state setting
Please selected wanted cost-type for to understand what amount should be used to handle calculations
Issue 3 Selected Type ... does not exist in Price Definitions
Now Price definitions are found for the chosen cost type, please verify your price setting (adapte config)
Issue 4 Check settings for ..... ! Known init value : ..... > known cumulative value ..... cannot proceed
The known init value > known cumulated values, this can be solved by removing or modifying these objects in the state raw object
"valueAtDeviceInit": xxxx
Issue 5 Check settings for ..... ! Known valueAtDeviceReset : ..... > known cumulative value ..... cannot procee
The known init value > known cumulated values, this can be solved
removing or modifying these objects in the state raw object
valueAtDeviceReset": xxxx
Issue 6 State for cumulativeReading is not created
Initialisation of state did fail, see issue 1 to 5
Issue 7 States for costs readings ae not created
Type of calculation is not enabled in state settings
Issue 8 current value < previousInit
A device reset is detected, see function 7
Issue 9 My calculations are incorrect
-
Verify if the correct unit is chosen (of not selected, SA will try to autodetect)
-
Verify if the cumulatedReading reflects the correct total value of your value reading, if not
-
Ensure the start values are set correctly
SA handles calculations by cumulatedReading - known cumulatedReading at period start. These start values are defined at the state settings and should be < than currentReading
Please ensure cumulativeReading >= DayStart >= WeekStart >= MonthStart >= QuarterStart >= YearStart -
Verify these values in state raw object :
valueAtDeviceReset": xxx
"valueAtDeviceInit": xxx
This adapter has is roots with thanks to pix back in 2016 https://forum.iobroker.net/viewtopic.php?f=21&t=2262
Which has been improved by @hadering and published on github https://github.com/hdering/homematic_verbrauchszaehler
- Documentation!
- Period calculation selectable but not yet implemented
- monthly cost price not yet implemented in calculation
- recalculation based on meter values (configurable by date)
- add object states for previous [x]day, [x]week, [x]month, [x]quarter, [x]year configurable in adapter settings
If you like my work, please consider a personal donation
(this is an personal Donate link for DutchmanNL, no relation to the ioBroker Project !)
Sentry.io is a service for developers to get an overview about errors from their applications. And exactly this is implemented in this adapter.
When the adapter crashes or an other Code error happens, this error message that also appears in the ioBroker log is submitted to Sentry. When you allowed iobroker GmbH to collect diagnostic data then also your installation ID (this is just a unique ID without any additional infos about you, email, name or such) is included. This allows Sentry to group errors and show how many unique users are affected by such an error. All of this helps me to provide error free adapters that basically never crashs.
- (DutchmanNL) Breaking!!! Move current values to currentYear #135
- (DutchmanNL & ToTXR4Y) MajorChange !: Replaced Current_Reading with CumulativeReading 226
- (DutchmanNL) Code cleanup
- (DutchmanNL) Add back "currentYear"
- (DutchmanNL) (debug) Logging improved
- (DutchmanNL) Weekly reset of weekdays
- (DutchmanNL) Calculation for all states
- (DutchmanNL) change default log-level to info
- (DutchmanNL) Calculation for previous states #242
- (DutchmanNL) Optimized error reporting (Sentry)
- (DutchmanNL) Removed unneeded settings in configuration
- (DutchmanNL) Implemented new configuration for "currentYear"
- (DutchmanNL & ToTXR4Y) implement "05_currentYear" in year root folder #280
- (DutchmanNL) Implemented category cumulative values under year statistics
- (DutchmanNL & ToTXR4Y) implement cached memory slot for initialisation value #226
- (DutchmanNL & ToTXR4Y) Implement log messages if state attributes are changed
- (DutchmanNL & ToTXR4Y) Implement automatically detection of currency from admin settings #247
- (DutchmanNL) Bugfix : dev: 0 bug workaround
- (DutchmanNL) Do not round cumulated reading
- (DutchmanNL) Bugfix : delete states in create function
- (DutchmanNL) Bugfix : quarters.1 has no existing object
- (DutchmanNL) Bugfix : Calculations for "previous" values
- (DutchmanNL) Bugfix : Incorrect initialisation for states
- (DutchmanNL) Bugfix : Avoid NULL & 0 values at night reset
- (DutchmanNL) Bugfix : 05_currentYear has no existing object
- (DutchmanNL) Bugfix : Avoid calculation of non-Initialised states
- (DutchmanNL) Bugfix : Cannot read property 'stateDetails' of null
- (DutchmanNL) Correct error handling of "Watt" state initialisation
- (DutchmanNL) Bugfix : Ensure a proper reset and init of Watt values
- (DutchmanNL) Bugfix : Avoid loop if init value is set and > reading
- (DutchmanNL) Bugfix : Caught sentry error : Alias xxxxx has no target
- (DutchmanNL & ToTXR4Y) Bugfix : Rebuild calculation logic which solves :
- Watt values : Ensure proper reading start (0 instead of current watt value) Watt values : Ensure proper reading calculation with exponent (0 instead of current watt value) #281
- All calculations : correct handling of device reset (if value is reset or 0)
- (DutchmanNL) Bugfix : Incorrect initialisation for Watt values with 0 input
- (DutchmanNL) Bugfix : Only create cumulatedXXX in year statistics if activated
- (DutchmanNL) Bugfix : Incorrect warn message if configuration for objects is changed
- (DutchmanNL) Bugfix : Error {Is not a number, cannot continue calculation} if value = 0
- (DutchmanNL) Bugfix : Throw error if value is NULL for troubleshooting instead of handling incorrect calculation
- (DutchmanNL) Bugfix : Ensure daily reset does not destroy cumulative memory value (Fixes NULL values for Watt after night reset)
- (DutchmanNL) Implement Sentry
- (DutchmanNL) Implement configuration for Price definitions
- (DutchmanNL) Bugfix: NULL value issue at daily reset
- (DutchmanNL) Bugfix: Issue found in selection of category
- (DutchmanNL) Bugfix: Category issue (read value of undefined)
- (DutchmanNL) Bugfix: Issue in storing meter values by month
- (DutchmanNL) Bugfix: Wrong reading value for Watt initialisation
- (DutchmanNL) Bugfix: Warnings at object creations (js-controller 3.x)
- (DutchmanNL) Bugfix: wrong interpretation of start values at value resets
- (DutchmanNL) Bugfix: Proper error message instead of code crash if no cost type defined
- (DutchmanNL) Add device name for log messages if device value < than currently known value
- (DutchmanNL) Bugfix : Crash at adapter start if chosen Type is not present in instance configuration
- (DutchmanNL) Translations updated
- (DutchmanNL) Bugfix : Values do not reset at new day start
- (DutchmanNL) Bugfix : Handle calculations when reading = 0
- (DutchmanNL) Bugfix : Handle calculations at initialisation
- (DutchmanNL) Bugfix : Pause all calculation during day-reset
- (DutchmanNL) Do not calculate values is state is update with same value as previous
- (DutchmanNL) Complete code rebuild
- (DutchmanNL) Change data points to root by year
- (DutchmanNL) Delete unneeded states automatically
- (DutchmanNL) Calculation by quarter implemented
- (DutchmanNL) Storage of meter values implemented
- (DutchmanNL) Rebuild calculation logic to handle in memory instead of object DB (performance)
- (DutchmanNL) m³ Implemented
- (xXBJXx) Fix wrong storage of start meter values
- (DutchmanNL) Fix wrong storage of daily reset of meter values
- (Xoroles & DutchmanNL) fix watt calculation, thank you @Xoroles !
- (DutchmanNL) implemented w to kWh calculations :) with thanks to @AlCalzone and @andiling !
- (DutchmanNL) implemented meter readings
- (DutchmanNL & @AlCalzone) code improvements & stability
- (DutchmanNL) fix issue with liquid unit reading (m3)
- (DutchmanNL) fix issue in daily reset of start values
- (DutchmanNL) Fix badges in readme
- (DutchmanNL) exclude calculations of w from current routines (will be implemented in next version(s)
- (DutchmanNL) change logic of initialisation
- (DutchmanNL) fix issue in calculation handling
- (DutchmanNL) extract unit definition to central function
- (DutchmanNL) removed "logging to troubleshoot", use "debug" in adapter setting
- (DutchmanNL) implement compact mode
- (DutchmanNL) fix testing issues
- (DutchmanNL) fix error "unit" or "tolowercase" is undefind
- (DutchmanNL) fixed installation issues
- (DutchmanNL) fixed issue related to multihost installations with slave as target
- (DutchmanNL) fixed issue in calculations for gas environments and liquids
- (DutchmanNL) improve logging related to issue analytics
- (DutchmanNL) add option in state setting to automatically OR manually choose the meassurement unit (for cases device state does not have correct value)
- (DutchmanNL) add support for heating pumps
- (DutchmanNL) improvements in adapter configuration screen
- (DutchmanNL) fixed reset of start values
- (DutchmanNL) removed uneeded logging "Write calculations for : "
- (DutchmanNL) generic improvement of logging, to see status messages activate it in adapter settings ! Otherwise onlyu erros will be shown and add/del devices
- (DutchmanNL) improved complete logic of state add/delete/update config in backend which will result in better performance/error handling
- (DutchmanNL) small fixed in configuration screen to show logging options
- (DutchmanNL) fixed "current_day" missing in object tree
- (DutchmanNL) fixed log messages "removed from SourceAnalytix"
- (DutchmanNL) fixed unit issue to support upper and lower case in values
- (DutchmanNL) fixed unit issue replace strange characters
- (DutchmanNL) remove intervall setting from configuraiton screen (handle by state subscribtion now!)
- (DutchmanNL) remove start meassurement from state configuraiton screen (not need, please use day start, week start etc !)
- (DutchmanNL) rebuild logic to calculate values (beta testing)
- (DutchmanNL) implement logic to automatically reset values by start of new day, week, month, year etc (beta testing)
- (DutchmanNL) changed logic from intervall polling to handle calculations based on state updates (beta testing, not if suitable for all situations)
- (DutchmanNL) fixed issue incorrect states are added to monitoring
- (DutchmanNL) fixed issue calculation not stopped when state removed from monitoring
- (DutchmanNL) always store all current meassurements to values of cathegorie regardless setting year etc
- (DutchmanNL) code cleanup and optiomalisation
- (DutchmanNL) added logging option "satus notification"
- (DutchmanNL) implement new translation mechanisme
- (DutchmanNL) Adapter moved to community development tree
- (DutchmanNL) added npm version and test-status to readme
- (DutchmanNL) finalized new konfiguration screen & translations
- (DutchmanNL) adding/removing objects from analytix does not need adapter reboot anymore ! :-)
- (DutchmanNL) rebuild logic how data is handled as basic for new calculation logic (Experimental)
- (DutchmanNL) added options to year analytics to choose values (days,weeks,years etc)
- (DutchmanNL) option added for Developer logging
- (DutchmanNL) Basic price is currently not considered in cost calculations !
- (DutchmanNL) Values day start, week start etc are currenlty not automatically set (will be in 0.2.0)
- (DutchmanNL) konfiguration pages completly redesigned : Please do not enter values yet !
- (DutchmanNL) master konfiguration added to globally define costs
- (DutchmanNL) intervall settings moved to global setting instead of each state seperated
- (DutchmanNL) instead of cost-price in each state use drop down menu to choose values from global settings
- (DutchmanNL) fixed naming and translations
- (DutchmanNL) fixed data reset for quarter values (thank you Jens !)
- (DutchmanNL) fixed usage of alias
- (DutchmanNL) fixeded issue in calculation of earnings and delivery
- (DutchmanNL) logging improvement
- (DutchmanNL) fixed log messages
- (DutchmanNL) calculation for m3 values
- (DutchmanNL) calculation for l values
- (DutchmanNL) improved state write logic, only sent write commando when needed
- (DutchmanNL) add support for calculation of Wh values
- (DutchmanNL) first public beta release
- (DutchmanNL) fixed translations
- (DutchmanNL) rebuild calculation logic
- (DutchmanNL) fixed calculation of start offset
- (DutchmanNL) adjustable if state is used for cosumption or delivery
- (DutchmanNL) limited possible logging to kWh only for this moment
- (DutchmanNL) only create states and channels for logging types selected
- (DutchmanNL) fixed wrong calculation of start values
- (DutchmanNL) fixed wrong calculation of quarter values
- (DutchmanNL) prepare public beta and travis testing
- (DutchmanNL) change name to SourceAnalytix
- (DutchmanNL) implemented SourceAnalytix settings at states (equal to data logging adapters)
- (DutchmanNL) configurable unit for every state, automatically from object state. currently only kWh supported !
- (DutchmanNL) configurable intervall for every state
- (DutchmanNL) automated reset of start values
- (DutchmanNL) fixed issue with travis build
- (DutchmanNL) fixed wrong information in package-json
- (DutchmanNL) cost calculation
- (DutchmanNL) adjustable starting point of meassurement
- (DutchmanNL) support of multiple device states instead of 1
- (DutchmanNL) fixed calculation of current consumptions
- (DutchmanNL) code optimalisation
- (DutchmanNL) creation of object structure
- (DutchmanNL) first values read based on test_object.js input file to read values adn write data of current period.s
- (DutchmanNL) initial release
MIT License
Copyright (c) 2021 DutchmanNL
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.