Page 1 of 1

how to format string

Posted: Monday 29 January 2018 13:27
by krissam44
Hello,

Here is a small script to write the temperature in a virtual text device

Code: Select all

return {
	on = {
		devices = {
			'Météo St-Jean de Braye'
		}
	},
	execute = function(domoticz, device)
	    local afficheur = domoticz.devices('T° St-Jean de Braye')           -- Nom de l'afficheur à mettre à jour
		afficheur.updateTemperature(tostring(device.temperature))
	end
}
I whould like to show only one figure after the decimal dot.
How to make this ?

Thanks

Re: how to format string

Posted: Monday 29 January 2018 13:52
by emme
afficheur.updateTemperature(tostring(domoticz.round(device.temperature,1)))