GithubHelp home page GithubHelp logo

Json object return type about ccu-jack HOT 4 CLOSED

mdzio avatar mdzio commented on May 22, 2024
Json object return type

from ccu-jack.

Comments (4)

mdzio avatar mdzio commented on May 22, 2024

The MQTT server can already store arbitrary JSON objects in arbitrary topics. For this, the retain flag of the message must be set. The payload must be structured as follows: {"v":{ any valid JSON object }}
However, the messages with retain flag are currently not yet persisted between restarts.

Another idea is to use a CCU system variable of type string to store and retrieve a stringified JSON object.

from ccu-jack.

Plurax avatar Plurax commented on May 22, 2024

MQTT retain would require to set it up once on startup. Thus I would have the necessity of a startup routine which holds the configuration. I want to keep the ui config (and ideally the broker IP, too) out of the react app.

I would appreciate the "string" variable path. For this I dont need the mqtt access, as the config might be big (currently I fetch it on load initially and create a device tree context with paths similar to the mqtt topics. So the value updates are done on mqtt websocket receive.
With this I would be able to configure the ui in the CCU3 without other dependencies and keep config code out of the project.

from ccu-jack.

mdzio avatar mdzio commented on May 22, 2024

This is already all possible as follows:

When loading the application, the configuration can be read out from a specific system variable via HTTP-GET, e.g. on the address /sysvar/1234/~pv. For this purpose, the ID of the system variable must be known. The ID can be determined via an HTTP GET on address /sysvar (system variable name must match property title).

If the web application is provided by the CCU-Jack itself, the host name does not have to be configured. The web application can be copied into the subdirectory webui.

from ccu-jack.

Plurax avatar Plurax commented on May 22, 2024

Thanks for clarification (and the web app path tip). For the record: Placing JSON in a string variable can cause code (JS) injection if someone is able to set the variable. Sparetime is rare but it works currently this way...

from ccu-jack.

Related Issues (20)

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.