Hi,
I am using Openhab 2.4.0 with Z-Wave binding 2.5.0.
I can do simple widgets to turn on/off with some ng-if or ng-click expressions. I am learning how to use openhab and habpanel.
I have problem to do simple calculation with dates and show result. I have power plug with meter nas-wr01ze and I would like to calculate and show cost of average used energy in the monthly period.
- I need to set constant start_date (perfectly if defined in a widget configuration, rounded to full days)
- Second parameter is a constant price = cost of 1 kWh = 0,6 (perfectly if defined in a widget configuration)
- Third parameter is variable actual_date
- 4th parameter is variable energy energia read from power plug
Equation:
monthly_cost = (energia / (actual_date - start_date)) * 31 * price
Could you write me a code which I can put directly to the widget code?
This sample will help me pretty much in case of other calculations in widgets. How to use variables, do equations etc. There is any tutorial which can help?