String Setting in Custom Widget

Hello,

I’m trying to create a custom widget with two input parameter, namely the name of the sensor and its temperature. Here is is the code

<div ng-init="ServerPath='../static/temp-data'; IconSet='climacon'">
<link rel="stylesheet" type="text/css" href="{{ServerPath}}/template.css" />
<table id="temp-table">
	<tr>
    <td colspan="2" align="center" id="temp-device" >"config.temp_name"</td>
  </tr>
  <tr>
		<td align="right"><img id="temp-icon" src="../static/temp-data/climacons/Thermometer-50.png"/></td>
    <td id="temp-temp">{{'%.1f' | sprintf:itemValue(config.temp_data)}}</td>
		<td align="left" id="temp-sign">°C</td>
	</tr>
</table>

but I can’t make the config.temp_name variable to work. Do you know how to deal with config strings?

Thank you

Francesco

<td colspan="2" align="center" id="temp-device" >"config.temp_name"</td>

should be:

<td colspan="2" align="center" id="temp-device" >{{config.temp_name}}</td>
```

And of course a setting with this id must exist in your widget configuration.
1 Like

Thank!! It works!!