Enabling usage tracking

Posted on
Mon Sep 04, 2017 4:52 pm
MartinG offline
Posts: 116
Joined: Aug 19, 2016

Re: Enabling usage tracking

Making progress. VeraEdge installed (after much pain & several support calls), plugin installed, and ...

Code: Select all
4 Sep 2017, 23:40:06
   Upgrading plugin Vera Bridge to newer version 2.0.2 (previous version moved to trash)
   Loading plugin "Vera Bridge 2.0.2"
   Starting plugin "Vera Bridge 2.0.2" (pid 66865)
   Started plugin "Vera Bridge 2.0.2"

4 Sep 2017, 23:41:54
   SQL Logger                      creating table device_history_1898444057 for "TK68E skt w energy"
   Error                           device "TK68E skt w energy" state key curEnergyLevel not defined (ignoring update request)
   Error                           device "TK68E skt w energy" state key curEnergyLevel not defined (ignoring update request)
   SQL Logger                      adding column "accumenergytotal_ui" to table device_history_1898444057 ("TK68E skt w energy")

4 Sep 2017, 23:43:09
   Error                           device "TK68E skt w energy" state key curEnergyLevel not defined (ignoring update request)
   Error                           device "TK68E skt w energy" state key curEnergyLevel not defined (ignoring update request)
   Error                           device "TK68E skt w energy" state key curEnergyLevel not defined (ignoring update request)
   Error                           device "TK68E skt w energy" state key curEnergyLevel not defined (ignoring update request)

etc, etc...


What I hadn't realised is that all the activity above seems to be logging total energy usage, not current energy level.

Kind of obvious in retrospect...

Any chance of adding this? Willing guinea pig here...

Posted on
Tue Sep 05, 2017 1:25 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Enabling usage tracking

