Home/Support/Support Forum/Transforms Assistance
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Transforms Assistance

0 votes
I'm having difficulties creating a transform in the dia.yml file for converting the sensor temperature to Fahrenheit.

Looking over the example in the following guide:

http://www.idigi.com/pdf/idigi-dia103.pdf

I see the following samples:

Transforms – Examples:

1. Multi-channel operation. Note the use of the built-in functions sum and len provided by Python.

- name: avg_temperature
unit: C
channels:
- temp_sensors.sensor1
- temp_sensors.sensor2
- temp_sensors.sensor3
expr: sum(c) / len(c)

2. Unit conversion. Given a temperature in Celsius, convert to Fahrenheit. Note that transforms can use other transforms.

- name: temperature_f
unit: F
channels:
- transforms.avg_temperature
expr: (9.0/5.0) * c[0] + 32

Admittedly, I am new to Python. I have tried various transform entries and came up with the following errors when running dia.py on the ConnectPort unit:

SettingNotFound: "setting 'instance_list' not found"

Is a template required when using a transform?

Does a transform entry in the .yml file need to be earlier than the sensor device?

I don't need an average temperature, just simply change the unit value to fahrenheit and have it show on the web (idigi_dia.html). Is there a better way to accomplish this?

Appreciate any assistance.
asked Aug 7, 2009 in Python by Herman New to the Community (13 points)

Please log in or register to answer this question.

2 Answers

0 votes
Can you post your dia.yml, or at least the driver snippets for the driver providing your temperature channel, and your instantiation of the transforms device?

Your driver that provides the transformed channel needs to be configured earlier in the file, prior to the transforms device instance that contains the conversion.

I'm only guessing here, but the examples as you have pasted them in also have no indentation. That may just be the forum software. If not, you'll need to unsure they are properly indented. A fuller example with indentation is attached since I can't get the forum to leave it alone. You'll need to add the driver that provides the celsius channel and 'channels' entry to refer to that channel rather than the bogus transforms.avg_temperature one.
answered Aug 7, 2009 by DigiGuy42 Community Contributor (102 points)
0 votes
After confirming the format, placing the entry above the sensor devices and placing the actual channel name for the temperature, it is now working fine.

Thanks a bunch for the help!
answered Aug 11, 2009 by Herman New to the Community (13 points)
...