Code Monkey home page Code Monkey logo

iobroker.tileboard's Introduction

Logo

ioBroker.tileboard

Number of Installations Number of Installations NPM version Downloads

NPM

WEB visualisation for ioBroker platform based on TileBoard for Home Assistant. Big thanks to Alexey Ivanov.

Installation & Documentation

Control interface

TileBoard creates 3 variables:

  • control.instance - Here the browser instance should be written or "*" if every browser must be controlled.
  • control.data - Parameter for command. See specific command description.
  • control.command - Command name. Write this variable triggers the command. That means before command will be written the "instance" and "data" must be prepared with data.

Commands:

  • alert - show alert window in TileBoard. "control.data" has following format "message;title;jquery-icon". Title and jquery-icon are optional. Icon names can be found here. To show icon "ui-icon-info" write Message;;info.
  • changeView - switch to desired view. "control.data" must have the index or title of view, like defined in config.
  • refresh - reload TileBoard, for instance after project is changed to reload on all browsers.
  • reload - same as refresh.
  • popup - opens a new browser window. Link must be specified in "control.data", e.g. http://google.com
  • playSound - play sound file. The link to file is specified in "control.data", e.g. http://www.modular-planet.de/fx/marsians/Marsiansrev.mp3. You can upload your own file in TileBoard and let it play as for instance "/tileboard.0/main/img/myFile.mp3".

If user changes the view or at start the variables will be filled by TileBoard with

  • "control.instance": browser instance and ack=true
  • "control.data": the page title as defined in config
  • "control.command": "changedView" and ack=true

You can write the JSON-string or Object into control.command as {instance: 'AABBCCDD', command: 'cmd', data: 'ddd'}. In this case the instance and data will be taken from JSON object.

Alert

To get more settings for alert you can send following structure to adjust every parameter of the notification popup from script adapter.

setState('tileboard.0.control.command', JSON.stringify({
    command: "alert",
    instance: "*",
    data: {
        "icon": "mdi-car",        // Material icon
        "type": "info",           // Type: info, warning, error, success
        "title": "Information",   // Header of the message
        "message": "Hello world", // Text of the message
        "lifetime": 5,            // Seconds
    }
}));

For developers

How to merge the original repository into this one:

Following files were change:

  • /index.html - added ../tileboard.0/custom.css, ../../lib/js/socket.io.js, ./_socket/info.js and scripts/vendors/conn.js, removed styles/custom.css
  • /scripts/models/api.js - completely replaced
  • /scripts/controllers/main.js -

Extended function getItemEntity:

   $scope.getItemEntity = function (item) {
      if(typeof item.id === "object") return item.id;

      if(!(item.id in $scope.states)) { // IoB
          if (typeof Api.getState === 'function') {
              Api.getState(item.id);
          } else {
              warnUnknownItem(item);
          }
          return null;
      }

      return $scope.states[item.id];
   };

added function setNewStates:

    // IoB - required for lazy load of the states, becasue every update of the single state cause the request of all states again.
    // To avoid that all states must be updated at once and only then updateView should be called.
    function setNewStates (states) {
        states.forEach(function (state) {
            if(!$scope.states[state.entity_id]) $scope.states[state.entity_id] = state.new_state;

            // Is it required? If $scope.states[key] just assigned?
            for(var k in state.new_state) $scope.states[state.entity_id][k] = state.new_state[k];
        });
    }

Modified function:

   function handleEvent (event) {
      try {
         if (event.event_type === "state_changed") {
            debugLog('state change', event.data.entity_id, event.data.new_state);

            if (event.data instanceof Array) { // IoB
                setNewStates(event.data);
                event.data.forEach(function (state) {
                    checkStatesTriggers(state.entity_id, state.new_state);
                });
            } else {
                setNewState(event.data.entity_id, event.data.new_state);
                checkStatesTriggers(event.data.entity_id, event.data.new_state);
            }
         }
         else if (event.event_type === "tileboard") {
            debugLog('tileboard', event.data);

            triggerEvents(event.data);
         }
      }
      catch (e) {console.error(e);}
      updateView();
   }

