The set up the lock, we had to set up the different cloud services.
First of all we need an account for IBM cloud, Sebatian and Aksel made two different account. The IBM cloud gives acces to NodeRed. We also made at an MQTT server.
From the NodeRed, we can via the MQTT send different messages to the NodeMCU, and we can also send message from the NodeMCU to the NodeRed – also via the MQTT.
To begin with, we controlled the lock in a simple way. In the NodeRed we set up a flow, connected to the NodeMCU, and programmed the lock to open if it received the text “unlock”. The unlock message is send from a text field. Other messages typed in the text field could also be send and showed on the OLED.
Afterwards we created an unlock button in the NodeRed instead, which sends the unlock message to the MQTT, so that the lock would unlock and the OLED would show “unlock”. All messages was send from NodeRed via the MQTT server to the NodeMCU.