Very nice donewizjos wrote:Personally I don't like the wind-direction as Domoticz returns it... All english texts like 'ENE', 'WSW' etc.
Created a function to change this and give more descriptive texts like 'oost-noordoost' or 'west-zuidwest'.
To achieve this I hacked in to blocks.js...
Created a function TranslateDirection:Altered the line:Code: Select all
function TranslateDirection(directionstr){ directionstr='direction_'+directionstr; return lang[directionstr]; }
in:blocktypes.Type['Wind'] = { icon: 'wi wi-wind-direction', title: lang.wind, value: '<Speed> m/s, <Direction> <DirectionStr>' }(with a degree sign as well)Code: Select all
blocktypes.Type['Wind'] = { icon: 'wi wi-wind-direction', title: lang.wind, value: '<Speed> m/s, <Direction>° ' }
and added an extra line (the third) in this piece of code:And finally added in the language file these linesCode: Select all
if(typeof(device['Direction'])!=='undefined' && typeof(device['DirectionStr'])!=='undefined'){ attr+=' style="-webkit-transform: rotate('+device['Direction']+'deg);-moz-transform: rotate('+device['Direction']+'deg);-ms-transform: rotate('+device['Direction']+'deg);-o-transform: rotate('+device['Direction']+'deg); transform: rotate('+device['Direction']+'deg);"'; value = value+TranslateDirection(device['DirectionStr']); }
All that remains now is a translation from m/s into Bft (Beaufort)Code: Select all
lang['direction_N'] = 'noord' lang['direction_ENE'] = 'oost-noordoost'; lang['direction_NE'] = 'noordoost' lang['direction_E'] = 'oost'; lang['direction_ESE'] = 'oost-zuidoost' ; lang['direction_S'] = 'zuid' ; lang['direction_WSW'] = 'west-zuidwest' ; lang['direction_W'] = 'west' ; lang['direction_WNW'] = 'west-noordwest' ;
Regards
Wizjos
Verzonden vanaf mijn iPhone met Tapatalk