Weekly programming
Moderators: leecollings, remb0
-
- Posts: 89
- Joined: Friday 15 September 2017 18:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10076
- Location: Germany
- Contact:
Re: Weekly programming
Will this work with the lastest beta?
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
-
- Posts: 79
- Joined: Tuesday 12 December 2017 14:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Paris
- Contact:
Re: Weekly programming
Absolutely, it does.
Do you have a trouble with it?
Do you have a trouble with it?
-
- Posts: 89
- Joined: Friday 15 September 2017 18:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10076
- Location: Germany
- Contact:
Re: Weekly programming
I ask to be safe. My system is good running. And I dont wanna crash it. So I ask before İ try.
But after Update it get lost or? So everytime I Update my System I must Install it again. İ am on Beta Channel
But after Update it get lost or? So everytime I Update my System I must Install it again. İ am on Beta Channel
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
-
- Posts: 79
- Joined: Tuesday 12 December 2017 14:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Paris
- Contact:
Re: Weekly programming
As this is not in the master branch, after each updates, you have to modify the DeviceTimersController.js file to add the 3 parts as explained on my github gist.
-
- Posts: 79
- Joined: Tuesday 12 December 2017 14:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Paris
- Contact:
Re: Weekly programming
A new version is released on my github.
This is a "ready to branch" version, easier to integrate with existing code.
I improve performance and fix some issues.
WARNING, planning.js is now on www/app/timers folder
This is a "ready to branch" version, easier to integrate with existing code.
I improve performance and fix some issues.
WARNING, planning.js is now on www/app/timers folder
-
- Posts: 89
- Joined: Friday 15 September 2017 18:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10076
- Location: Germany
- Contact:
Re: Weekly programming
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
-
- Posts: 79
- Joined: Tuesday 12 December 2017 14:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Paris
- Contact:
Re: Weekly programming
did you delete the application cache of your web browser?
if you press F12 (to open developpement tools) and go to the console tab, you should see an error. Check it and let me know.
if you press F12 (to open developpement tools) and go to the console tab, you should see an error. Check it and let me know.
-
- Posts: 89
- Joined: Friday 15 September 2017 18:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10076
- Location: Germany
- Contact:
Re: Weekly programming
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
-
- Posts: 79
- Joined: Tuesday 12 December 2017 14:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Paris
- Contact:
Re: Weekly programming
Could you show your DeviceTimersController.js file?
It seems you have something wrong in this fils in the getTimers function.
It seems you have something wrong in this fils in the getTimers function.
-
- Posts: 89
- Joined: Friday 15 September 2017 18:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10076
- Location: Germany
- Contact:
Re: Weekly programming
Code: Select all
define(['app', 'timers/factories', 'timers/components','timers/planning' ], function (app) {
app.controller('DeviceTimersController', function ($scope, $routeParams, deviceApi, deviceLightApi, deviceRegularTimersApi, deviceSetpointTimersApi, deviceTimerOptions, deviceTimerConfigUtils, utils) {
var vm = this;
var deviceTimers;
var deleteConfirmationMessage = $.t('Are you sure to delete this timers?\n\nThis action can not be undone...');
var clearConfirmationMessage = $.t('Are you sure to delete ALL timers?\n\nThis action can not be undone!');
vm.addTimer = addTimer;
vm.updateTimer = updateTimer;
vm.deleteTimer = utils.confirmDecorator(deleteTimer, deleteConfirmationMessage);
vm.clearTimers = utils.confirmDecorator(clearTimers, clearConfirmationMessage);
init();
function init() {
vm.deviceIdx = $routeParams.id;
vm.selectedTimerIdx = null;
deviceApi.getDeviceInfo(vm.deviceIdx).then(function (device) {
vm.isLoaded = true;
vm.itemName = device.Name;
vm.colorSettingsType = device.SubType;
vm.dimmerType = device.DimmerType;
vm.isDimmer = device.isDimmer();
vm.isSelector = device.isSelector();
vm.isLED = device.isLED();
vm.isCommandSelectionDisabled = vm.isSelector && device.LevelOffHidden;
vm.isSetpointTimers = (device.Type === 'Thermostat' && device.SubType == 'SetPoint') || (device.Type === 'Radiator 1');
vm.levelOptions = [];
deviceTimers = vm.isSetpointTimers
? deviceSetpointTimersApi
: deviceRegularTimersApi;
if (vm.isSelector) {
vm.levelOptions = device.getSelectorLevelOptions();
}
if (vm.isLED) {
$scope.$watch(function () {
return vm.timerSettings.color + vm.timerSettings.level;
}, setDeviceColor);
}
if (vm.isDimmer) {
vm.levelOptions = device.getDimmerLevelOptions(1);
}
if (vm.levelOptions.length > 0) {
vm.timerSettings.level = vm.levelOptions[0].value;
}
refreshTimers();
});
vm.typeOptions = deviceTimerOptions.timerTypes;
vm.timerSettings = deviceTimerConfigUtils.getTimerDefaultConfig();
$( document ).trigger( "timersInitialized", [vm, refreshTimers] );//<===Update for Planning
refreshTimers();
}
function refreshTimers() {
vm.selectedTimerIdx = null;
deviceTimers.getTimers(vm.deviceIdx).then(function (items) {
vm.timers = items;
$( document ).trigger( "timersLoaded", [items] );;//<===Update for Planning
});
}
function setDeviceColor() {
if (!vm.timerSettings.color || !vm.timerSettings.level) {
return;
}
deviceLightApi.setColor(
vm.deviceIdx,
vm.timerSettings.color,
vm.timerSettings.level
);
}
function getTimerConfig() {
var utils = deviceTimerConfigUtils;
var config = Object.assign({}, vm.timerSettings);
if (!utils.isDayScheduleApplicable(config.timertype)) {
config.days = 0;
}
if ([6, 7, 10, 12].includes(config.timertype)) {
config.days = 0x80;
}
if (utils.isOccurrenceApplicable(config.timertype)) {
config.days = Math.pow(2, config.weekday);
}
config = Object.assign({}, config, {
date: utils.isDateApplicable(config.timertype) ? config.date : undefined,
mday: utils.isRDaysApplicable(config.timertype) ? config.mday : undefined,
month: utils.isRMonthsApplicable(config.timertype) ? config.month : undefined,
occurence: utils.isOccurrenceApplicable(config.timertype) ? config.occurence : undefined,
weekday: undefined,
color: vm.isLED ? config.color : undefined,
tvalue: vm.isSetpointTimers ? config.tvalue : undefined,
command: vm.isSetpointTimers ? undefined : config.command,
randomness: vm.isSetpointTimers ? undefined : config.randomness
});
var error = deviceTimerConfigUtils.getTimerConfigErrors(config);
if (error) {
ShowNotify(error, 2500, true);
return false;
}
var warning = deviceTimerConfigUtils.getTimerConfigWarnings(config);
if (warning) {
ShowNotify(error, 2500, true);
}
return config;
}
function addTimer() {
const config = getTimerConfig();
if (!config) {
return false;
}
deviceTimers
.addTimer(vm.deviceIdx, config)
.then(refreshTimers)
.catch(function () {
HideNotify();
ShowNotify($.t('Problem adding timer!'), 2500, true);
});
}
function updateTimer(timerIdx) {
const config = getTimerConfig();
if (!config) {
return false;
}
deviceTimers
.updateTimer(timerIdx, config)
.then(refreshTimers)
.catch(function () {
HideNotify();
ShowNotify($.t('Problem updating timer!'), 2500, true);
});
}
function deleteTimer(timerIdx) {
return deviceTimers.deleteTimer(timerIdx)
.then(refreshTimers)
.catch(function () {
HideNotify();
ShowNotify($.t('Problem deleting timer!'), 2500, true);
});
}
function clearTimers() {
return deviceTimers
.clearTimers(vm.deviceIdx)
.then(refreshTimers)
.catch(function () {
HideNotify();
ShowNotify($.t('Problem clearing timers!'), 2500, true);
});
}
});
});
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
-
- Posts: 79
- Joined: Tuesday 12 December 2017 14:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Paris
- Contact:
Re: Weekly programming
Please, check what you have modified, you wrote the wrong for the first trigger:
Code: Select all
define(['app', 'timers/factories', 'timers/components','timers/planning'], function (app) {
app.controller('DeviceTimersController', function ($scope, $routeParams, deviceApi, deviceLightApi, deviceRegularTimersApi, deviceSetpointTimersApi, deviceTimerOptions, deviceTimerConfigUtils, utils) {
var vm = this;
var deviceTimers;
var deleteConfirmationMessage = $.t('Are you sure to delete this timers?\n\nThis action can not be undone...');
var clearConfirmationMessage = $.t('Are you sure to delete ALL timers?\n\nThis action can not be undone!');
vm.addTimer = addTimer;
vm.updateTimer = updateTimer;
vm.deleteTimer = utils.confirmDecorator(deleteTimer, deleteConfirmationMessage);
vm.clearTimers = utils.confirmDecorator(clearTimers, clearConfirmationMessage);
init();
function init() {
vm.deviceIdx = $routeParams.id;
vm.selectedTimerIdx = null;
deviceApi.getDeviceInfo(vm.deviceIdx).then(function (device) {
vm.isLoaded = true;
vm.itemName = device.Name;
vm.colorSettingsType = device.SubType;
vm.dimmerType = device.DimmerType;
vm.isDimmer = device.isDimmer();
vm.isSelector = device.isSelector();
vm.isLED = device.isLED();
vm.isCommandSelectionDisabled = vm.isSelector && device.LevelOffHidden;
vm.isSetpointTimers = (device.Type === 'Thermostat' && device.SubType == 'SetPoint') || (device.Type === 'Radiator 1');
vm.levelOptions = [];
deviceTimers = vm.isSetpointTimers
? deviceSetpointTimersApi
: deviceRegularTimersApi;
if (vm.isSelector) {
vm.levelOptions = device.getSelectorLevelOptions();
}
if (vm.isLED) {
$scope.$watch(function () {
return vm.timerSettings.color + vm.timerSettings.level;
}, setDeviceColor);
}
if (vm.isDimmer) {
vm.levelOptions = device.getDimmerLevelOptions(1);
}
if (vm.levelOptions.length > 0) {
vm.timerSettings.level = vm.levelOptions[0].value;
}
$( document ).trigger( "timersInitialized", [vm, refreshTimers] );
refreshTimers();
});
vm.typeOptions = deviceTimerOptions.timerTypes;
vm.timerSettings = deviceTimerConfigUtils.getTimerDefaultConfig();
}
function refreshTimers() {
vm.selectedTimerIdx = null;
deviceTimers.getTimers(vm.deviceIdx).then(function (items) {
vm.timers = items;
$( document ).trigger( "timersLoaded", [items] );
});
}
function setDeviceColor() {
if (!vm.timerSettings.color || !vm.timerSettings.level) {
return;
}
deviceLightApi.setColor(
vm.deviceIdx,
vm.timerSettings.color,
vm.timerSettings.level
);
}
function getTimerConfig() {
var utils = deviceTimerConfigUtils;
var config = Object.assign({}, vm.timerSettings);
if (!utils.isDayScheduleApplicable(config.timertype)) {
config.days = 0;
}
if ([6, 7, 10, 12].includes(config.timertype)) {
config.days = 0x80;
}
if (utils.isOccurrenceApplicable(config.timertype)) {
config.days = Math.pow(2, config.weekday);
}
config = Object.assign({}, config, {
date: utils.isDateApplicable(config.timertype) ? config.date : undefined,
mday: utils.isRDaysApplicable(config.timertype) ? config.mday : undefined,
month: utils.isRMonthsApplicable(config.timertype) ? config.month : undefined,
occurence: utils.isOccurrenceApplicable(config.timertype) ? config.occurence : undefined,
weekday: undefined,
color: vm.isLED ? config.color : undefined,
tvalue: vm.isSetpointTimers ? config.tvalue : undefined,
command: vm.isSetpointTimers ? undefined : config.command,
randomness: vm.isSetpointTimers ? undefined : config.randomness
});
var error = deviceTimerConfigUtils.getTimerConfigErrors(config);
if (error) {
ShowNotify(error, 2500, true);
return false;
}
var warning = deviceTimerConfigUtils.getTimerConfigWarnings(config);
if (warning) {
ShowNotify(error, 2500, true);
}
return config;
}
function addTimer() {
const config = getTimerConfig();
if (!config) {
return false;
}
deviceTimers
.addTimer(vm.deviceIdx, config)
.then(refreshTimers)
.catch(function () {
HideNotify();
ShowNotify($.t('Problem adding timer!'), 2500, true);
});
}
function updateTimer(timerIdx) {
const config = getTimerConfig();
if (!config) {
return false;
}
deviceTimers
.updateTimer(timerIdx, config)
.then(refreshTimers)
.catch(function () {
HideNotify();
ShowNotify($.t('Problem updating timer!'), 2500, true);
});
}
function deleteTimer(timerIdx) {
return deviceTimers.deleteTimer(timerIdx)
.then(refreshTimers)
.catch(function () {
HideNotify();
ShowNotify($.t('Problem deleting timer!'), 2500, true);
});
}
function clearTimers() {
return deviceTimers
.clearTimers(vm.deviceIdx)
.then(refreshTimers)
.catch(function () {
HideNotify();
ShowNotify($.t('Problem clearing timers!'), 2500, true);
});
}
});
});
Last edited by syrhus on Saturday 22 December 2018 13:25, edited 1 time in total.
-
- Posts: 89
- Joined: Friday 15 September 2017 18:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10076
- Location: Germany
- Contact:
Re: Weekly programming
RPi4 Shelly1 Shelly2.5 ESPEasy Tuya Domoticz Beta Dashticz 3.6
-
- Posts: 79
- Joined: Tuesday 12 December 2017 14:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Paris
- Contact:
Re: Weekly programming
I changed the previous post to set the entire DeviceTimersController.js file
Please replace it with your one and keep in mind that each time you change a js file, you have to clear your application cache to reload the updated files.
Please replace it with your one and keep in mind that each time you change a js file, you have to clear your application cache to reload the updated files.
Re: Weekly programming
I add the script to Domoticz version 4.10717.
And its not working. After restart also not.
No error, no changes, nothing happens.

And its not working. After restart also not.
No error, no changes, nothing happens.

Re: Weekly programming
It has something to do with Safari.
Chrome is working fine, Private browsing in Safari also working fine.
But normale browsing in safari, the scheduler is not showing up.
Chrome is working fine, Private browsing in Safari also working fine.
But normale browsing in safari, the scheduler is not showing up.
-
- Posts: 187
- Joined: Tuesday 07 March 2017 21:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Germany
- Contact:
Re: Weekly programming
salopette wrote: ↑Sunday 28 July 2019 9:36 @ syrhus
can you do PR for Domoticz?
https://github.com/domoticz/domoticz/is ... -515738984



Who is online
Users browsing this forum: No registered users and 1 guest