Hi,
I try to get startet creating widgets for mainUi. I was playing around a bit with it and trying to create my first simple widget. But i have the following issue and seem to be unable to find out why.
This is the “testWiget”
uid: Automations
props:
parameters:
- description: Name of the automation
label: Name
name: title
required: false
type: TEXT
- context: item
description: The Automation switch Item
label: Item
name: item
required: false
type: TEXT
parameterGroups: []
timestamp: Oct 12, 2022, 9:39:19 AM
component: oh-toggle-item
config:
icon: f7:leaf_arrow_circlepath
iconColor: '=(items[props.item].state == "ON") ? "green" : "gray"'
color: '=(items[props.item].state == "ON") ? "green" : "gray"'
title: =props.title
item: =props.item
Maybe share your full page code, where you use your widget.
The oh-toggle-item is supposed to be included into a list, if you want to use a toggle without a list, maybe look at oh-toggle instead of oh-toggle-item
The first problem I see is you’ve created a widget based on a List Item widget. List Item widgets can only be shown inside of a list widget (e.g. inside the cards on the Locations, Equipment, and Properties tabs). These widgets cannot be added to a Layout Page individually like this. MainUI can’t render them properly. Note, all the list Item widgets end with “-item”.
So you either need to put this widget inside one of the List widgets (e.g. oh-list) , or you need to change it to be based on the oh-toggle widget which is stand alone.
You should open another thread when you have a question or comment unrelated to the original post.