At the end: if(CONFIG.pingConnection !== false) { =>

   if (CONFIG.pingConnection) { // Changed for IoB 
  • /styles/main.less(css) Added:
@media screen and (max-height: 770px) { // IoB
  .header {
    display: none;
  }
}

Changelog

0.3.1 (2020-08-22)

  • (bluefox) The compatibility to socket.io 3.0.13 provided

0.3.0 (2020-01-23)

  • (yaming116) fixed pingConnection
  • (bluefox) Changes of the original tileboard were merged

0.2.0 (2019-07-15)

  • (bluefox) Changes of the original tileboard were merged

0.1.1 (2019-02-12)

  • (bluefox) Changes of the original tileboard were merged

0.1.0 (2019-01-16)

  • (bluefox) initial commit

License

Copyright (c) 2019-2020 bluefox [email protected]

MIT License

iobroker.tileboard's People

Contributors

apollon77 avatar germanbluefox avatar yaming116 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

iobroker.tileboard's Issues

Compatibility check to js-controller 4.0

Dear Adapter developer,

with js-controller 4.0 object definitions are now also checked that min/max in only provided for number/mixed objects and that the type of the default value matches to the object type.

If something is not correct this is logged as 'warning' or 'info' log.

Please also make sure to update to the lastest @iobroker/testing dependency 2.5.4 or to accept the PR from Apollon77 for legacy testing!

Please spent some time to verify your adapter by ideally starting with a fresh instance and do some actions and verify the log. If you see a warn or info log there from these checks please adjust the adapter and fix the relevant cases.

For questions please refer to ioBroker/ioBroker.js-controller#1749

Please close the issue after you checked it.

Thank you very much for your support to get the best experience for the growing numbers of ioBroker users!

Think about to fix the issues found by adapter checker

I am an automatic service that looks for possible errors in ioBroker and creates an issue for it. The link below leads directly to the test:

https://adapter-check.iobroker.in/?q=https://raw.githubusercontent.com/ioBroker/ioBroker.tileboard

  • [E150] No common.connectionType found in io-package.json
  • [E152] No common.dataSource found in io-package.json
  • [E300] Not found on travis. Please setup travis
  • [E605] No actual year found in copyright. Please add "Copyright (c) 2019-2022 bluefox [email protected]" at the end of README.md
  • [E701] No actual year found in LICENSE. Please add "Copyright (c) 2019-2022 bluefox [email protected]" at the start of LICENSE

Thanks,
your automatic adapter checker.

Config-file

wenn man die config speichert sieht man nur dass hier:

�8b�+���Z��^r�ߊ��jب���x#�`�Q�� �1�HR��3��w�; jG������z�����~�&ʋ���k�G�z{b�'������E

Fork of TileBoard

Is there a reason to create this as a new Repository and not as a fork of TileBoard? Like this it would be harder to include TileBoard fixes!

How to configure?

I have Iobroker running on a raspberry pi. After Tileboard Adapter installation I get a popup to rename config.js. Where would this be located? I put one in node.modules/iobroker.tileboard/www/ with no effect.

If I go to Instance Settings and configuration file I see there's binary data in there..

socket.emit throws garbage data to wrapper

On the Config Wrapper and the CSS Wrapper you can´t configure text. As soon as you either reload the page or save the config it will be converted into garbage (see image).

Versions:
NodeJS: v12.20.0
NPM: 6.14.8
Admin: 4.1.11
Web: 3.0.14
Socketio: 3.0.13
TileBoard: 0.3.1

AFAIK it seems to be the socket.emit('readFile', 'tileboard.0', 'config.js', function (err, data) and socket.emit('readFile', 'tileboard.0', 'custom.css', function (err, data) beeing at least part of the Problem. I tested the Wrapper with a fixed string, which worked fine.
image

SWITCH shows icon only in one state

Only in "true" state "mdi-lightbulb-on" is shown. In "false" state, no icon is displayed.

{
position: [1, 0],
width: 1,
type: TYPES.SWITCH,
id: '0_userdata.0.lights.gf.dining',
title: 'Dining room',
states: {
true: "ON",
false: "OFF"
},
icons: {
true: "mdi-lightbulb-on",
false: "mdi-lightbulb",
}
},

Please check ioBroker.tileboard with js-controller 2.0

Hi,

the new js-controller 2.0 will come into latest repository in the next days and we want to make sure that all adapters are working well. We already did a 2 weeks Beta test and so some adapter were aleady checked and some needed slight adjustments.

You can find more information in ioBroker/ioBroker.js-controller#482 and in the ioBroker Forum. If you have more technical questions please write in the referenced issue or in the Developer thread please. General questions are best in the genral thread.

Please update your systems to js-controller 2.0 and check your adapter.

Please close this issue once you have checked your adapter or received successfull reports from users.

Thank you very much for your support. Please contact us in the other Threads or Forum on any question.

Compatibility check and testing for Node.js 14 and 16

Dear Adapter developer,

Node.js 14 is now available for a year and Node.js 16 was release just some days ago and will become LTS by October 2021. We plan to update the ioBroker Node.js recommendation (currently 12.x) to 14.x later this year.

Please check your adapter with Node.js 14 especially, and ideally also directly with Node.js 16

Please add both versions to the adapter testing which is executed on commits.

If your adapter requires a certain minimum version of Node.js please set the 'engine' setting in package.json accordingly! Please also do this if the adapter is not able to work in certain Node.js versions, so that ioBroker can prevent users from installing te adapter if not compatible!

On questions please talk to us at ioBroker/ioBroker.js-controller#1138

Please close the issue after you checked it.

Thank you very much for your support!

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.