I have been thinking about how “smart” IoT devices around us work these days and came up with a very high level picture of how things could work. Any system available commercially these days is a variation of the pattern below. You could breakdown this into finer details and design a system. Below is the very high level picture of what I thought about. You can scale this into multiple devices working together and cascading to be a very complex system requiring a lot of thought to engineer.