Open martin-g-it opened 5 years ago
I have added the cost in my test environment for Power and Gas, trying to figure out which device is best to use for this. There is a known issue that there is no cost for Power when using a double meter, only the high cost come through.
The heat I cannot add (or test as I don't have that here), your code changes first need to make it into the ToonApiLib, can you perhaps make a PR for that to happen?
I will test the cost for a few more days and create a PR after that.
My Toon subscription has ended since I have rooted the device a few months back... I did create a daily cost device (Custom Sensor) based on the JSON from the Toon; calculated the daily costs via scripting; local PowerCostToday = domoticz.utils.round(tonumber(PowerUsageToday) 2109 / 10000, 2) local HeatCostToday = domoticz.utils.round(tonumber(HeatUsageToday) 26675 / 1000, 2) (Power costs 21,09 cents per KWh and heat costs 26,67 EUR per GJ)
I have a new Toon since last week, so let me bring back ToonApiLib on test domoticz environment and see if I can get things to work..
Example response from the Toon API for Heat: "heatUsage": { "value": 0, "dayCost": 0.43, "avgValue": 6.1, "meterReading": 1881, "avgDayValue": 146.29, "dayUsage": 18, "isSmart": 0, "lastUpdatedFromDisplay": 1575962257902 },
What device did you use for the cost? I now use Text and that works fine showing the current cost, but it doesn't create any nice graphical statistics. So I also tried with a managed counter, but that didn't work either.
A type General, subtype Custom Sensor with 'Aslabel' EUR. You do get the graph, which increases over the day, and therefor has an average value which doesn;t make much sense, but thats the only disadvantage..
Nice, changed and now testing again...
Hi John,
First of all big hooray for this API/plugin; ever since Eneco discontinued the older API interface the build-in 'Toon Thermostat' hardware didn't work anymore..
While configuring this toonapilib4domoticz plugin, I noticed the District heat usage is not supported by the toonapilib. After some checking I figured out what to do in order to fix this from the API perspective; see below code changes. Tested this with the testtoonapilib.py and works like a charm.
Now on the Domoticz side, I think we should add some new device (heat.py) in line with the power.py/ gas.py. While doing so, perhaps also an idea to include a device showing the cumulative daily usage costs (toon.power.daily_cost / toon.heat.daily_cost / toon.gas.daily_cost ).
Are you willing to add this to the Domoticz part? What device type / subtype should be used?
Cheers, Martin
toonapilib changes (note: the python folder may be named differently based upon version running): /usr/local/lib/python3.7/dist-packages/toonapilib/helpers.py line 84 added:
/usr/local/lib/python3.7/dist-packages/toonapilib/toonapilib.py line 49 added:
HeatUsage,
line 420 added: