@@ -183,6 +183,30 @@ select:
183183 return "";
184184 }
185185 - script.execute : preview_rfid_data
186+ switch :
187+ - platform : template
188+ name : " Include alpha value in filament color"
189+ id : filament_include_alpha
190+ state_topic :
191+ icon : " mdi:palette-outline"
192+ optimistic : true
193+ web_server :
194+ sorting_group_id : sorting_group_filament_settings
195+ sorting_weight : 70
196+ turn_on_action :
197+ then :
198+ - lambda : |-
199+ id(filament_include_alpha).publish_state(true);
200+ char hexStr[3];
201+ sprintf(hexStr, "%02X", (int)id(filament_alpha_int).state);
202+ id(filament_alpha).publish_state(hexStr);
203+ - script.execute : preview_rfid_data
204+ turn_off_action :
205+ then :
206+ - lambda : |-
207+ id(filament_include_alpha).publish_state(false);
208+ id(filament_alpha).publish_state("");
209+ - script.execute : preview_rfid_data
186210number :
187211- platform : template
188212 name : " Filament Min Temp"
@@ -231,6 +255,29 @@ number:
231255 on_value :
232256 then :
233257 - script.execute : preview_rfid_data
258+ - platform : template
259+ name : " Filament alpha value"
260+ id : filament_alpha_int
261+ state_topic :
262+ min_value : 0
263+ max_value : 255
264+ initial_value : 255
265+ step : 5
266+ icon : mdi:palette-outline
267+ optimistic : true
268+ web_server :
269+ sorting_group_id : sorting_group_filament_settings
270+ sorting_weight : 90
271+ set_action :
272+ then :
273+ - lambda : |-
274+ id(filament_alpha_int).publish_state(int(round(x)));
275+ char hexStr[3];
276+ sprintf(hexStr, "%02X", (int)id(filament_alpha_int).state);
277+ id(filament_alpha).publish_state(hexStr);
278+ on_value :
279+ then :
280+ - script.execute : preview_rfid_data
234281text_sensor :
235282- platform : template
236283 name : " Filament Brand Code"
@@ -240,20 +287,32 @@ text_sensor:
240287 web_server :
241288 sorting_group_id : sorting_group_filament_settings
242289 sorting_weight : 110
243- on_value :
244- then :
245- - script.execute : preview_rfid_data
290+ # on_value: #not needed?
291+ # then:
292+ # - script.execute: preview_rfid_data
246293- platform : template
247294 name : " Filament Color Hex"
248295 id : filament_color_hex
249296 state_topic :
250297 icon : mdi:hexagon-outline
298+ internal : true
251299 web_server :
252300 sorting_group_id : sorting_group_filament_settings
253301 sorting_weight : 100
254- on_value :
255- then :
256- - script.execute : preview_rfid_data
302+ # on_value: #not needed?
303+ # then:
304+ # - script.execute: preview_rfid_data
305+ - platform : template
306+ name : " Filament Color Hex"
307+ id : filament_color_hexaa
308+ state_topic :
309+ icon : mdi:hexagon-outline
310+ web_server :
311+ sorting_group_id : sorting_group_filament_settings
312+ sorting_weight : 105
313+ # on_value: #not needed?
314+ # then:
315+ # - script.execute: preview_rfid_data
257316- platform : template
258317 name : Filament Sub Brand
259318 id : filament_sub_brand
@@ -262,9 +321,15 @@ text_sensor:
262321 web_server :
263322 sorting_group_id : sorting_group_filament_settings
264323 sorting_weight : 120
265- on_value :
266- then :
267- - script.execute : preview_rfid_data
324+ # on_value: #not needed?
325+ # then:
326+ # - script.execute: preview_rfid_data
327+ - platform : template
328+ name : Filament alpha
329+ id : filament_alpha
330+ state_topic :
331+ icon : mdi:label
332+ internal : true
268333button :
269334- platform : template
270335 name : Upload Settings
0 commit comments