diff --git a/CHANGELOG.md b/CHANGELOG.md index 50967c5..33ca7e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,125 +1,92 @@ # Changelog for angular -## [v0.12.22](https://github.com/modbus2mqtt/angular/tree/v0.12.22) (2025-09-03) +## [v0.12.19](https://github.com/volkmarnissen/angular/tree/v0.12.19) (2025-01-16) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.21...v0.12.22) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.18...v0.12.19) -## [v0.12.21](https://github.com/modbus2mqtt/angular/tree/v0.12.21) (2025-09-03) +## [v0.12.18](https://github.com/volkmarnissen/angular/tree/v0.12.18) (2025-01-15) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.20...v0.12.21) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.17...v0.12.18) -**Merged pull requests:** +## [v0.12.17](https://github.com/volkmarnissen/angular/tree/v0.12.17) (2025-01-02) -- \[Feature\] Add number of processed calls to Modbus Status [\#12](https://github.com/modbus2mqtt/angular/pull/12) ([volkmarnissen](https://github.com/volkmarnissen)) -- \[Feature\] Add number of processed calls to Modbus Status [\#11](https://github.com/modbus2mqtt/angular/pull/11) ([volkmarnissen](https://github.com/volkmarnissen)) -- Update Changelog [\#10](https://github.com/modbus2mqtt/angular/pull/10) ([volkmarnissen](https://github.com/volkmarnissen)) -- \[bug\]Modbus Error Handling, Slave Specification Detection, TCP RTU bridge, Fixes [\#9](https://github.com/modbus2mqtt/angular/pull/9) ([volkmarnissen](https://github.com/volkmarnissen)) -- \[bug\]Modbus Error Handling, Slave Specification Detection, TCP RTU bridge, Fixes [\#8](https://github.com/modbus2mqtt/angular/pull/8) ([volkmarnissen](https://github.com/volkmarnissen)) -- Angular TcpBridge Fix [\#7](https://github.com/modbus2mqtt/angular/pull/7) ([volkmarnissen](https://github.com/volkmarnissen)) -- \[bug\]Modbus Error Handling, Slave Specification Detection, TCP RTU bridge, Fixes [\#6](https://github.com/modbus2mqtt/angular/pull/6) ([volkmarnissen](https://github.com/volkmarnissen)) -- Modbus Error Handling and Monitoring [\#5](https://github.com/modbus2mqtt/angular/pull/5) ([volkmarnissen](https://github.com/volkmarnissen)) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.16...v0.12.17) -## [v0.12.20](https://github.com/modbus2mqtt/angular/tree/v0.12.20) (2025-04-14) +## [v0.12.16](https://github.com/volkmarnissen/angular/tree/v0.12.16) (2024-12-31) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.19...v0.12.20) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.15...v0.12.16) -**Merged pull requests:** +## [v0.12.15](https://github.com/volkmarnissen/angular/tree/v0.12.15) (2024-12-30) -- Please update me [\#4](https://github.com/modbus2mqtt/angular/pull/4) ([volkmarnissen](https://github.com/volkmarnissen)) -- Fixed package-lock.json [\#3](https://github.com/modbus2mqtt/angular/pull/3) ([volkmarnissen](https://github.com/volkmarnissen)) -- Adding support for discrete inputs [\#2](https://github.com/modbus2mqtt/angular/pull/2) ([arturmietek](https://github.com/arturmietek)) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.14...v0.12.15) -## [v0.12.19](https://github.com/modbus2mqtt/angular/tree/v0.12.19) (2025-01-16) +## [v0.12.14](https://github.com/volkmarnissen/angular/tree/v0.12.14) (2024-12-30) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.18...v0.12.19) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/0.12.14...v0.12.14) -## [v0.12.18](https://github.com/modbus2mqtt/angular/tree/v0.12.18) (2025-01-15) +## [0.12.14](https://github.com/volkmarnissen/angular/tree/0.12.14) (2024-12-13) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.17...v0.12.18) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.13...0.12.14) -## [v0.12.17](https://github.com/modbus2mqtt/angular/tree/v0.12.17) (2025-01-02) +## [v0.12.13](https://github.com/volkmarnissen/angular/tree/v0.12.13) (2024-12-13) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.16...v0.12.17) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.12...v0.12.13) -**Merged pull requests:** +## [v0.12.12](https://github.com/volkmarnissen/angular/tree/v0.12.12) (2024-12-11) -- Adding signed int 32 and unsigned int 32 options to number format [\#1](https://github.com/modbus2mqtt/angular/pull/1) ([arturmietek](https://github.com/arturmietek)) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.11...v0.12.12) -## [v0.12.16](https://github.com/modbus2mqtt/angular/tree/v0.12.16) (2024-12-31) +## [v0.12.11](https://github.com/volkmarnissen/angular/tree/v0.12.11) (2024-11-22) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.15...v0.12.16) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.10...v0.12.11) -## [v0.12.15](https://github.com/modbus2mqtt/angular/tree/v0.12.15) (2024-12-30) +## [v0.12.10](https://github.com/volkmarnissen/angular/tree/v0.12.10) (2024-11-19) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.14...v0.12.15) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.9...v0.12.10) -## [v0.12.14](https://github.com/modbus2mqtt/angular/tree/v0.12.14) (2024-12-30) +## [v0.12.9](https://github.com/volkmarnissen/angular/tree/v0.12.9) (2024-11-16) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/0.12.14...v0.12.14) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.8...v0.12.9) -## [0.12.14](https://github.com/modbus2mqtt/angular/tree/0.12.14) (2024-12-13) +## [v0.12.8](https://github.com/volkmarnissen/angular/tree/v0.12.8) (2024-11-14) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.13...0.12.14) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.7...v0.12.8) -## [v0.12.13](https://github.com/modbus2mqtt/angular/tree/v0.12.13) (2024-12-13) +## [v0.12.7](https://github.com/volkmarnissen/angular/tree/v0.12.7) (2024-10-23) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.12...v0.12.13) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.6...v0.12.7) -## [v0.12.12](https://github.com/modbus2mqtt/angular/tree/v0.12.12) (2024-12-11) +## [v0.12.6](https://github.com/volkmarnissen/angular/tree/v0.12.6) (2024-10-16) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.11...v0.12.12) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.5...v0.12.6) -## [v0.12.11](https://github.com/modbus2mqtt/angular/tree/v0.12.11) (2024-11-22) +## [v0.12.5](https://github.com/volkmarnissen/angular/tree/v0.12.5) (2024-09-24) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.10...v0.12.11) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.4...v0.12.5) -## [v0.12.10](https://github.com/modbus2mqtt/angular/tree/v0.12.10) (2024-11-19) +## [v0.12.4](https://github.com/volkmarnissen/angular/tree/v0.12.4) (2024-09-16) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.9...v0.12.10) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.3...v0.12.4) -## [v0.12.9](https://github.com/modbus2mqtt/angular/tree/v0.12.9) (2024-11-16) +## [v0.12.3](https://github.com/volkmarnissen/angular/tree/v0.12.3) (2024-09-06) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.8...v0.12.9) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.2...v0.12.3) -## [v0.12.8](https://github.com/modbus2mqtt/angular/tree/v0.12.8) (2024-11-14) +## [v0.12.2](https://github.com/volkmarnissen/angular/tree/v0.12.2) (2024-08-27) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.7...v0.12.8) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.12.0...v0.12.2) -## [v0.12.7](https://github.com/modbus2mqtt/angular/tree/v0.12.7) (2024-10-23) +## [v0.12.0](https://github.com/volkmarnissen/angular/tree/v0.12.0) (2024-08-16) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.6...v0.12.7) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.11.0...v0.12.0) -## [v0.12.6](https://github.com/modbus2mqtt/angular/tree/v0.12.6) (2024-10-16) +## [v0.11.0](https://github.com/volkmarnissen/angular/tree/v0.11.0) (2024-08-05) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.5...v0.12.6) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/v0.10.1...v0.11.0) -## [v0.12.5](https://github.com/modbus2mqtt/angular/tree/v0.12.5) (2024-09-24) +## [v0.10.1](https://github.com/volkmarnissen/angular/tree/v0.10.1) (2024-08-05) -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.4...v0.12.5) - -## [v0.12.4](https://github.com/modbus2mqtt/angular/tree/v0.12.4) (2024-09-16) - -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.3...v0.12.4) - -## [v0.12.3](https://github.com/modbus2mqtt/angular/tree/v0.12.3) (2024-09-06) - -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.2...v0.12.3) - -## [v0.12.2](https://github.com/modbus2mqtt/angular/tree/v0.12.2) (2024-08-27) - -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.12.0...v0.12.2) - -## [v0.12.0](https://github.com/modbus2mqtt/angular/tree/v0.12.0) (2024-08-16) - -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.11.0...v0.12.0) - -## [v0.11.0](https://github.com/modbus2mqtt/angular/tree/v0.11.0) (2024-08-05) - -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/v0.10.1...v0.11.0) - -## [v0.10.1](https://github.com/modbus2mqtt/angular/tree/v0.10.1) (2024-08-05) - -[Full Changelog](https://github.com/modbus2mqtt/angular/compare/0b2169b1bceece9fa4c2c6940ef33dafe96ae43b...v0.10.1) +[Full Changelog](https://github.com/volkmarnissen/angular/compare/0b2169b1bceece9fa4c2c6940ef33dafe96ae43b...v0.10.1) diff --git a/cypress/hexinputfield.cy.ts b/cypress/hexinputfield.cy.ts new file mode 100644 index 0000000..6cee5d0 --- /dev/null +++ b/cypress/hexinputfield.cy.ts @@ -0,0 +1,27 @@ + +import { HexinputfieldComponent } from "angular/src/app/specification/hexinputfield/hexinputfield.test.component"; + +function mount(startValue:number, displayHex:boolean) { + cy.mount(HexinputfieldComponent, { + autoDetectChanges: true, + componentProperties: { + displayHex: displayHex, + startValue: startValue, + }, + }); +} +const inputField='input[formControlName="testHex"]' +describe("Hexinputfield Component tests", () => { + it("Show decimal", () => { + mount(0x1234,false); + cy.get(inputField).should('have.value', '4660');; + cy.get(inputField).clear().type('1234').should('have.value', '1234'); + cy.get(inputField).clear().type('0x1234').blur().should('have.value', '4660'); +}); + it("Show Hex", () => { + mount(0x1234,true); + cy.get(inputField).should('have.value', '0x1234');; + cy.get(inputField).clear().type('4660').blur().should('have.value', '0x1234');; + cy.get(inputField).clear().type('0x1234').blur().should('have.value', '0x1234');; +}); +}); diff --git a/cypress/specification-entity.cy.ts b/cypress/specification-entity.cy.ts index 6904fb9..31ff556 100644 --- a/cypress/specification-entity.cy.ts +++ b/cypress/specification-entity.cy.ts @@ -2,6 +2,7 @@ import { ImodbusEntityWithName } from "angular/src/app/services/specificationInt import { afterEachEntityHelper, beforeEachHelper as beforeEachEntityHelper, + mountEntityComponent, setOnEntityNameOrVariableFieldsChangeFunc, } from "./support/entityHelper"; @@ -64,3 +65,16 @@ describe("Entity Component tests", () => { // "not.be.null"); }); }); +describe("Test for Modbus Address", () => { + beforeEach(()=>{mountEntityComponent(true)}); // mounts entity and opens all expansion panels + afterEach(afterEachEntityHelper); + it("Modbus address in hex", () => { + const inputField='input[formControlName="modbusAddress"]' + const matField='mat-form-field input[formControlName="modbusAddress"]' + cy.get(inputField).should('have.value', '0x4'); + cy.get(inputField).clear().type('1234').blur().should('have.value', '0x4d2'); + cy.get(inputField).clear().type('0X12s32').blur().should('have.value', '0x1232'); + cy.get(inputField).clear().type('0xx7') + cy.get(inputField).parent().get( "mat-error").should('contain', 'dec or hex') + }) +}); \ No newline at end of file diff --git a/cypress/support/entityHelper.ts b/cypress/support/entityHelper.ts index 7c8a7b3..4730314 100644 --- a/cypress/support/entityHelper.ts +++ b/cypress/support/entityHelper.ts @@ -88,7 +88,7 @@ let selectEntity: ImodbusEntity = { * * If other initial values are required, a new test file is required */ -export function beforeEachHelper() { +export function mountEntityComponent(displayHex:boolean) { cy.intercept("GET", "**/converters", { fixture: "converters.json", }); @@ -105,9 +105,15 @@ export function beforeEachHelper() { specificationMethods: specificationMethods, entity: selectEntity, disabled: false, + displayHex:displayHex }, }); cy.openAllExpansionPanels(); + +} + +export function beforeEachHelper() { + mountEntityComponent(false); } /** * resets the function set by setOnEntityNameOrVariableFieldsChangeFunc diff --git a/src/app/specification/entity/entity.component.html b/src/app/specification/entity/entity.component.html index eeb2913..5635153 100644 --- a/src/app/specification/entity/entity.component.html +++ b/src/app/specification/entity/entity.component.html @@ -78,8 +78,10 @@
Modbus Addr. - + This field is required @@ -87,6 +89,10 @@ *ngIf="entityFormGroup.get('modbusAddress')!.hasError('min')|| entityFormGroup.get('modbusAddress')!.hasError('max')"> Range is 1-65536 + + dec or hex + Register diff --git a/src/app/specification/entity/entity.component.ts b/src/app/specification/entity/entity.component.ts index fb6213b..03077c7 100644 --- a/src/app/specification/entity/entity.component.ts +++ b/src/app/specification/entity/entity.component.ts @@ -8,6 +8,8 @@ import { } from "@angular/core"; import { ApiService } from "../../services/api-service"; +import {HexFormaterDirective, HexFormaterPipe} from '../hexinputfield/hexinputfield' + import { AbstractControl, FormBuilder, @@ -104,6 +106,7 @@ const newEntity: ImodbusEntityWithName = { styleUrl: "./entity.component.css", standalone: true, imports: [ + HexFormaterDirective, MatCard, MatCardHeader, MatCardTitle, @@ -170,6 +173,8 @@ export class EntityComponent backupEntity: ImodbusEntityWithName | null; @Input() disabled: boolean = true; + @Input() + displayHex: boolean = false; entityCategories: string[] = ["", "config", "diagnostic"]; mqttValues: HTMLElement; @@ -229,6 +234,7 @@ export class EntityComponent Validators.required, Validators.min(0), Validators.max(65536), + Validators.pattern("^0[xX][0-9a-fA-F]+$|^[0-9]+$") ]), ], registerType: [null as IRegisterType | null, Validators.required], @@ -442,7 +448,7 @@ export class EntityComponent this.entityFormGroup.get("registerType")!.setValue( { registerType: entity.registerType, name: "unknown"}); converterFormControl.setValue(entity.converter); modbusAddressFormControl.setValue( - entity.modbusAddress != undefined ? entity.modbusAddress : null, + entity.modbusAddress != undefined ? HexFormaterDirective.convertNumberToInput(entity.modbusAddress,this.displayHex) : null, ); if ( @@ -454,7 +460,7 @@ export class EntityComponent ); modbusAddressFormControl.setValue( entity.modbusAddress && entity.modbusAddress != -1 - ? entity.modbusAddress + ? HexFormaterDirective.convertNumberToInput(entity.modbusAddress,this.displayHex)! : null, ); } @@ -664,6 +670,10 @@ export class EntityComponent this.specificationMethods.copy2Translation(this.entity); } } + onModbusAddressKeyPress(event:KeyboardEvent){ + const allowed="0123456789xXABCDEFabcdef" + return allowed.indexOf( event.key) >=0 + } onModbusAddressChange() { if (!this.entity) return; this.specificationMethods.setEntitiesTouched(); @@ -676,10 +686,8 @@ export class EntityComponent (converterFormControl.value != null && converterFormControl.value !== this.entity.converter) ) { - this.entity.modbusAddress = - modbusAddressFormControl.value != null - ? modbusAddressFormControl.value - : undefined; + if(modbusAddressFormControl.value != null) + this.entity.modbusAddress = HexFormaterDirective.convertHexInput(modbusAddressFormControl.value)! if (converterFormControl.value !== null) { this.entity.converter = converterFormControl.value as Converters; } diff --git a/src/app/specification/hexinputfield/hexinputfield.test.component.ts b/src/app/specification/hexinputfield/hexinputfield.test.component.ts new file mode 100644 index 0000000..ee77337 --- /dev/null +++ b/src/app/specification/hexinputfield/hexinputfield.test.component.ts @@ -0,0 +1,28 @@ +import { Component, Input, OnInit, } from '@angular/core'; +import {FormBuilder, FormGroup, FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {HexFormaterDirective} from './hexinputfield' +@Component({ + selector: 'app-hexinputfield', + imports: [ + FormsModule, + ReactiveFormsModule, + HexFormaterDirective + ], + template: ` +
+ +
+ `, + styles: `` +}) +export class HexinputfieldComponent implements OnInit{ + @Input() startValue:number = 0x1234; + @Input() displayHex:boolean = false; + formGroup:FormGroup; + constructor( private fb: FormBuilder){} + ngOnInit(): void { + this.formGroup = this.fb.group({ + testHex: [HexFormaterDirective.convertNumberToInput(this.startValue,this.displayHex) ], + }); + } +} diff --git a/src/app/specification/hexinputfield/hexinputfield.ts b/src/app/specification/hexinputfield/hexinputfield.ts new file mode 100644 index 0000000..619deff --- /dev/null +++ b/src/app/specification/hexinputfield/hexinputfield.ts @@ -0,0 +1,52 @@ +import { Directive, HostListener, ElementRef, OnInit, Input } from '@angular/core'; + +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ name: 'hexFormaterPipe' }) +export class HexFormaterPipe implements PipeTransform { + transform(value: number, hexFormat:boolean): string { + if( hexFormat) + return "0x" + value.toString(16); + else + return value.toString(); + } +} + +@Directive({ + selector: '[hexFormater]', +}) +export class HexFormaterDirective implements OnInit { + private el: HTMLInputElement; + @Input() displayHex:boolean; + constructor( + private elementRef: ElementRef, + ) { + this.el = this.elementRef.nativeElement; + } + + static convertHexInput(value:string):number| undefined{ + if(value=="") + return undefined; + var nv = (value.startsWith("0x")||value.startsWith("0X")? parseInt(value.substring(2),16):parseInt(value)) + if( Number.isNaN(nv)) + return undefined; + return nv; + } + static convertNumberToInput(value:number| undefined, displayHex:boolean):string| undefined{ + if( value == undefined|| Number.isNaN(value)) + return undefined + return (displayHex? "0x" + value.toString(16):value.toString()) + } + + ngOnInit() { + this.onFocus(this.el.value); + } + + @HostListener("focus", ["$event.target.value"]) + @HostListener("blur", ["$event.target.value"]) + onFocus(value:string) { + var numValue = HexFormaterDirective.convertHexInput(value) + if( numValue != undefined) + this.el.value = HexFormaterDirective.convertNumberToInput(numValue,this.displayHex) as string + } +} diff --git a/src/app/specification/specification/specification.component.html b/src/app/specification/specification/specification.component.html index 09eb17d..b7ded84 100644 --- a/src/app/specification/specification/specification.component.html +++ b/src/app/specification/specification/specification.component.html @@ -10,6 +10,7 @@
+ {{getStatusIcon(currentSpecification?.status)}}{{getTranslatedSpecName()}} @@ -80,11 +81,14 @@
+
+ Display Modbus Addresses in Hex Format +
@for ( entity of currentSpecification?.entities; track entity.id){ - + } - +
\ No newline at end of file diff --git a/src/app/specification/specification/specification.component.ts b/src/app/specification/specification/specification.component.ts index 38950bd..4bc89b7 100644 --- a/src/app/specification/specification/specification.component.ts +++ b/src/app/specification/specification/specification.component.ts @@ -17,6 +17,7 @@ import { Validators, FormsModule, ReactiveFormsModule, + FormControl, } from "@angular/forms"; import { ApiService } from "../../services/api-service"; import { @@ -73,9 +74,10 @@ import { UploadFilesComponent } from "../upload-files/upload-files.component"; import { MatExpansionPanel, MatExpansionPanelHeader, - MatExpansionPanelTitle, + MatExpansionPanelTitle } from "@angular/material/expansion"; import { MatList, MatListItem } from "@angular/material/list"; +import { MatSlideToggle, MatSlideToggleChange } from "@angular/material/slide-toggle"; import { MatCard, MatCardHeader, @@ -117,6 +119,7 @@ import { MatIconButton } from "@angular/material/button"; MatInput, TranslationComponent, EntityComponent, + MatSlideToggle ], }) export class SpecificationComponent @@ -134,6 +137,8 @@ export class SpecificationComponent currentSpecification: ImodbusSpecification | null; originalSpecification: ImodbusSpecification | null; uploadModbusDocumentationFormGroup: FormGroup; + displayHexFormGroup: FormGroup; + displayHex:boolean; galleryConfig: GalleryConfig = { thumbs: false }; private entitiesTouched: boolean = false; private saveSubject = new Subject(); @@ -677,10 +682,17 @@ export class SpecificationComponent manufacturer: [null as string | null], model: [null as string | null], }); + this.displayHexFormGroup = this.fb.group({ + displayHex: [false] + }) this.validationForms = this.fb.group({ spec: this.enterSpecNameFormGroup }); this.entityApiService.getConfiguration().subscribe((config) => { this.config = config; + var dispHexFg = this.displayHexFormGroup.get("displayHex"); + this.displayHex = this.config.displayHex?this.config.displayHex:false; + if( dispHexFg ) + dispHexFg.setValue( this.config.displayHex) this.specServices = new SpecificationServices( this.config.mqttdiscoverylanguage, this.entityApiService, @@ -842,4 +854,9 @@ export class SpecificationComponent getStatusText(status: SpecificationStatus | null): string { return SpecificationServices.getStatusText(status); } + onDisplayHexChanged(event: MatSlideToggleChange){ + this.displayHex = event.checked + this.config.displayHex = event.checked + this.entityApiService.postConfiguration(this.config).subscribe(()=>{}) + } }