Group 4 PERCCOM (GreenSOFAA&CO2)

Members: Group Members

  • Manich Lamichhane
  • Tamara Belyakhina
  • Rafiul Sabbir
  • Felipe Leon
  • Andrey Kochemassov
  • Olga Rybnytska.


Reducing energy consumption and heat loss by using movement detectionin the office.

Nowadays in most offices people spend more time than in their apartments. Working place became a very important place for every employee, and therefore companies spend thousands euros in order to make this place better. But usually people are careless about the resources they are spending: for example, when it is too hot in the room, instead of reducing the temperature in the room, the employee usually just opens the window. The company pays for the heating of the building, the company pays electricity bills, so for a particular worker there is no need to think about reducing its own energy consumption.

Following this logic, the company owners now need to think about the ways to reduce their expenses on heating and consuming of energy. Our team tried to imagine and implemented a particular scenario about reducing energy consumption and thus saving the costs for company owners.


For our scenario we used a set of equipment, which includes motion sensor, dimmer, Twilight sensor and thermostat. Firstly, our system will detect the movement in the room using the motion sensor as a trigger. If there are people inside the room - the motion sensor will detect the movement and all the other sensors will start to work. If there's nobody inside - there's no need for running the whole system.

The next step comes when the sensor detects the movements. Usually companies try to build spacious offices, full of light and with big windows from floor to the ceiling. During sunny days, the sunlight easily comes through these windows to the room, increasing the temperature inside. Our light sensor will detect if the day is sunny, and then the control is going to the thermostat. If the temperature inthe room starts to increase, the thermostat will detect it and at some threshold value the heating of the room will be stopped.

Usually in most of the companies working day is scheduled, and it is easy to predict the end of working hours. Therefore, the other part of our system will control whether the employee turned off the lights in the office or not. After 15 minutes of the end of working day the motion sensor will check if the room is empty or not. If it is empty and the lights are still turned on - then the system will send a notification to the e-mail address of the worker, informing that the lights are still on, and inviting to come back and turn off the lights. If after another 15 minutes the lights are still on, that means that we are dealing with an irresponsible employee and there’s a need to change people’s behaviour. That means the system will automatically turn off the lights via the usage of dimmer, and the employee will be penalised with a certain amount of money cut off from the salary.

Equipment in use

  • wireless PIR motion detector „FS20 PIRI-2“ - 1,
  • remote control - 1,
  • wireless twilight transmitter „FS20 SD“ - 1,
  • radio heating thermostat „FHT80B-3“ - 1,
  • remote dimmer „FS20 DI“ - 1,
  • radio controlled door/window contact „FHT80TF-2“ - 1.

Protocol to Present:



  • Reliability
  • Low power consumption
  • Self Healing network
  • Security Features


  • Interference with other devices
  • Slow market expansion

Calculation of Savings

Electrical equipment:

Normal Scenario

  • 9 working hours per day
  • 5 days per week
  • 46 weeks (4 weeks of vacations + 2 weeks for business trips)
  • 1 PC, 2 Flat screens, 1 printer and lights
  • Price of 1 kWh = 0.05 euros.

Automation Scenario

  • 7 working hours per day
  • 5 days per week
  • 46 weeks (4 weeks of vacations + 2 weeks for business trips)
  • 1 PC, 2 Flat screens, 1 printer and lights
  • Price of 1 kWh = 0.05 euros.

Climate control:

Normal Scenario

  • 12 working hours per day
  • 5 days per week
  • 52 weeks
  • 18 m2, electric heating, comfort temperature 20-22C.
  • Default CO2 emission for Finland = 0.225 kgCO2/kWh

Automation Scenario:

  • 9 working hours per day
  • 5 days per week
  • 46 weeks (4 weeks of vacations + 2 weeks for business trips)
  • 18 m2, electric heating, comfort temperature 20-22C.
  • Default CO2 emission for Finland = 0.225 kgCO2/kWh

Savings of CO2 emission per year per employee - 141.85 kgCO2

Savings of costs per year per employee - 33.59 euros.

Useful documentation


Definition of code for Email notification:

