Documentation
HTML-SDK
Require: IP-Symcon >= 7.1
Description
The HTML SDK enables PHP modules to use an individual object presentation. This representation allows full flexibility thanks to HTML. Messages between the HTML representation and the module can be used to update the representation at runtime or to inform the module about user interaction.
Use HTML as representation
If the HTML SDK is to be used, the visualization must be activated with the function SetVisualizationType. If the tile is then to be displayed in the visualization, the function GetVisualizationTile is used to return the HTML content.
Translation
Analogous to configuration forms, the texts of the HTML elements of the visualization are also localized based on the user's language.
messages
The function GetVisualizationTile is initially called once. If the display is to be adjusted at runtime, this must be done via messages. Alternatively, messages enable a channel from the visualization to the module in order to switch variables or perform other interactions.
It is also possible to realize a comparable communication via a HTML-Box. However, on the one hand, this is quite complex and, on the other hand, involves the risk of creating security gaps that could be exploited. In comparison, communication via HTML SDK is secured in both directions with the visualization password.
Module to visualization
If a message is to be sent from the module to the visualization, the function UpdateVisualizationValue must be used in the module. In order to receive and process the content of this message in the display, the function handleMessage must be implemented via JavaScript. This function receives the content that the content that was sent with UpdateVisualizationTile exactly as input. The format of this data is absolutely free and should be selected to suit the module.
Visualization for module
The visualization can use the function requestAction via JavaScript. In return, this function executes the PHP function RequestAction on the module side, allowing the module to respond to the message.
Special functions in JavaScript
The HTML SDK offers a range of functions that can be used within the display via JavaScript.
Function | Description |
---|---|
handleMessage | This function must be defined to receive messages from the module |
requestAction | This function sends a message to the module |
translate | Translates text based on localization |
translateHTML | Translates the text of HTML elements based on the localization |
Webinar and examples
At the time of publication, the functionality of the HTML SDK was presented in a webinar on YouTube.
Some sample implementations can also be viewed and tried out in our test repository:
Example | Description |
---|---|
Duck counter | A small counter with detailed comments |
Heat pump | A complex and extensive example for the representation of a heat pump |