Skip to main content

Posts

Control OpenHab using Telegram Messenger

Recent posts

Angular 5, SpringBoot 2, Oauth2 and IMPLICIT flow - silent token refresh

Recently I've been working on simple web application for managing students and users. Application will be published on the internet, so it needs proper access control. I wanted to learn some new stuff, so I decided to use Angular5 with Oauth2 authentication. I didn't want to use any options as "Login with Facebook", or "Login with Google". I wanted my Spring Boot app to work as the authentication server and the resource server. I read a little abouth Oauth2 and different flows possible, and it turns out, that preffered flow to use with web application is IMPLICIT flow. Implicit flow uses only one token. It doesn't have a refresh token, as it could be overtaken by an attacker. Access token has defined validity period. In other flows, where refresh token exists it is used to get another access token when the first one expires. In theory in implicit flow user should just log again, but forcing a user to log in during active session is not an option.

Smart home with Raspberry PI

My first home automation system was based on Arduino and Raspberry PI . All the relays I wanted to control, the switches from which I received signals and temperature sensors that I used, were connected to the arduino mega with ethernet shield. Arduino was responsible for storing the states of individual devices. I had the MQTT server installed on Raspberry PI. Arduino sent all signals to the MQTT  they were downloaded by OpenHAB and made available to the user via a web GUI or a mobile application.  In addition, OpenHab could send user commands to MQTT. Arduino read messages from MQTT queue and updated the status of home appliances. The solution had one basic advantage: it worked :) However, there were a few problems that I mentioned in previous posts. These included: - complicated architecture - in case of problems there were many places to verify. - problems with power failures - arduino with ethernet shield has problems with proper boot after power outage. The system c

Raspberry PI and additional GPIO pins on several mcp23017 chips and a transistor switch

Some time ago I came to the conclusion that the home automation control system I made before was too complicated. I've been using a Raspberry PI + arduino + ethernet shield + additional connector board.  Arduino together with ethernet shield sometimes causes problems, especially after power outages. It has problems with restarting and requires manual restart. So this was the element I wanted to get rid of. It seems that the raspberry PI itself should definitely be enough. The only limitation is the number of GPIO pins and current efficiency. To avoid that problem I have already started designing the PCB which, when connected to raspberry, will provide us with additional pins and the ability use more power consumng devices. The easiest way to gain additional pins is to use the mcp23017 chip. It uses I2C bus to connect to the raspberry PI. Each chip will provide us with 16 additional pins. The chips can be connected together in chain, so you can have even more pins. I calculated t

Deploy java maven application from Bitbucket to ssh linux server automaticaly

Currently I'm working on a spring boot project.  The code is hosted on BitBucket GIT repository. I deploy  target application on Ubuntu Linux VPS server. At the beginning I was building my result jar manually, copying it manually to server, and restarting a service also manually using ssh shell. After some time I noticed, that it is quite annoying thing, so I decided to look around what other possibilities I have. It turned out that BitBucket has a solution ready to use, it just needs a little configuration. I'll describe full configuration process of Linux server and BitBucket account. At the end there will be possibility to deploy SpringBoot application from BitBucket to remote ssh server with just one click. Assumptions: App repository on BitBucket is called "backend". I'll be using dedicated user for deployment on Linux server. It will be  called also "backend". Linux server has already configured remote access via ssh. Linux

Anet A8 extruder modification with magnets and 40 mm to 80 mm fan adapter

I  recently bought my first 3D printer. It is Anet A8 - I think one of the cheapest 3D printers in the market. It is a great device, especialy if you are a tech guy who is not afraid of putting things together :) I found out, that there are many additional enhancement to this printer available. I've printed some of those, they work really well, but what I found very annoying in this printer, that it is very loud. I've changed all linear bearings and it helped a lot, but still an extruder fan was very noisy. I've seen some articles about replacing that fan with another, more quiet 40 mm one. Unfortunatelly,  those better ones fans are quite expensive. I decided I will try to replace 40 mm fan with quiet 80mm one, which in my case was cheaper and easily available. So, in this post I will show you my solution. It is first version, many things still need improvements, please treat it as a Proof of Concept  - but it works :) The first idea was to simply make some adapte