# $Id: 7570 2015-01-14 18:31:44Z rudolfkoenig $
# Save this file as, and create your own functions in the new
# file. They are then available in every Perl expression.

package main;

use strict;
use warnings;
use POSIX;

my ($hash) = @_;

# Enter you functions below _this_ line.

my $rcpt = shift;
my $subject = shift; 
my $text = shift;
my $attach = shift; 
my $ret = "";
my $sender = "cubie\"; 
my $konto = "cubie\";
my $passwrd = "ericrondeau";
my $provider = "";
Log 1, "sendEmail RCP: $rcpt";
Log 1, "sendEmail Subject: $subject";
Log 1, "sendEmail Text: $text";
Log 1, "sendEmail Anhang: $attach";;

$ret .= qx(sendEmail -f '$sender' -t '$rcpt' -u '$subject' -m '$text' -a '$attach' -s '$provider' -xu '$konto' -xp '$passwrd' -o tls=auto -o message-charset=utf-8);
$ret =~ s,[\r\n]*,,g; # remove CR from return-string 
Log 1, "sendEmail returned: $ret"; 


fhem.cfg file:

attr global userattr cmdIcon devStateIcon devStateStyle icon msgContactAudio msgContactLight msgContactMail msgContactPush msgContactScreen msgRecipient msgRecipientAudio msgRecipientLight msgRecipientMail msgRecipientPush msgRecipientScreen msgRecipientText sortby webCmd widgetOverride
attr global autoload_undefined_devices 1
attr global logfile ./log/fhem-%Y-%m.log
attr global modpath .
attr global motd SecurityCheck:\
WEB,WEBphone,WEBtablet has no basicAuth attribute.\
telnetPort has no password/globalpassword attribute.\
Restart FHEM for a new check if the problem is fixed,\
or set the global attribute motd to none to supress this message.\

attr global statefile ./log/
attr global updateInBackground 1
attr global verbose 3

define telnetPort telnet 7072 global

define WEB FHEMWEB 8083 global

define WEBphone FHEMWEB 8084 global
attr WEBphone stylesheetPrefix smallscreen

define WEBtablet FHEMWEB 8085 global
attr WEBtablet stylesheetPrefix touchpad

# Fake FileLog entry, to access the fhem log from FHEMWEB 
define Logfile FileLog ./log/fhem-%Y-%m.log fakelog

define autocreate autocreate
attr autocreate filelog ./log/%NAME-%Y.log

define eventTypes eventTypes ./log/eventTypes.txt

