Read events from ESP8266

I am trying to understand how to listen for an event which is coming from WOT to Gateway. For example if i want to connect esp8266 with DHT11 or Generic motion sensor and Mozilla IOT gateway. Whenever i get any temperature change or motion detection event i want to show it in gateway or act on those events

Right now the best way to implement that would be for the sensor to be a binarySensor or multiLevelSensor. The gateway can then set rules based on the value of any numerical or boolean properties that you define in the sketch running on the ESP8266.

In the future I want to support Actions and Events in the ESP8266 library but creating a sensor with boolean and number properties satisfies most of the use cases.

Why is the gateway setting rules? As the developer of such a Thing, I know what numerical or boolean properties the Thing possesses and reports, and I can write code to present that information to a user. All that I need is a channel for retrieving arbitrary data from the Thing and some basic UI elements to present that information.

Because not everyone is a developer. The rules engine provides a UI for setting simple rules to automate your home.

As a developer you have access to the Web Thing API and can build whatever UI you like.

@nithyanantham would you share your code for connecting the ESP8266 w generic motion sensor to Webthings?