Smappee Support?

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

mcduarte2000
Posts: 24
Joined: Friday 17 July 2015 5:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Smappee Support?

Post by mcduarte2000 »

Hi,

Just started working with Domoticz and found it great! For now I will use with my Philips Hue. But, I also have a Smappee energy meter and it would be great to have it integrated in Domoticz.

Smappee has an API and has smart plugs. So, it should be easy to integrate in Domoticz (there is already something for OpenRemote - http://www.openremote.org/display/docs/ ... +-+Smappee) and we would get another way of controlling smart plugs.

I would do it myself, but I don't have the necessary programming skills... :( But if I can help in anyway, I will do it. :)

Miguel
BasPost
Posts: 13
Joined: Thursday 25 June 2015 15:14
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.2563
Contact:

Re: Smappee Support?

Post by BasPost »

mcduarte2000 wrote:Hi,

Just started working with Domoticz and found it great! For now I will use with my Philips Hue. But, I also have a Smappee energy meter and it would be great to have it integrated in Domoticz.

Smappee has an API and has smart plugs. So, it should be easy to integrate in Domoticz (there is already something for OpenRemote - http://www.openremote.org/display/docs/ ... +-+Smappee) and we would get another way of controlling smart plugs.

I would do it myself, but I don't have the necessary programming skills... :( But if I can help in anyway, I will do it. :)

Miguel
I'm in the exact situation! Would like also to see Smappee integrated with Domoticz, but I don't have the skills unfortunately.
mcduarte2000
Posts: 24
Joined: Friday 17 July 2015 5:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Smappee Support?

Post by mcduarte2000 »

I wouldn't mind to make some donation to someone which makes it work. Maybe if some more people are interested we could promote some sort of crowdfunding. :) Also I can help testing any development, of course.
BasPost
Posts: 13
Joined: Thursday 25 June 2015 15:14
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.2563
Contact:

Re: Smappee Support?

Post by BasPost »

mcduarte2000 wrote:I wouldn't mind to make some donation to someone which makes it work. Maybe if some more people are interested we could promote some sort of crowdfunding. :) Also I can help testing any development, of course.
+1
tomvanswam
Posts: 4
Joined: Sunday 02 August 2015 17:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2653
Location: Netherlands
Contact:

Re: Smappee Support?

Post by tomvanswam »

Hi,

I posted a script that is able to collect the Smappee usage data from their API.

You can find it here: http://pastebin.com/1Et4n8VP.

Instructions:

Code: Select all

#Move to your domoticz script folder
cd domoticz/script/
# Download the script:
use wget, or copy/paste from the link into a file called smappee.sh
#Make executable
sudo chmod ugo+x smappee.sh

#Add virtual Energy counter to Domoticz

#Change login details to Smappee and Domoticz
#And change sensor IDX in script
nano smappee.sh

#check if you have all the dependancies installed (listed in smappee.sh)

#setup the power counter
sudo echo "0" > /var/log/smappee.kwh

#change Crontab for root
sudo crontab -e
#add the following line:
*/5  * * * * /home/pi/domoticz/scripts/smappee.sh # replace /home/pi/ with the folder your domotics install is at

#Everything should be ok, and every 5 min the kWh value and Watt value will update
Have fun with it!

If anything is not working (as expected) don't hesitate to drop me a PM or mail.
Last edited by tomvanswam on Monday 10 August 2015 20:08, edited 1 time in total.
BasPost
Posts: 13
Joined: Thursday 25 June 2015 15:14
Target OS: Raspberry Pi / ODroid
Domoticz version: V2.2563
Contact:

Re: Smappee Support?

Post by BasPost »

Thank you so much! I will give it a try this week!
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Smappee Support?

Post by simonrg »

tomvanswam wrote:Hi,

I posted a script that is able to collect the Smappee usage data from their API.

You can find it here: http://pastebin.com/1Et4n8VP.

Have fun with it!

If anything is not working (as expected) don't hesitate to drop me a PM or mail.
Neat idea, a couple of errors - wget http://pastebin.com/1Et4n8VP - pastes the html code, I have tried wget http://pastebin.com/raw.php?i=1Et4n8VP - this gets the code without the html, but when I try to execute the .sh file, I get:

Code: Select all

pi@raspberrypi ~/domoticz/scripts/bash $ ./smappee.sh
-bash: ./test.sh: /bin/bash^M: bad interpreter: No such file or directory
So some code mangling must have happened.

In the end, I copy and pasted the code ok.

Line 42 of your bash script refers to $Path_JQ when it should be $JQ.

The code relies on being able to get the consumption every 5 minutes, if this fails, then the code runs, doesn't write anything to Domoticz and that 5 minutes consumption is lost. There needs to be a loop which basically starts from time of last upload and goes forward 5 minutes until current time retrieving the consumption for each 5 minutes and then uploads the cumulative energy usage.

I couldn't write to /var/log even as sudo, not sure why?

I have struggled to get Smappee to identify my devices, iron, kettle, hob, microwave and water pump are all identified as the same device. Have you managed to identify individual devices?
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
tomvanswam
Posts: 4
Joined: Sunday 02 August 2015 17:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2653
Location: Netherlands
Contact:

Re: Smappee Support?

Post by tomvanswam »

Hi Simon,
Thanks for your feedback! And to answer your questions...
Neat idea, a couple of errors - wget http://pastebin.com/1Et4n8VP - pastes the html code, I have tried wget http://pastebin.com/raw.php?i=1Et4n8VP - this gets the code without the html, but when I try to execute the .sh file, I get:

Code: Select all

pi@raspberrypi ~/domoticz/scripts/bash $ ./smappee.sh
-bash: ./test.sh: /bin/bash^M: bad interpreter: No such file or directory
So some code mangling must have happened.
In the end, I copy and pasted the code ok.
I'll remove the wget statement from the instructions and just tell people to copy paste in a new file.
Line 42 of your bash script refers to $Path_JQ when it should be $JQ.
Changed that in 2015-AUG-10 version
The code relies on being able to get the consumption every 5 minutes, if this fails, then the code runs, doesn't write anything to Domoticz and that 5 minutes consumption is lost. There needs to be a loop which basically starts from time of last upload and goes forward 5 minutes until current time retrieving the consumption for each 5 minutes and then uploads the cumulative energy usage.
Also updated in the 2015-AUG-10 version, I had the same problem. Now it runs ok(-ish, API is still not able to get me reliable data, so the data I get is a bit older than 5 min, or does not update when no valid data is retrieved).
I couldn't write to /var/log even as sudo, not sure why?
Not sure why either. Does the /var/log / folder exist?
I have struggled to get Smappee to identify my devices, iron, kettle, hob, microwave and water pump are all identified as the same device. Have you managed to identify individual devices?
I have, although not very easily as some devices (especially the ones that do not have a fixed power usage such as pc's television, micro waves (different power settings)) show up as multiple different devices with sometimes nearly the same usage. I bought a Fibaro Wall-Plug so i can get a bit more insight in the power usage of some stuff, match it with Smappee and assign the unnamed devices there to the right one. Plug in in a couple of days, and then move to the next device.
tomvanswam
Posts: 4
Joined: Sunday 02 August 2015 17:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2653
Location: Netherlands
Contact:

Re: Smappee Support?

Post by tomvanswam »

This line redirects all script output to syslog.

Somehow Synology does not support the redirects in the line, or logger is not installed.
I have no Synology to test, or (at this moment) the proper skills to rewrite the line to work the same, but without the redirects written like this.

It's safe to comment out the line, only downside is you will not get logging in syslog.
Which you will not get anyways, because all the logging info is commented out in the script (see the #echo lines).
mcduarte2000
Posts: 24
Joined: Friday 17 July 2015 5:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Smappee Support?

Post by mcduarte2000 »

This line redirects all script output to syslog.

Somehow Synology does not support the redirects in the line, or logger is not installed.
I have no Synology to test, or (at this moment) the proper skills to rewrite the line to work the same, but without the redirects written like this.

It's safe to comment out the line, only downside is you will not get logging in syslog.
Which you will not get anyways, because all the logging info is commented out in the script (see the #echo lines).
Thank you for you comments! :)

I actually deleted my post (didn't want to bother you), as I did commented the line and tested the other lines on my synology. There were other errors. :(

So I ordered a Raspberry. ;) Waiting for it to arrive and then I'll give feedback how things work.
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Smappee Support?

Post by gizmocuz »

a donation would help, but 200 euro's is a bit to much (... whauw with 1 plug...)
maybe better to use some fibaro wall plugs ?
Quality outlives Quantity!
tomvanswam
Posts: 4
Joined: Sunday 02 August 2015 17:40
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2653
Location: Netherlands
Contact:

Re: Smappee Support?

Post by tomvanswam »

gizmocuz wrote:a donation would help
Would a login to a Smappee help? The API key can be obtained by sending an email to Smappee, if a dev would want to invest some time in writing a better solution, or 'Domoticz native' sensor, I don't mind sharing my login with them.
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Smappee Support?

Post by simonrg »

I have written a Lua program which runs in Lua outside Domoticz, which collects your energy consumption from Smappaa via its api every 5 minutes and injects the data into Domoticz. I have tested it for a fair while as the authentication protocol needs to work for tokens which expire, which it seems to do.

Currently it works for me, and hopefully should for anybody else with both a 2 clamp Smappee system, one for household electricity consumption and the other for solar. If you have only 1 clamp it will either crash or just store dummy data.

I need to write some instructions - in the meantime the program is on GitHub - https://github.com/steps39/Domoticz_Smappee, I will be writting a readme and putting instructions on the wiki - http://www.domoticz.com/wiki/Smappee.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Smappee Support?

Post by simonrg »

I have created a wiki page which describes how to transfer Smappee data into Domoticz using a Lua program, smappee.lua - http://www.domoticz.com/wiki/Smappee.

Please provide any feedback and / or correct the Wiki if you spot any errors.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
mcduarte2000
Posts: 24
Joined: Friday 17 July 2015 5:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Smappee Support?

Post by mcduarte2000 »

simonrg wrote:I have created a wiki page which describes how to transfer Smappee data into Domoticz using a Lua program, smappee.lua - http://www.domoticz.com/wiki/Smappee.

Please provide any feedback and / or correct the Wiki if you spot any errors.
Tested your script and:

- On the sh script the directory is wrong, it should be "/home/pi/domoticz_smappee/smappee.lua", and not "/home/pi/energy/smappee.lua";
- Couldn't access the Smappee api without for the first time getting the access_token and refresh_token by hand (and filling them on the user variables in Domoticz);
- Even when not using solar energy I had to create the solar energy virtual device (if not, the script would not work);
- The directory line on Cron on the wiki was wrong, I already corrected it. :)

Now it seems to be working. :)

Many thanks!,

Miguel
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Smappee Support?

Post by simonrg »

mcduarte2000 wrote:- On the sh script the directory is wrong, it should be "/home/pi/domoticz_smappee/smappee.lua", and not "/home/pi/energy/smappee.lua";
- Couldn't access the Smappee api without for the first time getting the access_token and refresh_token by hand (and filling them on the user variables in Domoticz);
- Even when not using solar energy I had to create the solar energy virtual device (if not, the script would not work);
- The directory line on Cron on the wiki was wrong, I already corrected it. :)
Miguel,

Thanks for feedback and correcting the wiki :D , I have now corrected smappe.sh so it points to the correct directory and correct smappee.lua so it should now correctly retrieve new token if it doesn't have either a correct access or refresh token.

I will leave it so you have to create a solar energy meter even if you don't have solar panels for the time being.

Simon
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
mcduarte2000
Posts: 24
Joined: Friday 17 July 2015 5:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Smappee Support?

Post by mcduarte2000 »

I will leave it so you have to create a solar energy meter even if you don't have solar panels for the time being.
No problem, I guess we can adjust it ourselves if we want. We may even need to increase in one meter (as was thinking to divide my home in 3 "meters", the maximum allowed by Smappee). So if you change the script in the future to be variable allow us to use up to 3 meters please. ;)

Miguel
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Smappee Support?

Post by simonrg »

mcduarte2000 wrote:No problem, I guess we can adjust it ourselves if we want. We may even need to increase in one meter (as was thinking to divide my home in 3 "meters", the maximum allowed by Smappee). So if you change the script in the future to be variable allow us to use up to 3 meters please. ;)
Miguel
You obviously know more about Smappe than I do, how do you divide your home into 3 meters? Do you need to buy 2 more meters? Or is this via the software?

Currently I think Smappee will be returning at least 2 if not 3 values to you, "consumption", ("solar" 0) and "alwayson". I am not using the "alwayson" value. So I guess with a 3 phase system and solar, then Smappee would return 5 values.

How successful are have you been with identifying your appliances with the Smappee system?

I have started another thread to see if anybody is using any of the other Smappee features - http://www.domoticz.com/forum/viewtopic.php?f=21&t=7631.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
mcduarte2000
Posts: 24
Joined: Friday 17 July 2015 5:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Smappee Support?

Post by mcduarte2000 »

simonrg wrote:Currently I think Smappee will be returning at least 2 if not 3 values to you, "consumption", ("solar" 0) and "alwayson". I am not using the "alwayson" value. So I guess with a 3 phase system and solar, then Smappee would return 5 values.
I contacted support some weeks ago to understand what the non-documented "Monitor Mode" -> "three single phases" meant. They confirmed me it would allow me to have 3 clamps. (check the attached print-screen)