# Disable this to avoid looking for new USB devices on startup
define initialUsbCheck notify global:INITIALIZED usb create
define CSM CUL /dev/ttyS1@38400 1234
define HMS100TF_a090 HMS a090
attr HMS100TF_a090 IODev CSM
attr HMS100TF_a090 room HMS
define FileLog_HMS100TF_a090 FileLog ./log/HMS100TF_a090-%Y.log HMS100TF_a090:T:.*
attr FileLog_HMS100TF_a090 logtype temp4hum6:Temp/Hum,text
attr FileLog_HMS100TF_a090 room HMS
define SVG_HMS100TF_a090 SVG FileLog_HMS100TF_a090:SVG_HMS100TF_a090:CURRENT
attr SVG_HMS100TF_a090 label "HMS100TF_a090 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_HMS100TF_a090 room Plots
define PIRI_Group8 FS20 815a 00
attr PIRI_Group8 IODev CSM
attr PIRI_Group8 room FS20
define FileLog_PIRI_Group8 FileLog ./log/PIRI_Group8-%Y.log PIRI_Group8
attr FileLog_PIRI_Group8 logtype text
attr FileLog_PIRI_Group8 room FS20
define FileLog_ThermostatG8 FileLog ./log/ThermostatG8-%Y.log ThermostatG8
attr FileLog_ThermostatG8 logtype fht:Temp/Act,text
attr FileLog_ThermostatG8 room FHT
define SVG_ThermostatG8 SVG FileLog_ThermostatG8:SVG_ThermostatG8:CURRENT
attr SVG_ThermostatG8 label "ThermostatG8 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_ThermostatG8 room Plots
define FileLog_FHT_5212 FileLog ./log/FHT_5212-%Y.log FHT_5212
attr FileLog_FHT_5212 logtype fht:Temp/Act,text
attr FileLog_FHT_5212 room FHT
define SVG_FHT_5212 SVG FileLog_FHT_5212:SVG_FHT_5212:CURRENT
attr SVG_FHT_5212 label "FHT_5212 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_FHT_5212 room Plots
define FileLog_FS20_256800 FileLog ./log/FS20_256800-%Y.log FS20_256800
attr FileLog_FS20_256800 logtype text
attr FileLog_FS20_256800 room FS20
define FileLog_FS20_256801 FileLog ./log/FS20_256801-%Y.log FS20_256801
attr FileLog_FS20_256801 logtype text
attr FileLog_FS20_256801 room FS20
define FileLog_FS20_256802 FileLog ./log/FS20_256802-%Y.log FS20_256802
attr FileLog_FS20_256802 logtype text
attr FileLog_FS20_256802 room FS20
define FileLog_FS20_256803 FileLog ./log/FS20_256803-%Y.log FS20_256803
attr FileLog_FS20_256803 logtype text
attr FileLog_FS20_256803 room FS20
define FileLog_FHT_1339 FileLog ./log/FHT_1339-%Y.log FHT_1339
attr FileLog_FHT_1339 logtype fht:Temp/Act,text
attr FileLog_FHT_1339 room FHT
define SVG_FHT_1339 SVG FileLog_FHT_1339:SVG_FHT_1339:CURRENT
attr SVG_FHT_1339 label "FHT_1339 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_FHT_1339 room Plots
define DimmerG8 FS20 42b0 00
attr DimmerG8 IODev CSM
attr DimmerG8 room FS20
attr DimmerG8 showtime 1
attr DimmerG8 stateFormat 1
define FileLog_DimmerG8 FileLog ./log/DimmerG8-%Y.log DimmerG8
attr FileLog_DimmerG8 logtype text
attr FileLog_DimmerG8 room FS20
define lightG8 FS20 42b0 38
attr lightG8 IODev CSM
attr lightG8 room FS20
define FileLog_lightG8 FileLog ./log/lightG8-%Y.log lightG8
attr FileLog_lightG8 logtype text
attr FileLog_lightG8 room FS20
define globalMsg msgConfig
attr globalMsg comment FHEM Global Configuration for command 'msg'
attr globalMsg group Global
attr globalMsg stateFormat fhemMsgState
attr globalMsg verbose 3
define FileLog_FHT_4549 FileLog ./log/FHT_4549-%Y.log FHT_4549
attr FileLog_FHT_4549 logtype fht:Temp/Act,text
attr FileLog_FHT_4549 room FHT
define SVG_FHT_4549 SVG FileLog_FHT_4549:SVG_FHT_4549:CURRENT
attr SVG_FHT_4549 label "FHT_4549 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_FHT_4549 room Plots
define HMS100TF_cab9 HMS cab9
attr HMS100TF_cab9 IODev CSM
attr HMS100TF_cab9 room HMS
define FileLog_HMS100TF_cab9 FileLog ./log/HMS100TF_cab9-%Y.log HMS100TF_cab9:T:.*
attr FileLog_HMS100TF_cab9 logtype temp4hum6:Temp/Hum,text
attr FileLog_HMS100TF_cab9 room HMS
define SVG_HMS100TF_cab9 SVG FileLog_HMS100TF_cab9:SVG_HMS100TF_cab9:CURRENT
attr SVG_HMS100TF_cab9 label "HMS100TF_cab9 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_HMS100TF_cab9 room Plots
define FileLog_FS20_ff2a00 FileLog ./log/FS20_ff2a00-%Y.log FS20_ff2a00
attr FileLog_FS20_ff2a00 logtype text
attr FileLog_FS20_ff2a00 room FS20
define FileLog_FS20_ff2a01 FileLog ./log/FS20_ff2a01-%Y.log FS20_ff2a01
attr FileLog_FS20_ff2a01 logtype text
attr FileLog_FS20_ff2a01 room FS20
define FileLog_FS20_1be41b FileLog ./log/FS20_1be41b-%Y.log FS20_1be41b
attr FileLog_FS20_1be41b logtype text
attr FileLog_FS20_1be41b room FS20
define FileLog_FHT_3232 FileLog ./log/FHT_3232-%Y.log FHT_3232
attr FileLog_FHT_3232 logtype fht:Temp/Act,text
attr FileLog_FHT_3232 room FHT
define SVG_FHT_3232 SVG FileLog_FHT_3232:SVG_FHT_3232:CURRENT
attr SVG_FHT_3232 label "FHT_3232 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_FHT_3232 room Plots
define ThermostatG8_not notify Thermo8:measured-temp.* \
    if ($EVTPART1 gt "22.0")\
       fhem "set Thermo8 desired-temp 20"\

