Dashticz / dashticz_v2

Alternative dashboard for Domoticz
107 stars 62 forks source link

Garbage.js and the setting "settings['garbage_mapping']" #309

Closed ericvb closed 5 years ago

ericvb commented 6 years ago

Trying to get it working with a correct mapping, I stumbled on a setting mentioned in the code but not in the documentation: settings['garbage_mapping'] in the function mapGarbageType(garbageType)

In the documentation we find only the settings['garbage'] ? In the code we find also previous setting in the function getTrashRow(garbage), function filterReturnDates(returnDates) and function addToContainer(random, returnDates)

A typo error ? or 2 different configuration settings? If it is a new configuration setting, what is the syntax?

ericvb commented 6 years ago

Meanwhile I got it working correctly with changing the line settings['garbage_mapping'] in the function mapGarbageType(garbageType) to settings['garbage']

For Belgium (ophaalkalender), I had to change to:

config['garbage'] = { green: {kliko: 'green', code: '#375b23', name: 'GFT', icon: 'img/garbage/kliko_green.png'}, blue: {kliko: 'blue', code: '#153477', name: 'PMD', icon: 'img/garbage/kliko_blue.png'}, grey: {kliko: 'grey', code: '#5e5d5c', name: 'Restafval', icon: 'img/garbage/kliko_grey.png'}, brown: {kliko: 'brown', code: '#f9e231', name: 'Papier en karton', icon: 'img/garbage/kliko_yellow.png'}, indigo: {kliko: 'indigo', code: '#b21807', name: 'Klein gevaarlijk afval', icon: 'img/garbage/kliko_red.png'}, purple: {kliko: 'purple', code: '#000000', name: 'Grof huisvuil', icon: 'img/garbage/kliko_black.png'}, orange: {kliko: 'orange', code: '#db5518', name: 'Textiel', icon: 'img/garbage/kliko_orange.png'} };

The code is mapping to the color when reading the json from the ophaalkalender api. First I changed the code to use the 'title' and not the color, to be able to work with 'pmd', 'gft', ... but the ophaalkalender api is returning 'P-K' for Papier en Karton. When using 'P-K' in the settings, I was getting again a load error of a malformed configuration file. So I switched back to the color, but I had to change the code like mentioned above.