My idea is to separate the electricity circuit in 3 separate circuits:
- General devices;
- Air conditioner;
- Big Machines (washing, air dryer, oven, fridge, ...).

Support confirmed me this should allow Smappee to better identify the devices.
simonrg wrote:How successful are have you been with identifying your appliances with the Smappee system?
I have a problem when the Air Conditioner is on (a multi-split unit, with 5 units), which is very variable in terms of signature and really confuses Smappee. This is actually the main reason I was thinking in dividing the circuit in 3 separate ones.

With A/C off Smappee is not 100% precise (it does mistakes), but works good enough to be able to detect the general consumption of most of the devices. So I already took some decisions which allowed me to reduce my electrical consumption (and I would say, I will end up recovering Smappee cost!).
Attachments
2015-08-18 17_38_52-Clipboard.png
2015-08-18 17_38_52-Clipboard.png (24.01 KiB) Viewed 8429 times
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Smappee Support?

Post by simonrg »

mcduarte2000 wrote:I contacted support some weeks ago to understand what the non-documented "Monitor Mode" -> "three single phases" meant. They confirmed me it would allow me to have 3 clamps. (check the attached print-screen)

My idea is to separate the electricity circuit in 3 separate circuits:
- General devices;
- Air conditioner;
- Big Machines (washing, air dryer, oven, fridge, ...).

Support confirmed me this should allow Smappee to better identify the devices.

I have a problem when the Air Conditioner is on (a multi-split unit, with 5 units), which is very variable in terms of signature and really confuses Smappee. This is actually the main reason I was thinking in dividing the circuit in 3 separate ones.

With A/C off Smappee is not 100% precise (it does mistakes), but works good enough to be able to detect the general consumption of most of the devices. So I already took some decisions which allowed me to reduce my electrical consumption (and I would say, I will end up recovering Smappee cost!).
Ok so your house has 3 phase supply, I guess you are not in the UK where almost all domestic properties have single phase supply.

I guess obviously if you remove 2/3rds of the devices by putting them onto 2 new phases then Smappee has a better chance of identifying any appliance without overlap. My problem appears to be that all my devices are energy efficient and vary their power depending on demand, so ceramic hub, oven and microwave all look identical to Smappee.

In terms of Domoticz then Domoticz will detect when Smappee tries to turn a plug on or off and you can assign these to Domoticz switches, which can then be used in scripts.

Where does your screenshot come from?
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests