diff --git a/.gitignore b/.gitignore
index 9cbcb6fada295dbd9f98d5dd3053dbe7b118386d..f5da09800d156dffbec2598a14b5986919156548 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ __pycache__
 /venv/
 /.mypy_cache
 /.idea
+/*.egg-info
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000000000000000000000000000000000000..f5a0871d5deb558542105e0ae9f2111141152ec9
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,45 @@
+default:
+  image: debian-python-build:v2
+
+# Is performed before the scripts in the stages step
+before_script:
+  - source /etc/profile
+  # Load the ssh private key from the gitlab build variables to enable dupload
+  # to connect to the repo via scp
+  - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
+  - eval $(ssh-agent -s)
+  - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
+  - mkdir -p ~/.ssh
+  - chmod 700 ~/.ssh
+  - ssh-keyscan repo.stusta.mhn.de >> ~/.ssh/known_hosts
+  - chmod 644 ~/.ssh/known_hosts
+
+# Defines stages which are to be executed
+stages:
+  - build_buster
+  - upload_to_repo
+
+# Stage "build_buster"
+build_buster:
+  stage: build_buster
+  script:
+    - apt update
+    - apt install -y python3-stdeb python-all
+    - dpkg-buildpackage -us -uc
+    - mkdir -p build/
+    - mv deb_dist/* build/
+
+  # The files which are to be made available in GitLab
+  artifacts:
+    paths:
+      - build/*
+
+upload_to_repo:
+  stage: upload_to_repo
+  script:
+    - echo "Uploading debian package to ssn repository"
+    - ssh repo@repo.stusta.mhn.de "echo SSH-Connection working"
+    - dupload -f -t ssn_repo build/tempermonitor*.changes
+  when: manual
+  only:
+    - master
diff --git a/build.sh b/build.sh
new file mode 100644
index 0000000000000000000000000000000000000000..1e8a47ddcecd1f19add51127ea98e5fb8f51ab2e
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+
+rm -rf deb_dist tempermonitor.egg-info dist
+python3 setup.py --command-packages=stdeb.command bdist_deb
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000000000000000000000000000000000000..e367eef7d054fd17d3c1f4f708d62a1bfeecfc0b
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+tempermonitor (2.0.0) buster; urgency=medium
+
+  * Initial debian release
+
+ -- Michael Loipführer <ml@stusta.de>  Thu, 23 Apr 2020 19:15:18 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000000000000000000000000000000000000..b4de3947675361a7770d29b8982c407b0ec6b2a0
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+11
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000000000000000000000000000000000000..d3e1959cbcbf429a603b01bd9971bc92e3818e91
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,31 @@
+Source: tempermonitor
+Maintainer: Michael Loipführer <ml@stusta.de>
+Section: python
+Priority: optional
+Build-Depends: python3-setuptools, python3-all, debhelper (>= 7)
+Standards-Version: 3.9.1
+Package: python3-tempermonitor
+Architecture: all
+Depends: ${misc:Depends}, ${python3:Depends}
+Description: Tempermonitor sensor temperature reading deamon
+ This is the StuStaNet Temperature Monitoring System.
+ .
+ # Hardware Setup and Protocol
+ .
+ The temperature sensors are ds18x20 sensors connected via the onewire protocol
+ to an esp32. The esp is connected via usb-serial to the host computer.
+ This sends roughly every second a measurement value from one of the sensors.
+ After a complete round it sends an empty line.
+ .
+ # Dependencies
+ .
+ pyserial-asyncio. And >=python3.5.
+ .
+ # Architecture
+ The communications is done within the temperature_daemon.py file as well as
+ error handling for the sensor measurements.
+ It will then call functions in plugins to do the majority of the work.
+ .
+ The plugins are located in the `plugins` folder.
+ .
+
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000000000000000000000000000000000000..31636b365403e3f62e5355b9a296960386f8c3b3
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,5 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: tempermonitor
+Source: gitlab.stusta.de/stustanet/temperature-daemon
+
+License: GPL
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000000000000000000000000000000000000..561c60eca4d2b2d62b0c448d90cd105d162e9915
--- /dev/null
+++ b/debian/install
@@ -0,0 +1 @@
+etc/* /etc/
\ No newline at end of file
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000000000000000000000000000000000000..2a9ab808fd04f3d479ffa93278d9b20713fbb181
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,31 @@
+#!/usr/bin/make -f
+
+# This file was automatically generated by stdeb 0.9.0 at
+# Thu, 23 Apr 2020 19:15:18 +0200
+
+%:
+	dh $@ --with python3 --buildsystem=python_distutils
+
+
+override_dh_auto_clean:
+	python3 setup.py clean -a
+	find . -name \*.pyc -exec rm {} \;
+
+
+
+override_dh_auto_build:
+	python3 setup.py build --force
+
+
+
+override_dh_auto_install:
+	python3 setup.py install --force --root=debian/python3-tempermonitor --no-compile -O0 --install-layout=deb  
+
+
+
+override_dh_python2:
+	dh_python2 --no-guessing-versions
+
+
+
+
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000000000000000000000000000000000000..163aaf8d82b6c54f23c45f32895dbdfdcc27b047
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/source/options b/debian/source/options
new file mode 100644
index 0000000000000000000000000000000000000000..bcc4bbb3217def7b4792dd3c39b0a7f0120d6663
--- /dev/null
+++ b/debian/source/options
@@ -0,0 +1 @@
+extend-diff-ignore="\.egg-info$"
\ No newline at end of file
diff --git a/debian/tempermonitor.service b/debian/tempermonitor.service
new file mode 100644
index 0000000000000000000000000000000000000000..47ab6dc3586e8471b3d06c8d51fbf9152921e1c5
--- /dev/null
+++ b/debian/tempermonitor.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=SSN temperature monitoring service
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/python3 -m tempermonitor
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tempermon.ini b/etc/tempermon.ini
similarity index 81%
rename from tempermon.ini
rename to etc/tempermon.ini
index 03228124fc87a03d75b5b1ddd8bb28663c3ab91b..3e6ccd2cd9616ce4dd8d7b20916968597e862c1b 100644
--- a/tempermon.ini
+++ b/etc/tempermon.ini
@@ -2,13 +2,11 @@
 plugins=prometheus,mail,warnings
 
 [serial]
-#port=/dev/ttyUSB0
 port=/tmp/temperature_pts
 baudrate=115200
 timeout=100
 
 [collectd]
-#socketpath=/var/run/collectd-unixsock
 socketpath=/tmp/collectd_sock
 hostname=hugin
 interval=1
@@ -16,6 +14,7 @@ interval=1
 [prometheus]
 sensor_metric_name=ssn_container_temperature
 aggregated_metric_name=ssn_container_temperature_agg
+address=localhost
 port=9199
 
 [mail]
@@ -32,10 +31,3 @@ min_ceiling_warning=35
 floor_ceiling_diff=15
 ceiling_warning_level=40
 
-[testsensor]
-name=Test
-calibration=5
-
-[sensortest]
-name=Test2
-calibration=5
diff --git a/micropython.py b/micropython/micropython.py
similarity index 100%
rename from micropython.py
rename to micropython/micropython.py
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000000000000000000000000000000000000..c2f3c1ffd04e207ea5b6ae015272d3377eab8cd3
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,32 @@
+from setuptools import setup
+
+VERSION = '2.0.0'
+
+
+def readme():
+    with open('README.md') as f:
+        return f.read()
+
+
+setup(
+    name='tempermonitor',
+    version=VERSION,
+    description='Tempermonitor sensor temperature reading deamon',
+    long_description=readme(),
+    url='http://gitlab.stusta.de/stustanet/temperature-daemon',
+    classifiers=[
+        'Development Status :: 5 - Production/Stable',
+        'License :: OSI Approved :: MIT License',
+        'Programming Language :: Python :: 3.7',
+        'Operating System :: POSIX :: Linux'
+    ],
+    install_requires=[
+        'asyncio',
+        'pyserial-asyncio',
+        'prometheus_client'
+    ],
+    license='MIT',
+    packages=['tempermonitor'],
+    include_package_data=True,
+    zip_safe=False
+)
diff --git a/ssn_tempermonitor.service b/ssn_tempermonitor.service
deleted file mode 100644
index b5fc6840d0d6e2b22b163fd6054d94559d3321bb..0000000000000000000000000000000000000000
--- a/ssn_tempermonitor.service
+++ /dev/null
@@ -1,11 +0,0 @@
-[Unit]
-Description=SSN temperature monitoring service
-After=network.target
-
-[Service]
-WorkingDirectory=/usr/local/bin/temperature-daemonv2/
-ExecStart=/usr/local/bin/temperature-daemonv2/venv/bin/python /usr/local/bin/temperature-daemonv2/tempermonitor.py tempermon_hugin.ini
-Restart=on-failure
-
-[Install]
-WantedBy=multi-user.target
diff --git a/stdeb.cfg b/stdeb.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..c2aca2c9eef92dea11728cd6d83a9f95a758aaaa
--- /dev/null
+++ b/stdeb.cfg
@@ -0,0 +1,3 @@
+[tempermonitor]
+Depends: python3-serial-asyncio python3-prometheus-client
+Suite: buster
diff --git a/tempermonitor/__init__.py b/tempermonitor/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/tempermonitor/__main__.py b/tempermonitor/__main__.py
new file mode 100644
index 0000000000000000000000000000000000000000..a1c422fab25a9336560599f4e3fe17b179c37fe8
--- /dev/null
+++ b/tempermonitor/__main__.py
@@ -0,0 +1,5 @@
+from tempermonitor.tempermonitor import main
+
+
+if __name__ == '__main_':
+    main()
diff --git a/tempermonitor/plugins/__init__.py b/tempermonitor/plugins/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/plugins/collectd.py b/tempermonitor/plugins/collectd.py
similarity index 100%
rename from plugins/collectd.py
rename to tempermonitor/plugins/collectd.py
diff --git a/plugins/mail.py b/tempermonitor/plugins/mail.py
similarity index 100%
rename from plugins/mail.py
rename to tempermonitor/plugins/mail.py
diff --git a/plugins/prometheus.py b/tempermonitor/plugins/prometheus.py
similarity index 100%
rename from plugins/prometheus.py
rename to tempermonitor/plugins/prometheus.py
diff --git a/plugins/warnings.py b/tempermonitor/plugins/warnings.py
similarity index 100%
rename from plugins/warnings.py
rename to tempermonitor/plugins/warnings.py
diff --git a/tempermonitor.py b/tempermonitor/tempermonitor.py
similarity index 99%
rename from tempermonitor.py
rename to tempermonitor/tempermonitor.py
index 82b87297fa19f8c54f67cfa91682e9a425b524b4..fd674b38439513504ed59132a2788343bb144f19 100755
--- a/tempermonitor.py
+++ b/tempermonitor/tempermonitor.py
@@ -297,6 +297,3 @@ def main():
     finally:
         loop.run_until_complete(monitor.teardown())
 
-
-if __name__ == "__main__":
-    main()