for my change to openhab from symcon I (better said my wife ) wants a dynamic background of the whole habpanel pages depending on the current weather. Is there a possibility to change the background based on an openhab item like weather condition from the weather1 binding?
Not nativelyā¦ However this should be possible with a template widget using dynamically loaded code; see examples linked in the āAdvanced: Injecting custom JavaScript codeā chapter of:
Some additional info:
The setting for the background image URL is in $rootScope.settings.background_image
You can inject OHService in the controller and then use this function to monitor for state changes of an item:
OHService.onUpdate($scope, <your_item_name>, function () {
// your code here, for example:
var item = OHService.getItem(<your_item_name>);
$rootScope.settings.background_image = '/static/weather/bkg_' + item.state + '.jpg';
}
You can alter the template and variables in the controller; note that in this case, standard HABPanel template functions like itemState, sendCmd arenāt available because youāve replaced the controller by your own - but you can bind to scope variables you define in the controller, like above with vm.state.