Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wunsch: Count of events for tomorrow #72

Closed
John11Doe opened this issue Oct 15, 2018 · 2 comments
Closed

Wunsch: Count of events for tomorrow #72

John11Doe opened this issue Oct 15, 2018 · 2 comments

Comments

@John11Doe
Copy link

Here is the link to the feature request:
https://forum.iobroker.net/viewtopic.php?f=20&t=17686

@twonky4
Copy link
Contributor

twonky4 commented Oct 16, 2018

It is possible via ioBroker.javascript adapter. You only have to create the state ical.0.data.countTomorrow be yourself.

var instanceNumber = '0';

function performCount() {
    var count = 0;
    var table = getState('ical.' + instanceNumber + '.data.table').val;
    for (var i = 0; i < table.length; i++) {
        if(table[i]._class.indexOf('ical_tomorrow') != -1) {
            count++;
        }
    }

    setState('ical.' + instanceNumber + '.data.countTomorrow', count, false);   
}

on({id: 'ical.' + instanceNumber + '.data.table', ack: true}, performCount);
performCount();

@twonky4
Copy link
Contributor

twonky4 commented Nov 18, 2018

@John11Doe: Can you test the recent version 1.7.0 here from the repo?

@twonky4 twonky4 closed this as completed Dec 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants