How to use the thingtalk.Entity function in thingtalk

To help you get started, we’ve selected a few thingtalk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stanford-oval / thingpedia-common-devices / com.yandex.translate / detect_language.js View on Github external
return Tp.Helpers.Http.get(url).then((response) => {
            console.log(response);
            var parsed = JSON.parse(response);
            if (parsed.code != 200)
                throw new Error('Failed to translate');

            return [[text, new TT.Entity(parsed.lang, languages[parsed.lang])]];
        });
    },
github stanford-oval / thingengine-core / lib / apps / exec_wrapper.js View on Github external
constructor(engine, app, compiled, output) {
        super(engine.platform.locale, engine.platform.timezone, engine.schemas);
        this.engine = engine;
        this.app = app;
        this._programId = new ThingTalk.Entity(this.app.uniqueId, null);
        this._output = output;

        this._functions = compiled.functions;
        this._states = [];
        this._states.length = compiled.states;
        for (let i = 0; i < compiled.states; i++)
            this._states[i] = new ChannelState(engine.platform, 'app:' + app.uniqueId + ':' + i);

        this._trigger = null;

        this._execCache = [];
    }