I have created some virtual devices which collect temperature (among other things) from an old weather station.
Is there any way I can access the Defaults.xml from my module to determine whether to convert the data to Fahrenheit for display?
Temperature units in virtual devices
Re: Temperature units in virtual devices
You'd better create an option in module settings, like OpenWeather module does.
Re: Temperature units in virtual devices
So it is not possible to create virtual devices that obey the system defaults? It doesn't make much sense to have multiple temperature unit settings for each module.
Re: Temperature units in virtual devices
Defaults.xml is intended for z-wave subsystem, which operates at a lower level than JS automation and virtual devices.
But you may still load value from Defaults.xml if you want it that bad. To do so, first make a symlink to config directory inside automation (because fs.load() is restricted to work only under automation folder):
then use the following code to load value:
But you may still load value from Defaults.xml if you want it that bad. To do so, first make a symlink to config directory inside automation (because fs.load() is restricted to work only under automation folder):
Code: Select all
cd /opt/z-way-server/automation
ln -s ../config
Code: Select all
var xml = new ZXmlDocument(fs.load('config/Defaults.xml'));
var isFahrenheit = parseInt(xml.findOne('/Defaults/CommandClass/SensorMultilevel/Fahrenheit/text()')) || 0;
Re: Temperature units in virtual devices
Thanks pofs. That will solve my problem.
Are there any plans to implement full locale support in the automation layer?
Are there any plans to implement full locale support in the automation layer?