S7-in scaling and MinConnect reading issue

Hi all,

I have a Logo PLC and I'm sending temperature data, collected from a sensor, to MindSphere using the MindConnect node.

Recently, I have made adjustments on Soft Comfort in order to have the temp. with a one decimal place ( it used to be 24, 25, etc., and now is 24.1, 24.2, etc.). I can see the data on the PLC perfectly fine with the AX Amplified selected. However, when it comes to Node-RED, I'm having the data multiplied to 10 (like 241, 242, etc.).
When I try to fix it using a simple function, the MindConnect gives an error saying:

"Error: Data doesn't match the configuration! Errors: [{"keyword":"str_integer","dataPath":".value","schemaPath":"#/items/select","params":{"keyword":"str_integer"},"message":"should pass "str_integer" keyword validation"}]"

I'm a beginner. Can anyone help me out, please?

I know nothing about Logo or mindconnect - but the error message would indicate that now you have divided the 241 by 10 to get 24.1 that it is no longer an integer... and the keyword seems to say that it should be a str_integer... so either you need to round the number to an integer or somehow change the type to expect a float instead.

1 Like

Thanks for your help.

Yes, it is INT and I cannot divide it by 10. I am wondering how I can convert it to REAL or FLOAT?

That sounds like a question for the author of the mindconnect node

I've just realised that <toFixed()> converts INT to FLOAT itself. So I've just used it and divide it by 10.

No it doesn't, it converts a number to a string, which is not of number type at all.

There is only one number type in javascript, which may contain a whole number or a number with a fractional part. There is no difference in javascript between int and float, except that one happens to be a whole number.

Edit: Actually that is not true, there is also now the BigInt type which can represent whole numbers larger than 2^53 - 1, the limit of the Number type.

As it is stated in the documentation above the template for time series variables, mindsphere expects the integers to be encoded as strings.


// take a look at the flow examples at https://playground.mindconnect.rocks
//
// - MindSphere expects all values to be encoded as strings
// - Integers must not have any decimal places
// - It is a good practice to use javascript literal notation
// 
// * Examples: 
// 
//   - Random value between 0 and 100: `${Math.random()*100}` 
//   - Variable (HUMIDITY) from input node : `${msg.payload.HUMIDITY}` 
//   - Variable (SPEED) from input node with 0 as default: `${msg.payload.SPEED || 0}`

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.