MartinG wrote:
...Error device "TK68E skt w energy" state key curEnergyLevel not defined (ignoring update request.
What I hadn't realised is that all the activity above seems to be logging total energy usage, not current energy level.....

I am not quite sure what you are asking for. The Vera only provides 2 energy variables on updates: Watts and KWH. The watts value is placed into the Indigo curEnergyLevel state and KWH is placed into accumEnergyTotal. Note, these are the states you should be using. The similarly named states ending in ".ui" contain non-numeric data (like Watts, kWh, %, ºC, etc.) and are for UI display purposes only.

Vera also maintains a variable named KWHReading which appears to be (I.e. I have no idea) the total energy ever consumed by the device. In any case, this variable is not automatically reported. It would be possible to get it, but that would require an extra operation for every update on each energy meter device.

Based on your post, I suspect you want accumEnergyTotal. That value represents the total kWh consumed since the last reset. If you want energy (kWh) consumed since the last read, just subtract the last value from the current value. Note, because of timing issues in how often Vera is polled, the time period between updates may vary. Even if you sample the state value exactly every minute, that does not mean the data was updated at regular intervals. Thus, even in a device that is running at a steady wattage might show small fluctuations in consumption over several readings.

Let me know if this helps, or if I missed something.

BTW, I have a new update of the plugin that will implement energy meter updates and resets. I will post here when it is available.

Posted on
Tue Sep 05, 2017 2:13 am
MartinG offline
Posts: 116
Joined: Aug 19, 2016

Re: Enabling usage tracking

I'm not expressing myself very clearly - apologies. I'll try again.

The ultimate problem I'm trying to solve is knowing when my automower has got stuck somewhere so I can go and rescue it. I'm doing this by monitoring the power consumption of its docking station, which jumps to ~30W (from 2-4W) when the mower docks and starts charging. If this hasn't happened for a while, I know the mower has likely got stuck somewhere and it's time for me to take a walk. It's doesn't need to be terribly accurate, or especially fast; a few minutes delay, and a few watts out on power consumption don't matter.

The power consumption figure comes from a TK68E Z-Wave socket, which I have successfully paired with my VeraEdge. The "instantaneous" power consumption is reported correctly & reliably in Vera - it's this figure I'm trying to get at so I can provide the necessary alerts.

In the indigo devices list, I can see the socket device, and I can see that it's connected via the Vera Bridge protocol.
The device details at the bottom of the screen show "On State", and "Total Usage", but there's no current energy level reported (at least not that I can find).
Similarly, if I try to form a "Device State Changed" trigger, the only states available to me are "On/Off State", "Total Usage (kWh)" and "Duration Since Energy Reset (seconds)". Again, no current energy level.

The current energy level is definitely making it through to the plugin - in the following from the debug log, I can see u'watts': u'2.3', as well as u'kwh': u'0.0600'

Code: Select all
   Vera Bridge Debug               vera thread: _update: url: http://192.168.1.218:3480//data_request?id=lu_sdata&output_format=json&loadtime=1504565644&dataversion=565645540
   Vera Bridge Debug               vera thread: _update: ending at 09:18:39
   Vera Bridge Debug               vera thread: _update: starting at 09:18:42
   Vera Bridge Debug               vera thread: _update: url: http://192.168.1.218:3480//data_request?id=lu_sdata&output_format=json&loadtime=1504565644&dataversion=565645540
   Vera Bridge Debug               vera thread: _update: partial deviceInfo: {u'status': u'1', u'comment': u'', u'watts': u'2.4', u'room': u'1', u'parent': u'1', u'altid': u'2', u'kwh': u'0.0600', u'state': u'-1', u'id': u'3', u'subcategory': u'0'}
   Vera Bridge Debug               vera thread: _update: ending at 09:18:42
   Vera Bridge Debug               runConcurrentThread: processing update: {'device': {u'status': u'1', u'comment': u'', u'watts': u'2.4', u'room': u'1', u'parent': u'1', u'altid': u'2', u'kwh': u'0.0600', u'state': u'-1', u'id': u'3', u'subcategory': u'0'}, 'updateType': 'updateDevice'}
   Vera Bridge Debug               processUpdate called
   Vera Bridge Debug               processUpdate start: found device (TK68E skt w energy) updating: {u'status': u'1', u'comment': u'', u'watts': u'2.4', u'room': u'1', u'parent': u'1', u'altid': u'2', u'kwh': u'0.0600', u'state': u'-1', u'id': u'3', u'subcategory': u'0'}
   Error                           device "TK68E skt w energy" state key curEnergyLevel not defined (ignoring update request)
   Error                           device "TK68E skt w energy" state key curEnergyLevel not defined (ignoring update request)
   Vera Bridge Debug               processUpdate Finished: for device (TK68E skt w energy)  : {u'status': u'1', u'comment': u'', u'watts': u'2.4', u'room': u'1', u'parent': u'1', u'altid': u'2', u'kwh': u'0.0600', u'state': u'-1', u'id': u'3', u'subcategory': u'0'}
   Vera Bridge Debug               vera thread: _update: starting at 09:18:45

I had thought about using changes in the Total Usage, but at 30W consumption when charging, the changes are of the order of ~0.002kWh over a 5 minute period, which is close to the resolution limits of the displayed figure. Not sure this is going to be reliable enough, especially given the unpredictable update intervals.

Hope that helps! And thank-you for taking the time to tackle this - I hugely appreciate it.

Posted on
Tue Sep 05, 2017 2:39 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Enabling usage tracking

MartinG wrote:
...
Vera Bridge Debug processUpdate Finished: for device (TK68E skt w energy) : {u'status': u'1', u'comment': u'', u'watts': u'2.4', u'room': u'1', u'parent': u'1', u'altid': u'2', u'kwh': u'0.0600', u'state': u'-1', u'id': u'3', u'subcategory': u'0'}
...Hope that helps! And thank-you for taking the time to tackle this - I hugely appreciate it.

Hmmm. You should see Current Load for your Indigo device. That is the curEnergyLevel state. The display should look like this:
Screen Shot 2017-09-05 at 10.34.10.png
UI
Screen Shot 2017-09-05 at 10.34.10.png (20.32 KiB) Viewed 5585 times
If you do not see Current Load, delete the device and then create it again.

Posted on
Tue Sep 05, 2017 3:16 am
MartinG offline
Posts: 116
Joined: Aug 19, 2016

Re: Enabling usage tracking

Afraid not:

Vera.png
Vera.png (18.15 KiB) Viewed 5578 times


This is after deleting device, restarting plugin and re-adding device.

Posted on
Tue Sep 05, 2017 3:19 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Enabling usage tracking

MartinG wrote:
Afraid not:...
...This is after deleting device, restarting plugin and re-adding device.

Ok. It seems your device is not being seen as an energy meter capable device. I will look into it.

CAVEAT: I am FAR from being a Vera expert. My interest is solely to use the Vera as a way to extend my Z-Wave network beyond the reach of my Indigo based network.

Posted on
Tue Sep 05, 2017 3:25 am
MartinG offline
Posts: 116
Joined: Aug 19, 2016

Re: Enabling usage tracking

Thanks - FWIW, I have exactly the same need. Devices to control and monitor in a building that's beyond reliable Z-Wave range. Otherwise, wouldn't be using Vera either.

Let me know if you'd like me to to try anything out/send further info.

Posted on
Tue Sep 05, 2017 3:31 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Enabling usage tracking

MartinG wrote:
...Let me know if you'd like me to to try anything out/send further info.

Could you delete the device, turn on the plugin debugging, and recreate the device. Then post the results here.

Thanks.

Posted on
Tue Sep 05, 2017 3:41 am
MartinG offline
Posts: 116
Joined: Aug 19, 2016

Re: Enabling usage tracking

Here you are:

Code: Select all
ion=565645758
   Vera Bridge Debug               vera thread: _update: ending at 10:38:36
   Vera Bridge Debug               vera thread: _update: starting at 10:38:39
   Vera Bridge Debug               vera thread: _update: url: http://192.168.1.218:3480//data_request?id=lu_sdata&output_format=json&loadtime=1504565644&dataversion=565645758
   Vera Bridge Debug               vera thread: _update: ending at 10:38:39
   Vera Bridge Debug               vera thread: _update: starting at 10:38:42
   Vera Bridge Debug               vera thread: _update: url: http://192.168.1.218:3480//data_request?id=lu_sdata&output_format=json&loadtime=1504565644&dataversion=565645758
   Vera Bridge Debug               vera thread: _update: ending at 10:38:42
   Vera Bridge Debug               _getNodeList called
   Vera Bridge Debug               vera thread: _update: starting at 10:38:45
   Vera Bridge Debug               vera thread: _update: url: http://192.168.1.218:3480//data_request?id=lu_sdata&output_format=json&loadtime=1504565644&dataversion=565645758
   Vera Bridge Debug               vera thread: _update: ending at 10:38:45
   Vera Bridge Debug               closedDeviceFactoryUi
   Vera Bridge Debug               closedDeviceFactoryUi: creating device for: {u'category': 3, u'status': u'1', u'watts': u'2.4', u'room': 1, u'parent': 1, u'altid': u'2', u'kwh': u'0.0600', u'comment': u'', u'name': u'TK68E skt w energy', u'state': -1, u'id': 3, u'subcategory': 0}
   Vera Bridge Debug               deviceStartComm called with: device.address: 3
   Vera Bridge Debug               TK68E skt w energy communication enabled
   Vera Bridge Debug               deviceStartComm: self.deviceDict: {u'3': 1950808757}
   Vera Bridge Debug               vera thread: _update: starting at 10:38:46
   Vera Bridge Debug               vera thread: _update: url: http://192.168.1.218:3480//data_request?id=lu_sdata&output_format=json&loadtime=0&dataversion=0
   Vera Bridge Debug               vera thread: _update: doing full update with infoDict:

{
    "categories": [
        {
            "id": 3,
            "name": "On/Off Switch"
        }
    ],
    "comment": "",
    "dataversion": 565645758,
    "devices": [
        {
            "altid": "2",
            "category": 3,
            "comment": "",
            "id": 3,
            "kwh": "0.0600",
            "name": "TK68E skt w energy",
            "parent": 1,
            "room": 1,
            "state": -1,
            "status": "1",
            "subcategory": 0,
            "watts": "2.3"
        }
    ],
    "full": 1,
    "fwd1": "vera-us-oem-relay31.mios.com",
    "fwd2": "vera-us-oem-relay12.mios.com",
    "ir": 0,
    "irtx": "",
    "loadtime": 1504565644,
    "mode": 1,
    "model": "Sercomm NA301",
    "rooms": [
        {
            "id": 1,
            "name": "Shed",
            "section": 1
        }
    ],
    "scenes": [],
    "sections": [
        {
            "id": 1,
            "name": "My Home"
        }
    ],
    "serial_number": "45111894",
    "skin": "mios",
    "state": -1,
    "temperature": "F",
    "version": "*1.7.3014*",
    "zwave_heal": 1
}


   Vera Bridge Debug               vera thread: _update: scenes:
{}
   Vera Bridge Debug               vera thread: _update: adding update to update queue: {u'category': 3, u'status': u'1', u'watts': u'2.3', u'room': 1, u'parent': 1, u'altid': u'2', u'kwh': u'0.0600', u'comment': u'', u'name': u'TK68E skt w energy', u'state': -1, u'id': 3, u'subcategory': 0}
   Vera Bridge Debug               vera thread: _update: devices:
{3: {u'category': 3, u'status': u'1', u'watts': u'2.3', u'room': 1, u'parent': 1, u'altid': u'2', u'kwh': u'0.0600', u'comment': u'', u'name': u'TK68E skt w energy', u'state': -1, u'id': 3, u'subcategory': 0}}
   Vera Bridge Debug               vera thread: _update: ending at 10:38:46
   SQL Logger                      creating table device_history_1950808757 for "TK68E skt w energy"
   Vera Bridge Debug               vera thread: _update: starting at 10:38:49
   Vera Bridge Debug               vera thread: _update: url: http://192.168.1.218:3480//data_request?id=lu_sdata&output_format=json&loadtime=1504565644&dataversion=565645758
   Vera Bridge Debug               vera thread: _update: ending at 10:38:49
   Vera Bridge Debug               runConcurrentThread: processing update: {'device': {u'category': 3, u'status': u'1', u'watts': u'2.3', u'room': 1, u'parent': 1, u'altid': u'2', u'kwh': u'0.0600', u'comment': u'', u'name': u'TK68E skt w energy', u'state': -1, u'id': 3, u'subcategory': 0}, 'updateType': 'updateDevice'}
   Vera Bridge Debug               processUpdate called
   Vera Bridge Debug               processUpdate start: found device (TK68E skt w energy) updating: {u'category': 3, u'status': u'1', u'watts': u'2.3', u'room': 1, u'parent': 1, u'altid': u'2', u'kwh': u'0.0600', u'comment': u'', u'name': u'TK68E skt w energy', u'state': -1, u'id': 3, u'subcategory': 0}
   Vera Bridge Debug               found watts
   Error                           device "TK68E skt w energy" state key curEnergyLevel not defined (ignoring update request)
   Error                           device "TK68E skt w energy" state key curEnergyLevel not defined (ignoring update request)
   Vera Bridge Debug               processUpdate Finished: for device (TK68E skt w energy)  : {u'category': 3, u'status': u'1', u'watts': u'2.3', u'room': 1, u'parent': 1, u'altid': u'2', u'kwh': u'0.0600', u'comment': u'', u'name': u'TK68E skt w energy', u'state': -1, u'id': 3, u'subcategory': 0}
   SQL Logger                      adding column "accumenergytotal_ui" to table device_history_1950808757 ("TK68E skt w energy")
   Vera Bridge Debug               vera thread: _update: starting at 10:38:52
   Vera Bridge Debug               vera thread: _update: url: http://192.168.1.218:3480//data_request?id=lu_sdata&output_format=json&loadtime=1504565644&dataversion=565645758
   Vera Bridge Debug               vera thread: _update: ending at 10:38:52
   Vera Bridge Debug               _getNodeList called
   Vera Bridge Debug               vera thread: _update: starting at 10:38:55
   Vera Bridge Debug               vera thread: _update: url: http://192.168.1.218:3480//data_request?id=lu_sdata&output_format=json&loadtime=1504565644&dataversion=565645758
   Vera Bridge Debug               vera thread: _update: ending at 10:38:55
   Vera Bridge Debug               closedDeviceFactoryUi
   Vera Bridge Debug               closedDeviceFactoryUi: devIdList: IdList : (list)
     Item : 1950808757 (integer)
   Vera Bridge Debug               vera thread: _update: starting at 10:38:58
   Vera Bridge Debug               vera thread: _update: url: http://192.168.1.218:3480//data_request?id=lu_sdata&output_format=json&loadtime=1504565644&dataversion=565645758
   Vera Bridge Debug               vera thread: _update: ending at 10:38:58
   Vera Bridge Debug               vera thread: _update: starting at 10:39:01
   Vera Bridge Debug               vera thread: _update: url: http://192.168.1.218:3480//data_request?id=lu_sdata&output_format=json&loadtime=1504565644&dataversion=565645758
   Vera Bridge Debug               vera thread: _update: ending at 10:39:01
   Vera Bridge Debug               vera thread: _update: starting at 10:39:04
   Vera Bridge Debug               vera thread: _update: url: http://192.168.1.218:3480//data_request?id=lu_sdata&output_format=json&loadtime=1504565644&dataversion=565645758
   Vera Bridge Debug               vera thread: _update: ending at 10:39:04
   Vera Bridge Debug               vera thread: _update: starting at 10:39:07
   Vera Bridge Debug               vera thread: _update: url: http://192.168.1.218:3480//data_request?id=lu_sdata&output_format=json&loadtime=1504565644&dataversion=565645758
   Vera Bridge Debug               vera thread: _update: ending at 10:39:07
   Vera Bridge                     Turning off debug logging

Posted on
Tue Sep 05, 2017 3:58 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Enabling usage tracking

MartinG wrote:
Here you are:...
...Vera Bridge Debug closedDeviceFactoryUi: creating device for: {u'category': 3, u'status': u'1', u'watts': u'2.4', u'room': 1, u'parent': 1, u'altid': u'2', u'kwh': u'0.0600', u'comment': u'',

Very odd. The device says it can report watts, and that is what the plugin uses to determine if the energy data is available. If so, it creates the necessary states. But, in your case, it looks like that is not happening. Try this:
  1. In the indigo UI right-click on the device and select Copy Python Reference
  2. From the Indigo menu bar click Plugins and then select Open Scripting Shell
  3. In the scripting shell window enter dev= and then paste the Python reference you copied in step 2
  4. Press return
  5. Enter print dev
  6. Press return
Copy the output and post it back here.

Thanks.

Posted on
Tue Sep 05, 2017 4:07 am
MartinG offline
Posts: 116
Joined: Aug 19, 2016

Re: Enabling usage tracking

Here you go:

Code: Select all
Python 2.7.10 (default, Feb  7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]
Connected to Indigo Server v7.0.3, api v2.0 (localhost:1176)
>>> dev=indigo.devices[1950808757] # "TK68E skt w energy"
>>> print dev
address : 3
batteryLevel : None
buttonGroupCount : 0
configured : True
description :
deviceTypeId : veraAppliance
displayStateId : onOffState
displayStateImageSel : PowerOn
displayStateValRaw : True
displayStateValUi : on
enabled : True
energyAccumBaseTime : 2000-01-01 00:00:00
energyAccumTimeDelta : 0
energyAccumTotal : 0.06
energyCurLevel : None
errorState :
folderId : 1031710549
globalProps : MetaProps : (dict)
     com.perceptiveautomation.indigoplugin.vera : (dict)
          SupportsEnergyMeter : true (bool)
          address : 3 (string)
id : 1950808757
lastChanged : 2017-09-05 11:05:11
lastSuccessfulComm : 2017-09-05 11:05:11
ledStates : []
model : On/Off Module
name : TK68E skt w energy
onState : True
ownerProps : com.perceptiveautomation.indigoplugin.vera : (dict)
     SupportsEnergyMeter : true (bool)
     address : 3 (string)
pluginId : com.perceptiveautomation.indigoplugin.vera
pluginProps : emptyDict : (dict)
protocol : Plugin
remoteDisplay : True
states : States : (dict)
     accumEnergyTimeDelta : 0 (integer)
     accumEnergyTotal : 0.0600 (string)
     accumEnergyTotal.ui : 0.060 kWh (string)
     onOffState : on (on/off bool)
subModel :
supportsAllLightsOnOff : False
supportsAllOff : False
supportsStatusRequest : True
version : None
>>>

Posted on
Tue Sep 05, 2017 4:33 am
MartinG offline
Posts: 116
Joined: Aug 19, 2016

Re: Enabling usage tracking

Have responded to your PM, but message sitting in 'outbox' rather than 'sent', so not 100% certain it got to you...

Posted on
Tue Sep 05, 2017 4:38 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Enabling usage tracking

MartinG wrote:
Have responded to your PM, but message sitting in 'outbox' rather than 'sent', so not 100% certain it got to you...

When a message is in the outbox, it means it is in the recipients in-box but hasn't been read yet. When the recipient reads the message, it will then be moved to your sent box. This enables you to edit the message while it is still in your outbox and before it has been read, should you wish to do so. :)

Posted on
Wed Sep 06, 2017 7:39 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

New release

v2.1.1 released on GitHub. Contains improved support for energy meter devices, including Reset (zeroes out both Indigo and Vera) and single device Update. An Update All Devices has ben added to the plugin menu.

Device status now works as described in the Wiki, it updates all devices. However, this will be changed in the next release to just update the single device selected in the Indigo device list (I.e. it will function the same as the Update button).

Posted on
Fri Sep 08, 2017 2:54 am
MartinG offline
Posts: 116
Joined: Aug 19, 2016

Re: Enabling usage tracking

Thanks for all your work on this.

The prototype has been working flawlessly since installed it and I've just upgraded to v2.1.1. So far so good...

Who is online

Users browsing this forum: No registered users and 1 guest