To only type one field for a prop, which then auto populates all expressions throughout widget code.
Example Group I would use in a widget for TRV control, including open window sensing:
To populate a oh-list-card based on a group and apply above goal.
Examples include groups of:
- 23 + batteries
- 8 switches
- 11 lights
- 6 TRVs
- 5 apple devices
- etc etc
I have lots of Zigbee sensors with batteries.
I am making a list widget that uses the
- Battery Level (sometimes Low Battery switch) to control the icon,
- the badge (showing battery percentage or low battery switch state),
- badge colour (green for > 90% or low battery switch OFF), yellow for <30%, and red for < 10% or low battery switch ON),
- link to online manual (action External URL),
- and Replacement Battery Type (Just text, “CR2030” for example).
It should be possible for this to be as simple as typing the name of a group into a text prop,
then auto populate a list of oh-list-items, all of which then use the naming scheme to fill in all the props in the custom widget in each list place.
Below is my best guess as to how this should work for Goal 1 (but obviously doesn’t):
uid: widget_ListItem_LowBattery tags:  props: parameters: - label: Location # Get from Group if implementing Goal 2 name: location description: Spell correctly # This is what drives everything. type: TEXT - label: Sensor Type # Can be inferred from item name if implementing Goal 2. Or create Command Options list, or text prop. name: type description: Motion Sensor, TRV, Door Sensor etc # Or get from location prop if implementing Goal 2 type: TEXT - context: item # I can add an item to Model if implementing Goal 2. Or create Command Options list, or text prop. label: Battery type name: battType description: Type of Battery that fits the device. eg CR2030 type: TEXT - context: item # I can add an item to Model if implementing Goal 2, otherwise just a text prop. Or create IF list of known battery types in this widget. label: Instruction manual URL name: url description: link to manufactures User Manual type: TEXT parameterGroups:  component: oh-list-item config: item: ="items." + props.location.REMOVEWHITESPACES + "_BatteryLevel.state" # example result =items.FrontDoorMotionSensor_BatteryLevel.state - If _BatteryLevel is not available, use _LowBattery. badge: ="items." + props.location.REMOVEWHITESPACES + "_BatteryLevel.state" # example result =items.FrontDoorMotionSensor_BatteryLevel.state - If _BatteryLevel is not available, use _LowBattery. badge-color: '= ("items." + props.location.REMOVEWHITESPACES + "_BatteryLevel.state" == "ON") ? "red": "green"' #- If _BatteryLevel is not available, use _LowBattery. icon: oh:batterylevel # or oh:lowbattery if _BatteryLevel is not available iconUseState: true title: props.location action: popup actionModal: widget:widget_DeviceBatteryInfo # A secodary widget/page that holds more info. Not described here. actionModalConfig: device: =props.location + " " + props.type # example result Front Door Motion Sensor battype: =props.battType # example result CR2030 lowbat: =props.location REMOVEWHITESPACES+ props.typeREMOVEWHITESPACES + "_BatteryLevel.state" # example result =items.FrontDoorMotionSensor_BatteryLevel.state url: =props.url # example result http://gddgmkln.com slots: null
As for Goal 2, I have no idea.
Any ideas on how to make this AutoMagic work?