UI: fix rs485-only modbus templates (#31201)

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Michael Geers <michael@geers.tv>
This commit is contained in:
premultiply 2026-06-25 12:16:40 +02:00 • committed by GitHub
parent 0d010f6c11
commit 1b748deaef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -259,7 +259,7 @@ export default defineComponent({
selectedModbus(newValue: MODBUS_TYPE) {
this.$emit("update:modbus", newValue);
},
options(newValue: ModbusCapability[]) {
capabilities(newValue: ModbusCapability[]) {
this.setProtocolByCapabilities(newValue);
this.$emit("update:modbus", this.selectedModbus);
},
@ -288,7 +288,12 @@ export default defineComponent({
},
mounted() {
this.localDevice = this.device;
this.setConnectionAndProtocolByModbus(this.modbus);
if (this.modbus) {
this.setConnectionAndProtocolByModbus(this.modbus);
} else {
// new device: rs485-only templates default to RTU, not native TCP
this.setProtocolByCapabilities(this.capabilities);
}
this.$emit("update:modbus", this.selectedModbus);
this.updateServiceValues();
},