Conversation
| handleChangeEvent(this, ev); | ||
| ev.stopPropagation(); | ||
| const newTrigger = ev.detail.value; | ||
| Object.keys(newTrigger).forEach((key) => |
There was a problem hiding this comment.
root.addEventListener("value-changed", (ev) => {
ev.stopPropagation();
const schema = (ev.target as HaFormElement).schema as HaFormSchema;
fireEvent(this, "value-changed", {
value: { ...this.data, [schema.name]: ev.detail.value },
});
});There was a problem hiding this comment.
https://design.home-assistant.io/#components/ha-form -> See OctoPrint (at the very bottom). Remove application path.
If a field is optional, it will be removed from the output.
src/panels/config/automation/trigger/types/ha-automation-trigger-mqtt.ts
Outdated
Show resolved
Hide resolved
| import { TriggerElement } from "../ha-automation-trigger-row"; | ||
|
|
||
| const SCHEMA: HaFormSchema[] = [ | ||
| { name: "topic", selector: { text: {} } }, |
There was a problem hiding this comment.
This one is required and should have required: true
|
|
||
| const SCHEMA: HaFormSchema[] = [ | ||
| { name: "topic", selector: { text: {} } }, | ||
| { name: "payload", required: false, selector: { text: {} } }, |
There was a problem hiding this comment.
required: false is the default I think?
There was a problem hiding this comment.
required is default true
because thats what it was before I updated the text fields to even have the ability to be optional
There was a problem hiding this comment.
We should have the same default for required across anything that you can create in ha-form. And that default is optional is the default if I recall correctly.
| fireEvent(this, "value-changed", { value: newTrigger }); | ||
| } | ||
|
|
||
| private _computeLabelCallback(schema: HaFormSchema): string { |
There was a problem hiding this comment.
| private _computeLabelCallback(schema: HaFormSchema): string { | |
| private _computeLabelCallback = (schema: HaFormSchema): string => { |
src/panels/config/automation/trigger/types/ha-automation-trigger-mqtt.ts
Outdated
Show resolved
Hide resolved
src/panels/config/automation/trigger/types/ha-automation-trigger-mqtt.ts
Outdated
Show resolved
Hide resolved
…er-mqtt.ts Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
…er-mqtt.ts Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Breaking change
Proposed change
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: