Automagically + Xively = True

http://automagucally.weebly.com

Moderators: davka003, Telldus

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re: Automagically + Xively = True

Post by KHolm » Thu Jan 18, 2018 11:08 am

davka003 wrote:I keep trying to find time to review the pull request. But it seems to be updated now and then :-) i do My best this weekend. What I am afraid of is its dependency to other software. I would not like to have it to install software automatically nor can it crash systems that doesn't have it installed.
No worries, take your time. I have made yet another update of the pull requests to take away any of your doubts. I have now removed the dependency to requests pip module and reverted back to httplib (same as used by tellduslive plugin).

So, no longer any needs to install any extra software - requests was anyway only used because I was lazy :wink:

/Marcus
ps. I don't have any plans for more updates - only bug-fixes if any found...
ps2. Wiki updated...
ps3. For those who can't wait for the approval of the plugin:

Code: Select all

$ sudo /etc/init.d/automagically stop
$ cd ~/source/automagically/site/plugins/
$ sudo rm xively.py*
$ wget https://bitbucket.org/MarcusKarlsson/automagically/raw/ead5b08eb03c36341f9f0f3516f69b6891f11301/site/plugins/xively.py
$ sudo /etc/init.d/automagically start

misterleffe
Posts: 57
Joined: Thu Jan 18, 2018 11:08 am

Re: Automagically + Xively = True

Post by misterleffe » Thu Jan 18, 2018 11:08 am

Ok, thanks everyone for all your efforts. Finally we got a solution and soon also integrated in Automagcially. Thanks KHolm and davka003!

Next step is to looking for new "problems" in the Automagically guys! Maybe there is a solution for this already?

I plan to implement a kwH meter in my Automagically system. A photodiode counting "LED blinks" described here: http://foogadgets.blogspot.se/ Can this be handle by conversing the signal in Signal Transform, to measure my energy metering? I'm sure that you "Brains" easally solve this ...

Maybe this should be put in a New Topic? I leave this for Admin to decide this.



/misterleffe

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re: Automagically + Xively = True

Post by KHolm » Thu Jan 18, 2018 11:08 am

misterleffe wrote: Maybe this should be put in a New Topic? I leave this for Admin to decide this.
Yes it is :D
misterleffe wrote: I plan to implement a kwH meter in my Automagically system. A photodiode counting "LED blinks" described here: http://foogadgets.blogspot.se/ Can this be handle by conversing the signal in Signal Transform, to measure my energy metering? I'm sure that you "Brains" easally solve this ...
From what I could read, to get the readings should work just out of the box. You might have to use a Dynamic transform in order to convert from 35.2 to 352 blinks which I think represented Watt (1000 blinks = 1kW according to provided link).

Dynamic transform is described here: http://automagically.weebly.com/1/post/ ... sform.html

I think your Signal Transforms (/admin/signals/transform/) will simply be:

Code: Select all

Pattern to match:   tellstick,sensor,protocol:fineoffset,id:999,Temperature,value:%f
Send the following: $EVAL:"foogadget,id:999,Energy,value:" + str(($1*10) + $accumulated_energy$)
Then you add a Signal Store global variables (/admin/signals/storeglobalvariable/)

Code: Select all

Pattern to match:         foogadget,id:999,Energy,value:%f
Parsed variable to store: 1
Variable to store:        accumulated_energy
Then I'd use a Scheduled event in combination with Send signal device to reset the thing every now and then in some way. Daily is simple but to make it happen the 1st day of the month may require some fiddling around. But a combination of a Send signal device and a Dynamic transform should do the trick.

Should you however want to use the built it, through protocol with dual virtual devices and packet loss detection, data recovery mechanism you would need to develop a new plug-in. Should not be a major deal; I'll do it for you if you get me such a device :P

But to just get the data fed into a variable is simple.

/Marcus

niclasf
Posts: 162
Joined: Thu Jan 18, 2018 11:08 am
Contact:

Re: Automagically + Xively = True

Post by niclasf » Thu Jan 18, 2018 11:08 am

Hi Marcus,
We could agree on something if you contact me through my contact info at http://foogadgets.tictail.com

misterleffe
Posts: 57
Joined: Thu Jan 18, 2018 11:08 am

Re: Automagically + Xively = True

Post by misterleffe » Thu Jan 18, 2018 11:08 am

niclasf wrote:Hi Marcus,
We could agree on something if you contact me through my contact info at http://foogadgets.tictail.com
This is very good news! If (when) the plugin is ready to be launched, I will for sure, test it. Thanks!



/misterleffe

niclasf
Posts: 162
Joined: Thu Jan 18, 2018 11:08 am
Contact:

Post by niclasf » Thu Jan 18, 2018 11:08 am

One wireless energy meter is on its way to mr Marcus :)

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re: Automagically + Xively = True

Post by KHolm » Thu Jan 18, 2018 11:08 am

First step accomplished while waiting for the wireless energy meter. A wireless energy meter simulator plugin.

The plugin simulates the behavior of the wireless energy meter by sending a random energy value (10.0-40.0), sending both as a primary device and a secondary device (which carries the penultimate number).

It is possible to induce errors into the simulator asking it to simulate dropped packages on both primary channel and secondary channel.

Drop one package on primary channel: t_sim,action:drop_prim,1
Drop one package on secondary channel: t_sim,action:drop_sec,1
Drop two package on primary channel: t_sim,action:drop_prim,2
...

It has two configurations. Enabled and Interval where the interval is the time between the simulator sends simulated events. Normally 60 sec, but a bit more effective debugging if it's set to 10 :)

So, progressing...let's see tomorrow if I understood the description on http://foogadgets.tictail.com/product/w ... ergy-meter correct.

/Marcus
Attachments
t_sim_ver_0.1.zip
Wireless energy meter simulator plugin
Version 0.1 (still waiting to confirm behavior)
(1.54 KiB) Downloaded 178 times

niclasf
Posts: 162
Joined: Thu Jan 18, 2018 11:08 am
Contact:

Post by niclasf » Thu Jan 18, 2018 11:08 am

Tummen upp :)

jimmy927
Posts: 27
Joined: Thu Jan 18, 2018 11:08 am
Location: Stockholm
Contact:

Re: Automagically + Xively = True

Post by jimmy927 » Thu Jan 18, 2018 11:08 am

Xively seems cool, but i am slightly concerned about their pricing model as it seems to target the Enterprise market.
Are you guys using free dev-accounts ?
A basic account costs like 999 USD / year.

I red this on their www:

Development devices store data for 30 days.
Developer Account API limit 25 API calls per minute, 3 minute moving average.

Personally i have 22 temp-sensors giving a signal every 50-60s, so i wont be even able to come under their "25 API calls per minute" limit either. Assuming i would accept that sensor-data is deleted after 30 days ...

Any thoughts on this ?

niclasf
Posts: 162
Joined: Thu Jan 18, 2018 11:08 am
Contact:

Automagically + Xively = True

Post by niclasf » Thu Jan 18, 2018 11:08 am

I thought that you could bundle many uploads in one. Not sure how that will count.

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re:

Post by KHolm » Thu Jan 18, 2018 11:08 am

niclasf wrote:One wireless energy meter is on its way to mr Marcus :)
One energy meter arrived and quickly tested.

Logs from wireless energy meter:

Code: Select all

2014-02-25 18:26:12.300452 system signaldebug,configuration,changed   

2014-02-25 18:26:18.286526 tellstick tellstick,raw:class:sensor;protocol:fineoffset;id:69;model:temperaturehumidity;humidity:98;temp:0.1;   
2014-02-25 18:26:18.510039 tellstick tellstick,raw:class:sensor;protocol:fineoffset;id:68;model:temperaturehumidity;humidity:99;temp:0.1;   

2014-02-25 18:27:22.893713 tellstick tellstick,raw:class:sensor;protocol:fineoffset;id:69;model:temperaturehumidity;humidity:99;temp:0.1;   
2014-02-25 18:27:23.102013 tellstick tellstick,raw:class:sensor;protocol:fineoffset;id:68;model:temperaturehumidity;humidity:0;temp:0.1;   

2014-02-25 18:28:27.533732 tellstick tellstick,raw:class:sensor;protocol:fineoffset;id:69;model:temperaturehumidity;humidity:0;temp:0.1;   
2014-02-25 18:28:27.740153 tellstick tellstick,raw:class:sensor;protocol:fineoffset;id:68;model:temperaturehumidity;humidity:1;temp:0.1;   

2014-02-25 18:29:32.338817 tellstick tellstick,raw:class:sensor;protocol:fineoffset;id:69;model:temperaturehumidity;humidity:1;temp:0.1;   
2014-02-25 18:29:32.547211 tellstick tellstick,raw:class:sensor;protocol:fineoffset;id:68;model:temperaturehumidity;humidity:2;temp:21.3;   

2014-02-25 18:30:37.125450 tellstick tellstick,raw:class:sensor;protocol:fineoffset;id:69;model:temperaturehumidity;humidity:2;temp:21.3;   
2014-02-25 18:30:37.316162 tellstick tellstick,raw:class:sensor;protocol:fineoffset;id:68;model:temperaturehumidity;humidity:3;temp:0.1;   

2014-02-25 18:31:41.895180 tellstick tellstick,raw:class:sensor;protocol:fineoffset;id:69;model:temperaturehumidity;humidity:3;temp:0.1;   
2014-02-25 18:31:42.103871 tellstick tellstick,raw:class:sensor;protocol:fineoffset;id:68;model:temperaturehumidity;humidity:4;temp:0.1;   

2014-02-25 18:32:46.652543 tellstick tellstick,raw:class:sensor;protocol:fineoffset;id:69;model:temperaturehumidity;humidity:4;temp:0.1;   
2014-02-25 18:32:46.841649 tellstick tellstick,raw:class:sensor;protocol:fineoffset;id:68;model:temperaturehumidity;humidity:5;temp:0.1;   
The identified 21.3 is me measuring the HD led of the computer :)
Noted:
- The wireless energy meter always reports 0.1 even if not seen a single blink
- The wireless energy meter is not precisely sending every minute. Seems to be drifting 4-5 sec per minute; Conditions: Indoor, +21C

Logs from simulator (ver 0.3)

Code: Select all

2014-02-25 19:45:02.695686	system	signaldebug,configuration,changed 	

2014-02-25 19:45:25.486285	t_sim	tellstick,raw:class:sensor;protocol:fineoffset;id:69;model:temperaturehumidity;humidity:98;temp:32.8; 	
2014-02-25 19:45:25.486761	t_sim	tellstick,raw:class:sensor;protocol:fineoffset;id:68;model:temperaturehumidity;humidity:99;temp:32.1; 
	
2014-02-25 19:45:35.487698	t_sim	tellstick,raw:class:sensor;protocol:fineoffset;id:69;model:temperaturehumidity;humidity:99;temp:32.1; 	
2014-02-25 19:45:35.488073	t_sim	tellstick,raw:class:sensor;protocol:fineoffset;id:68;model:temperaturehumidity;humidity:0;temp:14.0; 	

2014-02-25 19:45:45.489101	t_sim	tellstick,raw:class:sensor;protocol:fineoffset;id:69;model:temperaturehumidity;humidity:0;temp:14.0; 	
2014-02-25 19:45:45.489327	t_sim	tellstick,raw:class:sensor;protocol:fineoffset;id:68;model:temperaturehumidity;humidity:1;temp:27.3; 	

2014-02-25 19:45:55.489543	t_sim	tellstick,raw:class:sensor;protocol:fineoffset;id:69;model:temperaturehumidity;humidity:1;temp:27.3; 	
2014-02-25 19:45:55.489811	t_sim	tellstick,raw:class:sensor;protocol:fineoffset;id:68;model:temperaturehumidity;humidity:2;temp:13.3; 	

2014-02-25 19:46:05.489814	t_sim	tellstick,raw:class:sensor;protocol:fineoffset;id:69;model:temperaturehumidity;humidity:2;temp:13.3; 	
2014-02-25 19:46:05.490208	t_sim	tellstick,raw:class:sensor;protocol:fineoffset;id:68;model:temperaturehumidity;humidity:3;temp:27.5; 	

2014-02-25 19:46:15.491041	t_sim	tellstick,raw:class:sensor;protocol:fineoffset;id:69;model:temperaturehumidity;humidity:3;temp:27.5; 	
2014-02-25 19:46:15.491278	t_sim	tellstick,raw:class:sensor;protocol:fineoffset;id:68;model:temperaturehumidity;humidity:4;temp:37.5; 	

2014-02-25 19:46:25.491560	t_sim	tellstick,raw:class:sensor;protocol:fineoffset;id:69;model:temperaturehumidity;humidity:4;temp:37.5; 	
2014-02-25 19:46:25.491991	t_sim	tellstick,raw:class:sensor;protocol:fineoffset;id:68;model:temperaturehumidity;humidity:5;temp:20.2; 	
Simulator (t_sim) Version 0.3:
* Behaves like the developer version of the wireless energy meter. Starting to count on 99 (primary) and 98 (secondary)
* Acts on the following signals:
  • t_sim,action:drop_prim,N - Number of packages that shall be simulated lost in transmission for primary channel. Replace N with number of dropped packages to simulate.
  • t_sim,action:drop_sec,N - Number of packages that shall be simulated lost in transmission for secondary channel. Replace N with number of dropped packages to simulate.
  • t_sim,action:set_seq,N - Set the sequence number of the primary channel. The secondary channel will be set to N - 1. Replace N with wanted sequence number between 0 and 99
  • t_sim,action:restart - Restart the simulator by resetting counters and simulate start-up behavior
  • t_sim,action:send - When interval is 0, use this to initiate the next signal (manual mode)
Next step is to revise the code
Attachments
t_sim_ver_0.3.zip
Version 0.3, confirmed behaviour
(2.19 KiB) Downloaded 184 times

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re: Automagically + Xively = True

Post by KHolm » Thu Jan 18, 2018 11:08 am

jimmy927 wrote:Xively seems cool, but i am slightly concerned about their pricing model as it seems to target the Enterprise market.
Are you guys using free dev-accounts ?
I think you are spot on. I think I mentioned that in an earlier post.
KHolm wrote:We're not really their target audience.
And yes, I use the free developer account - I don't have the same need as you have.
jimmy927 wrote:Any thoughts on this ?
The Xively plugin works in two modes. One where you use a signal transform and one where you send variables.
If you use the signal mode, there will be one API call per executed transform. So, with 22 temp sensors sending every 50-60 calls/minyou will pass the limit.

However, if you use the variable mode, the plugin will send all variables in one request and you can set how often you want it to update Xively, starting from every second up to....I don't really know.
So, if you set the "Interval" to 60, you will send one API call per minute; well below limits.

So, depending on your need, a developer account can be enough.

/Marcus

niclasf
Posts: 162
Joined: Thu Jan 18, 2018 11:08 am
Contact:

Re: Automagically + Xively = True

Post by niclasf » Thu Jan 18, 2018 11:08 am

Noted:
- The wireless energy meter always reports 0.1 even if not seen a single blink
That is true. This is due to a limitation in the PIC counter. It will always skip the first positive flank after a reset. Thus it will not count the first pulse. To get around this, I initialize the counter to 1. This is however not a problem since you in the normal case use more than 60Wh. Not sure what kind of house it would be if not :)
- The wireless energy meter is not precisely sending every minute. Seems to be drifting 4-5 sec per minute; Conditions: Indoor, +21C
This is a problem with using the internal oscillator in the PIC. It is not very accurate and dependent of voltage and temperature, as you say.
This is however not a really big problem since you can use the timestamps from when the data was received at the server side.

The total Energy consumption can be calculated by summing up the incoming data

Code: Select all

Etotal = Etotal + temp*10/1000
, where Etotal is the consumed energy in kWh and temp is the incoming temperature.

The Power usage can also be calculated,

Code: Select all

Pmom = temp*10/1000*60*60/(Time_now - Time_previous)
temp is the incoming temperature.
60/(Time_now - Time_previous) is the compensation factor that compensates for the drift in time. In this way the Power reading will be exact.

misterleffe
Posts: 57
Joined: Thu Jan 18, 2018 11:08 am

Re: Automagically + Xively = True

Post by misterleffe » Thu Jan 18, 2018 11:08 am

Hopefully there will be something nice out of this! Keep on guys!


/misterleffe

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re: Automagically + Xively = True

Post by KHolm » Thu Jan 18, 2018 11:08 am

misterleffe wrote:Hopefully there will be something nice out of this! Keep on guys!


/misterleffe
There is, but lifted it to new post:
http://www.telldus.com/forum/viewtopic.php?f=25&t=4258

/Marcus

Post Reply