GithubHelp home page GithubHelp logo

demo-things's Introduction

SIFIS-Home Demo Things repository

Things

  • Lamp
  • On-Off Switch
  • Sink
  • Ticking Door
  • Ticking Sensor
  • Oven
  • Fridge

Supported platforms

  • Unix-like

Running the demos

Each demo is an independent binary, which can be run with:

cargo run --bin <demo_name>

where <demo_name> can be one of the following:

  • fridge
  • lamp
  • on-off-switch-brightness-fade
  • on-off-switch-brightness-float-fade
  • on-off-switch-brightness-float
  • on-off-switch-brightness
  • on-off-switch-fade
  • on-off-switch
  • on-off-switch-toggle
  • oven
  • sink
  • ticking-door
  • ticking-sensor

Getting more info

It is possible to obtain some useful information from the running webserver using the RUST_LOG environment variable. For instance, you can use the following to get some debug information from a demo:

RUST_LOG=debug cargo run --bin <demo_name>

demo-things's People

Contributors

dodomorandi avatar lu-zero avatar luni-4 avatar

Stargazers

Jan Romann avatar

Watchers

 avatar  avatar Luca Ardito avatar  avatar

demo-things's Issues

Submit data to the wot-testing TestFest

Follow w3c/wot-testing@dc45bc4:

Since we do not support ThingModels:

  • Create directory for new implementation in data/input_2022/TD
  • Copy manual.csv to this directory, rename after your implementation, and fill it in
  • If you have TDs for automatic testing, add a "TDs" directory and put them in there, using .td.jsonld suffixes
  • Update batchValidation.sh to add a section to refer to your implementation

Add a fridge demo

The fridge is an aggregate of separate things:

  • One Thermostat
  • One Door

Simulation

  • The Door can be open or closed
  • The temperature may increase or decrease over time

Every tick:

  • If the temperature is higher than the target set the fridge will lower the temperature by its delta_lower constant.
  • If the door is open the temperature will be increased by delta_door_open otherwise it is increased by delta_door_closed.

Add a sink demo

Webthings does not have something that maps to it, so we won't use an ontology.

The sink has a faucet with two properties

  • flow expressed by percentage
  • temperature expressed by degrees C in a range from 10 to 80

The sink also has a drain with a single binary property open/close.

The sink has a final read-only property level that is expressed in a percentage 0~100.

The sink has leak event.

It simulates the basin increasing its level according to increments of {flow}/{rate} per tick. The fill rate is a configuration item.

Simulation

The configuration has also a simulation section that uses the same approach as the other demo things and simulates changes over the drain, flow and temperature properties to model an user manual operation.

Consider enabling CORS

I tried to use the lamp demo with my WoT Consumer and it was unable to fetch the Thing Description using JavaScript because CORS is not enabled:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:3000/.well-known/wot. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.

As a minimum you would need to set a header like the following in HTTP responses:

Access-Control-Allow-Origin: *

Add a door demo

  • Exposes a DoorSensor and a Lock
  • Errors if the Door is open according to the sensor and any Lock Action is requested
  • Takes a configuration file that changes the state of the door over ticks (Open, Closed, Locked) simulating access.
  • Hot-reloads the configuration file.

Add a Sensor demo

  • Prepare a sensor exposing itself as TemperatureSensor and HumiditySensor
  • Make it take a configuration file that contains a list of (target, variation per tick) for both humidity and temperature.
  • Make it able to hot reload the configuration file

Add an oven

The oven is pretty much a fridge with the logic inverted and optionally an additional probe Thermometer.

  • it has a Door
  • it has at least one heating element with a temperature target and a temperature

Need `base` member or absolute URLs in `href` members

When I try to add the lamp Thing to my WoT Consumer, it complains that the Thing Description is not valid because the values of href are not valid URLs.

The reason for this is that the values of href are paths, not full URLs, and there's no base member with a root URL to resolve them against.

I assume that you intend for the paths to be relative to the root of the domain, but once a Thing Description is added to a directory there is no way for a Consumer to know what the source origin was. It's therefore not possible for a Consumer to fetch any of the URLs provided in Forms.

I think you need to either:

  • Add a base member which provides the root URL against which href members should be resolved
  • Make href members absolute URLs

Note that this requires that the server knows the host from which the Thing Description is being served, which will not always be localhost.

Implement function logic for lamp device

Implement the function logic for lamp device. The function logic represents how a Thing responds to an event that an hardware or a simulated device can spawn. Thus this kind of logic, that replies to the events, should be as more separate as possible from the simulated and hardware implementation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.