attr ThermostatG8_not disable 1
define FileLog_FS20_1be400 FileLog ./log/FS20_1be400-%Y.log FS20_1be400
attr FileLog_FS20_1be400 logtype text
attr FileLog_FS20_1be400 room FS20
define Thermo8 FHT 2d34
attr Thermo8 IODev CSM
attr Thermo8 room FHT
define FileLog_Thermo8 FileLog ./log/Thermo8-%Y.log Thermo8
attr FileLog_Thermo8 logtype fht:Temp/Act,text
attr FileLog_Thermo8 room FHT
define SVG_Thermo8 SVG FileLog_Thermo8:SVG_Thermo8:CURRENT
attr SVG_Thermo8 label "Thermo8 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_Thermo8 room Plots
define LightThermo notify PIRI_Group8:.*\
{ fhem "set DimmerG8 on" }
attr LightThermo disable 1
define FileLog_FS20_6ce101 FileLog ./log/FS20_6ce101-%Y.log FS20_6ce101
attr FileLog_FS20_6ce101 logtype text
attr FileLog_FS20_6ce101 room FS20
define FileLog_FS20_777700 FileLog ./log/FS20_777700-%Y.log FS20_777700
attr FileLog_FS20_777700 logtype text
attr FileLog_FS20_777700 room FS20
define FileLog_FS20_6ce100 FileLog ./log/FS20_6ce100-%Y.log FS20_6ce100
attr FileLog_FS20_6ce100 logtype text
attr FileLog_FS20_6ce100 room FS20
define winG8 CUL_FHTTK 268e63
attr winG8 IODev CSM
attr winG8 room CUL_FHTTK
define FileLog_winG8 FileLog ./log/winG8-%Y.log winG8
attr FileLog_winG8 logtype fht80tf:Window,text
attr FileLog_winG8 room CUL_FHTTK
define SVG_winG8 SVG FileLog_winG8:SVG_winG8:CURRENT
attr SVG_winG8 label "winG8 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_winG8 room Plots
define OpenWindow notify winG8:Window.* \
   if ($EVTPART1 eq "Open")\
       fhem "set Thermo8 desired-temp 16.0"\
attr OpenWindow disable 1
define PiriChange notify PIRI_Group8:.* \
  fhem "set DimmerG8 on;;;;set Thermo8 desired-temp 20;;;;delete timerMotion;;;;delete timerHeating;;;;define timerMotion at +00:01:30 set DimmerG8 off;;;;define timerHeating at +00:01:30 set Thermo8 desired-temp 8.0"\
attr PiriChange disable 0
define heatingOn dummy
attr heatingOn userattr 1
define notificationEmail MSGMail cubie@cubieez /etc/dovecot/users
attr notificationEmail CR 0
attr notificationEmail authfile /opt/fhem/users.conf
attr notificationEmail from cubie@cubieez
attr notificationEmail mailtype plain
attr notificationEmail smtphost
attr notificationEmail smtpport 465
attr notificationEmail subject notficication from codecamp
attr notificationEmail to
define myEmail MSGMail cubie@cubeez /etc/fhem/users
attr myEmail CR 1
attr myEmail authfile /etc/fhem/users
attr myEmail from cubie@cubeez
attr myEmail mailtype plain
attr myEmail smtphost
attr myEmail subject FHEM
attr myEmail to
define notifyMail notify PIRI_Group8:.* \
{ fhem "delete timerMail;;;;define timerMail at +00:02:30 DebianMail (' ',' FHEM email ',' this is test body ','')" \
attr notifyMail disable 1
define FHT_3133 FHT 3133
attr FHT_3133 IODev CSM
attr FHT_3133 room FHT
define FileLog_FHT_3133 FileLog ./log/FHT_3133-%Y.log FHT_3133
attr FileLog_FHT_3133 logtype fht:Temp/Act,text
attr FileLog_FHT_3133 room FHT
define SVG_FHT_3133 SVG FileLog_FHT_3133:SVG_FHT_3133:CURRENT
attr SVG_FHT_3133 label "FHT_3133 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_FHT_3133 room Plots
define FHT_5012 FHT 5012
attr FHT_5012 IODev CSM
attr FHT_5012 room FHT
define FileLog_FHT_5012 FileLog ./log/FHT_5012-%Y.log FHT_5012
attr FileLog_FHT_5012 logtype fht:Temp/Act,text
attr FileLog_FHT_5012 room FHT
define SVG_FHT_5012 SVG FileLog_FHT_5012:SVG_FHT_5012:CURRENT
attr SVG_FHT_5012 label "FHT_5012 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_FHT_5012 room Plots
define CUL_FHTTK_b9b7d6 CUL_FHTTK b9b7d6
attr CUL_FHTTK_b9b7d6 IODev CSM
attr CUL_FHTTK_b9b7d6 room CUL_FHTTK
define FileLog_CUL_FHTTK_b9b7d6 FileLog ./log/CUL_FHTTK_b9b7d6-%Y.log CUL_FHTTK_b9b7d6
attr FileLog_CUL_FHTTK_b9b7d6 logtype fht80tf:Window,text
attr FileLog_CUL_FHTTK_b9b7d6 room CUL_FHTTK
define SVG_CUL_FHTTK_b9b7d6 SVG FileLog_CUL_FHTTK_b9b7d6:SVG_CUL_FHTTK_b9b7d6:CURRENT
attr SVG_CUL_FHTTK_b9b7d6 label "CUL_FHTTK_b9b7d6 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_CUL_FHTTK_b9b7d6 room Plots
define FS20_42b001 FS20 42b0 01
attr FS20_42b001 IODev CSM
attr FS20_42b001 room FS20
define FileLog_FS20_42b001 FileLog ./log/FS20_42b001-%Y.log FS20_42b001
attr FileLog_FS20_42b001 logtype text
attr FileLog_FS20_42b001 room FS20
define FS20_4d7b00 FS20 4d7b 00
attr FS20_4d7b00 IODev CSM
attr FS20_4d7b00 room FS20
define FileLog_FS20_4d7b00 FileLog ./log/FS20_4d7b00-%Y.log FS20_4d7b00
attr FileLog_FS20_4d7b00 logtype text
attr FileLog_FS20_4d7b00 room FS20
define FS20_1b1b00 FS20 1b1b 00
attr FS20_1b1b00 IODev CSM
attr FS20_1b1b00 room FS20
define FileLog_FS20_1b1b00 FileLog ./log/FS20_1b1b00-%Y.log FS20_1b1b00
attr FileLog_FS20_1b1b00 logtype text
attr FileLog_FS20_1b1b00 room FS20
define FS20_1be411 FS20 1be4 11
attr FS20_1be411 IODev CSM
attr FS20_1be411 room FS20
define FileLog_FS20_1be411 FileLog ./log/FS20_1be411-%Y.log FS20_1be411
attr FileLog_FS20_1be411 logtype text
attr FileLog_FS20_1be411 room FS20
define FS20_1be401 FS20 1be4 01
attr FS20_1be401 IODev CSM
attr FS20_1be401 room FS20
define FileLog_FS20_1be401 FileLog ./log/FS20_1be401-%Y.log FS20_1be401
attr FileLog_FS20_1be401 logtype text
attr FileLog_FS20_1be401 room FS20

Report and Presentation Slides