Building private history information with the Stretch

Plugwise Forum about Plugwise devices and the Source software.
Post Reply
Post-IT
Member
Member
Posts: 448
Joined: Sat Feb 28, 2009 12:01 am
Location: Netherlands (Rotterdam)

Building private history information with the Stretch

Post by Post-IT »

Plugwise might have a nice interface, but I want to fill my own database with historical information so I can visualise and store the information the way I would like to (and without extra cost).

So far I've taken a look at the different xml outputs. The Stretch shows a slightly different output then Source.

Stretch URL /minirest/appliances shows:

Code: Select all

<appliance id="1889f71584e042d494301fc91d99745">
<name>Opladers</name>
<type>charger</type>
<created_date>2013-04-11T11:03:53+00:00</created_date>
<modified_date>2013-04-12T08:45:49+00:00</modified_date>
<last_seen_date>2013-04-12T08:45:49+00:00</last_seen_date>
<power_state>on</power_state>
<current_power_usage>2.5</current_power_usage>
<do_not_switch_off>false</do_not_switch_off>
<last_known_measurement_date>2013-04-12T08:45:49+00:00</last_known_measurement_date>
<module id="3a9bf45071d427998d283a3f5c81a2a"/>
<groups/>
</appliance>
Stretch URL /minirest/modules shows:

Code: Select all

<module id="3a9bf45071d427998d283a3f5c81a2a">
<mac_address>000D6F0000236A54</mac_address>
<name>00236A54</name>
<type>2</type>
<hardware_version>0000-0440-0107</hardware_version>
<firmware_version>2011-06-27</firmware_version>
<created_date>2013-04-11T10:57:49+00:00</created_date>
<modified_date>2013-04-12T08:12:01+00:00</modified_date>
<last_seen_date>2013-04-12T08:12:01+00:00</last_seen_date>
<power_state>on</power_state>
<current_power_usage>2</current_power_usage>
<last_known_measurement_date>2013-04-12T08:12:01+00:00</last_known_measurement_date>
<network id="173a244314d4439b87a6f3eae572f03"/>
<appliance id="1889f71584e042d494301fc91d99745"/>
</module>

Stretch URL /appliances/interval_logs shows:

Code: Select all

<appliance id="1889f71584e042d494301fc91d99745">
<interval_logs>
<interval_log id="612b2f5936444a858176957e63410c34">
<unit>Wh</unit>
<type>electricity_consumed</type>
<last_consecutive_log_date>2013-04-12T20:00:00+00:00</last_consecutive_log_date>
<updated_date>2013-04-12T21:01:14.317+00:00</updated_date>
<period start_date="2013-04-11T08:00:00+00:00" end_date="" interval="PT1H">
<measurement log_date="2013-04-12T14:00:00+00:00">2.07</measurement>
<measurement log_date="2013-04-11T21:00:00+00:00">4.52</measurement>
<measurement log_date="2013-04-11T13:00:00+00:00">2.06</measurement>
<measurement log_date="2013-04-12T06:00:00+00:00">2.06</measurement>
<measurement log_date="2013-04-11T22:00:00+00:00">2.76</measurement>
<measurement log_date="2013-04-11T14:00:00+00:00">2.07</measurement>
<measurement log_date="2013-04-12T16:00:00+00:00">2.07</measurement>
<measurement log_date="2013-04-11T23:00:00+00:00">2.53</measurement>
<measurement log_date="2013-04-11T15:00:00+00:00">2.06</measurement>
<measurement log_date="2013-04-12T00:00:00+00:00">4.32</measurement>
<measurement log_date="2013-04-11T16:00:00+00:00">2.06</measurement>
<measurement log_date="2013-04-12T18:00:00+00:00">1.12</measurement>
<measurement log_date="2013-04-11T08:00:00+00:00">1.62</measurement>
<measurement log_date="2013-04-12T10:00:00+00:00">2.08</measurement>
<measurement log_date="2013-04-11T17:00:00+00:00">2.07</measurement>
<measurement log_date="2013-04-11T09:00:00+00:00">1.62</measurement>
<measurement log_date="2013-04-12T02:00:00+00:00">3.67</measurement>
<measurement log_date="2013-04-11T18:00:00+00:00">2.08</measurement>
<measurement log_date="2013-04-12T19:00:00+00:00">1.12</measurement>
<measurement log_date="2013-04-12T20:00:00+00:00">2.49</measurement>
<measurement log_date="2013-04-11T10:00:00+00:00">1.62</measurement>
<measurement log_date="2013-04-12T17:00:00+00:00">1.87</measurement>
<measurement log_date="2013-04-12T12:00:00+00:00">2.07</measurement>
<measurement log_date="2013-04-11T19:00:00+00:00">2.08</measurement>
<measurement log_date="2013-04-12T15:00:00+00:00">2.08</measurement>
<measurement log_date="2013-04-11T11:00:00+00:00">1.62</measurement>
<measurement log_date="2013-04-12T03:00:00+00:00">2.86</measurement>
<measurement log_date="2013-04-12T09:00:00+00:00">2.07</measurement>
<measurement log_date="2013-04-12T13:00:00+00:00">2.06</measurement>
<measurement log_date="2013-04-12T04:00:00+00:00">2.86</measurement>
<measurement log_date="2013-04-12T05:00:00+00:00">2.44</measurement>
<measurement log_date="2013-04-12T01:00:00+00:00">5.73</measurement>
<measurement log_date="2013-04-11T20:00:00+00:00">3.59</measurement>
<measurement log_date="2013-04-12T11:00:00+00:00">2.09</measurement>
<measurement log_date="2013-04-12T08:00:00+00:00">2.05</measurement>
<measurement log_date="2013-04-11T12:00:00+00:00">1.92</measurement>
<measurement log_date="2013-04-12T07:00:00+00:00">2.05</measurement>
</period>
</interval_log>
<interval_log id="e72cc31866744b1cb87a0b5a1a4e9fb6">
<unit>Wh</unit>
<type>electricity_produced</type>
<last_consecutive_log_date/>
<updated_date/>
</interval_log>
</interval_logs>
</appliance>
Source URL /statistics.xml shows:

Code: Select all

<appliance>
<id>11</id>
<name>Miscellaneous 1</name>
<type>- Miscellaneous -</type>
<image>/pwimg/32/zz_misc_unknown.png</image>
<locked>False</locked>
<realstate>unknown</realstate>
<powerstate>unknown</powerstate>
<powerusage>0</powerusage>
<totalusage>6918</totalusage>
<moduleid>12</moduleid>
<macaddr>000D6F00002362D8</macaddr>
<moduletype>Circle</moduletype>
<room>- Miscellaneous -</room>
</appliance>
So I'm clearly missing the "totalusage" in the new situation. Now the question is, how can I build the historical information with the output from the Stretch?
User avatar
Rene
Global Moderator
Global Moderator
Posts: 1689
Joined: Wed Oct 08, 2008 3:54 pm
Location: Netherlands

Re: Building private history information with the Stretch

Post by Rene »

Statistics.xml shows totalusage?
Rene.
Post-IT
Member
Member
Posts: 448
Joined: Sat Feb 28, 2009 12:01 am
Location: Netherlands (Rotterdam)

Re: Building private history information with the Stretch

Post by Post-IT »

statistics.xml is only available in Source, not on the Stretch.
User avatar
Rene
Global Moderator
Global Moderator
Posts: 1689
Joined: Wed Oct 08, 2008 3:54 pm
Location: Netherlands

Re: Building private history information with the Stretch

Post by Rene »

Ah, was not paying attention
Rene.
Post-IT
Member
Member
Posts: 448
Joined: Sat Feb 28, 2009 12:01 am
Location: Netherlands (Rotterdam)

Re: Building private history information with the Stretch

Post by Post-IT »

I hope to adjust or add some xml files to the webroot of the Stretch, or maybe find other files/links which would help me.

I've tried to get a terminal connection using a usb-serial cable as described here: http://phoenixinteractive.mine.nu/websi ... ?f=27&t=43
However my efforts are without luck so far, the terminal output is scrambled and I've tried several speedsettings.

Hopefully I'll get it to work in the near future...
User avatar
RdP
Advanced Member
Advanced Member
Posts: 989
Joined: Thu May 04, 2006 10:14 am
Location: Netherlands

Re: Building private history information with the Stretch

Post by RdP »

This summer Plugwise will make an public API available for the Stretch, this would probably make it much easier to interface with the Stretch.

/Rien
Rien
Post-IT
Member
Member
Posts: 448
Joined: Sat Feb 28, 2009 12:01 am
Location: Netherlands (Rotterdam)

Re: Building private history information with the Stretch

Post by Post-IT »

Indeed that's what they've told me also, however they've also told me the Stretch would be launched this spring and this autumn... the past few years. And I think the API will only concentrate on switching and current usage, not on collection of historical data. This would make their portal useless.

And switching and current usage I have already working.
hapklaar
Starting Member
Starting Member
Posts: 6
Joined: Mon Jan 12, 2015 10:57 pm

Re: Building private history information with the Stretch

Post by hapklaar »

I'm sorry to have to add to such an old topic, but I was wondering if you made any progress on this.

I'm currently graphing Plugwise data in Zabbix, but found http://192.168.x.x/minirest/appliances often gives me 0 power usage for certain Circles when it shouldn't. This only happens for some modules, no idea why that is. (<current_power_usage>0</current_power_usage>). Maybe anyone else ran into this issue as well?

I found http://192.168.x.x/core/appliances is in fact returning valid figures for the modules all the time, but I still have to reconfigure the xml parse script I use to be able to read the xml this command returns.

This is an example of what I'm getting in Zabbix now.

Image
Post-IT
Member
Member
Posts: 448
Joined: Sat Feb 28, 2009 12:01 am
Location: Netherlands (Rotterdam)

Re: Building private history information with the Stretch

Post by Post-IT »

I haven't taken the time to look at this. I've noticed in the releasenotes of the new firmware there should be some more info about historical usage in the XML output. However I don't want to upgrade yet as I hope to get root access to the stretch using some exploits.
Post Reply

Return to “Plugwise Forum”