This blog post describes how I have set up a door-open detector at home. It uses a small ATtiny85 board that broadcasts a 433 MHz signal every time the door is opened. The signal is fetched by a Raspberry Pi that in turn publishes an MQTT message that results in the event being stored in a database and also being re-published to a cloud service. The circuit is only active when the door is open (and in that state only consumes 10mA), so the whole setup can be driven by a battery pack that is bound to last for a very long time.
As described in some earlier posts, I have a setup at home with IoT devices that publish measurement messages to a Raspberry Pi via MQTT. The RPi stores the data in a database and also forwards the messages to a cloud service (Adafruit IO).
In this post I have made a self-hosted data visualization web app that can be accessed from any browser-enabled device.