Skip to content

[Bug] Missing elements in config after upgrade #4105

@Tom-Hirschberger

Description

@Tom-Hirschberger

Environment

System Information

  • SYSTEM: manufacturer: Raspberry Pi Foundation; model: Raspberry Pi 5 Model B Rev 1.0; virtual: false; MM: v2.35.0
  • OS: platform: linux; distro: Debian GNU/Linux; release: 12; arch: arm64; kernel: 6.12.75+rpt-rpi-2712
  • VERSIONS: electron: 41.1.0; used node: 22.21.1; installed node: 22.21.1; npm: 10.9.4; pm2: 6.0.14
  • ENV: XDG_SESSION_TYPE: tty; MM_CONFIG_FILE: undefined
    WAYLAND_DISPLAY: undefined; DISPLAY: :0; ELECTRON_ENABLE_GPU: undefined
  • RAM: total: 8059.06 MB; free: 6885.11 MB; used: 1173.95 MB
  • OTHERS: uptime: 931 minutes; timeZone: Europe/Berlin

Which start option are you using?

node --run start

Are you using PM2?

Yes

Module

None

Have you tried disabling other modules?

  • Yes
  • No

Have you searched if someone else has already reported the issue on the forum or in the issues?

  • Yes

What did you do?

Configuration
{
			module: "MMM-ValuesByNotification",
			position: "top_right",
			//header: "Sensors",
			config: {
				debug: true,
				animationSpeed: 0,
				updateInterval: 90,
				valuePositions: "tivu",
				classes: "environment",
				naValue: "na.na",
				valueFormat: "Number(${value}).toFixed(1)",
				transformerFunctions: {
					zisterneAddPercent: (value) => {
						return value+"l ("+(Number(value/1600)*100).toFixed(0)+"%)"
					},
					rountToInt: (value) => {
						try {
							return Math.round(parseFloat(value))
						} catch {
							return value
						}
					},
					toKiloValue: (value) => {
						if(value >= 10000){
							value = Math.round(value/10000)
							return value+"k"
						} else {
							return value
						}
					},
                },
				groups: [
					{
						items: [
							{
								valueTitle: "Dach",
								notification: "KNX_DACH_TEMP",
								reuseCount: 50,
								values: [
									{
										valueIcon: "fxemoji:thermometer",
										valueUnit: "°C",
									},
								]
							},
							{
								notification: "KNX_DACH_LIGHT",
								reuseCount: 1000,
								naValue: "na",
								valueFormat: "{value}",
								valueTransformers: ["rountToInt", "toKiloValue"],
								values: [
									{
										valueIcon: "fa-sun-o",
										valueUnit: "Lux",
									},
								]
							},
						]
					},
					{
						items: [
							{
								valueTitle: "Südseite",
								notification: "TEMPERATURE_C_ESPNORD",
								reuseCount: 4,
								values: [
									{
										valueIcon: "fxemoji:thermometer",
										valueUnit: "°C",
									},
								]
							},
							{
								notification: "HUMIDITY_ESPNORD",
								reuseCount: 4,
								values: [
									{
										valueIcon: "fa fa-tint",
										valueUnit: "%rH",
									},
								]
							},
						]
					},
					{
						items: [
							{
								valueTitle: "Büro",
								notification: "TEMPERATURE_C_ESPBUERO",
								reuseCount: 4,
								values: [
									{
										valueIcon: "fxemoji:thermometer",
										valueUnit: "°C",
									},
								]
							},
							{
								notification: "HUMIDITY_ESPBUERO",
								reuseCount: 4,
								values: [
									{
										valueIcon: "fa fa-tint",
										valueUnit: "%rH",
									},
								]
							},
						]
					},
					{
						items: [
							{
								valueTitle: "Schlafen",
								notification: "KNX_OG_SZ_TEMP",
								reuseCount: 180,
								values: [
									{
										valueIcon: "fxemoji:thermometer",
										valueUnit: "°C",
									},
								]
							},
							{
								notification: "KNX_OG_SZ_TEMP_SET",
								reuseCount: 100000,
								values: [
									{
										naValue: "(na.na",
										valueUnit: "°C)",
										valueIcon: "mdi:home-thermometer",
										valueFormat: "\"(\"+Number(${value}).toFixed(1)"
									},
								]
							},
						]
					},
					{
						items: [
							{
								valueTitle: "Bad",
								notification: "KNX_OG_BAD_TEMP",
								reuseCount: 180,
								values: [
									{
										valueIcon: "fxemoji:thermometer",
										valueUnit: "°C",
									},
								]
							},
							{
								notification: "KNX_OG_BAD_TEMP_SET",
								reuseCount: 100000,
								values: [
									{
										naValue: "(na.na",
										valueUnit: "°C)",
										valueIcon: "mdi:home-thermometer",
										valueFormat: "\"(\"+Number(${value}).toFixed(1)"
									},
								]
							},
						]
					},
					{
						items: [
							{
								valueTitle: "Nähen",
								notification: "KNX_OG_GALERIE_TEMP",
								reuseCount: 180,
								values: [
									{
										valueIcon: "fxemoji:thermometer",
										valueUnit: "°C",
									},
								]
							},
							{
								notification: "KNX_OG_GALERIE_TEMP_SET",
								reuseCount: 100000,
								values: [
									{
										naValue: "(na.na",
										valueUnit: "°C)",
										valueIcon: "mdi:home-thermometer",
										valueFormat: "\"(\"+Number(${value}).toFixed(1)"
									},
								]
							},
						]
					},
					{
						items: [
							{
								valueTitle: "Kinder",
								notification: "KNX_OG_KINDER_TEMP",
								reuseCount: 180,
								values: [
									{
										valueIcon: "fxemoji:thermometer",
										valueUnit: "°C",
									},
								]
							},
							{
								notification: "KNX_OG_KINDER_TEMP_SET",
								reuseCount: 100000,
								values: [
									{
										naValue: "(na.na",
										valueUnit: "°C)",
										valueIcon: "mdi:home-thermometer",
										valueFormat: "\"(\"+Number(${value}).toFixed(1)"
									},
								]
							},
						]
					},
					{
						items: [
							{
								valueTitle: "Wohnzimmer",
								notification: "KNX_EG_WZ_TEMP",
								reuseCount: 180,
								values: [
									{
										valueIcon: "fxemoji:thermometer",
										valueUnit: "°C",
									},
								]
							},
							{
								notification: "KNX_EG_WZ_TEMP_SET",
								reuseCount: 100000,
								values: [
									{
										naValue: "(na.na",
										valueUnit: "°C)",
										valueIcon: "mdi:home-thermometer",
										valueFormat: "\"(\"+Number(${value}).toFixed(1)"
									},
								]
							},
						]
					},
					//ZISTERNE
					{
						valueFormat: "{value}",
						classes: "zisterne",
						items: [
							{
								notification: "ZISTERNE_VALUES",
								reuseCount: 15,
								jsonpath: "rounded",
								naValue: "na",
								values: [
									{
										valueTitle: "Zisterne",
										valuePositions: "ti[v]",
										valueImgIcon: "modules/MMM-ValuesByNotification/icons/wassertank/wassertank-0.svg",
										valueUnit: "l",
										valueTransformers: ["zisterneAddPercent"],
										thresholds: [
											{
												valueImgIcon: "modules/MMM-ValuesByNotification/icons/wassertank/wassertank-100.png",
												type: "gt",
												value: 1550,
											},
											{
												valueImgIcon: "modules/MMM-ValuesByNotification/icons/wassertank/wassertank-90.png",
												type: "gt",
												value: 1395,
											},
											{
												valueImgIcon: "modules/MMM-ValuesByNotification/icons/wassertank/wassertank-80.png",
												type: "gt",
												value: 1240,
											},
											{
												valueImgIcon: "modules/MMM-ValuesByNotification/icons/wassertank/wassertank-70.png",
												type: "gt",
												value: 1085,
											},
											{
												valueImgIcon: "modules/MMM-ValuesByNotification/icons/wassertank/wassertank-60.png",
												type: "gt",
												value: 930,
											},
											{
												valueImgIcon: "modules/MMM-ValuesByNotification/icons/wassertank/wassertank-50.png",
												type: "gt",
												value: 775,
											},
											{
												valueImgIcon: "modules/MMM-ValuesByNotification/icons/wassertank/wassertank-40.png",
												type: "gt",
												value: 620,
											},
											{
												valueImgIcon: "modules/MMM-ValuesByNotification/icons/wassertank/wassertank-30.png",
												type: "gt",
												value: 465,
											},
											{
												valueImgIcon: "modules/MMM-ValuesByNotification/icons/wassertank/wassertank-20.png",
												type: "gt",
												value: 310,
											},
											{
												valueImgIcon: "modules/MMM-ValuesByNotification/icons/wassertank/wassertank-10.png",
												type: "gt",
												value: 155,
											},
										]
									},
								]
							},
						]
					}
				]
			},
			classes: "pageC"
		},

What did you expect to happen?

Maybe the new way to parse the config is the problem. I am not that deep in the core to check what happens during the start.

What actually happened?

Hi and sorry for the big config but i do not want a small detail being responsible for my current problem.

After the update to 2.35 my transformerFunctions do not work anymore.

The idea is to provide transformer functions in config->transformerFunctions which are small javascript functions which then can be called later in values either single or after each other.

Everything works as expected since years but after the upgrade to 2.35 the transformerFunctions are empty ({}) and can not be called later.

I am not sure what is the reason for this and i am very sure that my module is a edge case in the Mirror world.

Additional comments

No response

Participation

  • I am willing to submit a pull request for this change.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions