diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/led-indicator.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/led-indicator.component.ts index d983a4ebfe..a59bbca537 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/led-indicator.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/led-indicator.component.ts @@ -332,11 +332,16 @@ export class LedIndicatorComponent extends PageComponent implements OnInit, OnDe if (keyData && keyData.data && keyData.data[0]) { const attrValue = keyData.data[0][1]; if (isDefined(attrValue)) { - let parsed = null; + let valueToParse = attrValue; try { - parsed = this.parseValueFunction(JSON.parse(attrValue)); - } catch (e){/**/} - value = !!parsed; + valueToParse = JSON.parse(attrValue); + } catch (e) {/**/} + + try { + value = !!this.parseValueFunction(valueToParse); + } catch (e) { + value = false; + } } } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/round-switch.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/round-switch.component.ts index 6990ff4264..8e64cc7100 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/round-switch.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/round-switch.component.ts @@ -330,11 +330,16 @@ export class RoundSwitchComponent extends PageComponent implements OnInit, OnDes if (keyData && keyData.data && keyData.data[0]) { const attrValue = keyData.data[0][1]; if (isDefined(attrValue)) { - let parsed = null; + let valueToParse = attrValue; try { - parsed = this.parseValueFunction(JSON.parse(attrValue)); - } catch (e){/**/} - value = !!parsed; + valueToParse = JSON.parse(attrValue); + } catch (e) {/**/} + + try { + value = !!this.parseValueFunction(valueToParse); + } catch (e) { + value = false; + } } } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/switch.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/switch.component.ts index c9807e5635..7a8f4e0dd6 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/rpc/switch.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/rpc/switch.component.ts @@ -373,11 +373,16 @@ export class SwitchComponent extends PageComponent implements AfterViewInit, OnD if (keyData && keyData.data && keyData.data[0]) { const attrValue = keyData.data[0][1]; if (isDefined(attrValue)) { - let parsed = null; + let valueToParse = attrValue; try { - parsed = this.parseValueFunction(JSON.parse(attrValue)); - } catch (e){/**/} - value = !!parsed; + valueToParse = JSON.parse(attrValue); + } catch (e) {/**/} + + try { + value = !!this.parseValueFunction(valueToParse); + } catch (e) { + value = false; + } } } }