Doing maths with item states in blocky

Hi, I am trying to do some simple maths in blocky. Seems like everything is a string.

Basically all I am trying to do is a simple automatic fan program to based on the difference between the room temp (Ambient) and the set temp.

(I know - I am not very experienced. I have seen similar things with time, but it didn’t seem to apply. I was sort of hoping there was an Str2Int or Str2float type of function.).

Is there something we can help with? I don’t see a specific question, and this doesn’t look like a tutorial…

(For maths in Blockly, easiest is to set variables to your Item states, then perform maths on the variables)

Okay, but the maths functions won’t allow me to put variables into them?? I must be a dummy if this is obvious. But I want to put the variables in the maths functions.

Doing a bit of guessing here, but if you mean the two variables you set at the top of your screenshot: they won’t work for maths because you’re filling them with the Item object. If you want to get the state of the Item then you need to use the get state of Item block.

Okay, even if I get the state of the item it doesn’t work. I think because the state of an item is text and not a number. Hence you can’t do maths with text. I couldn’t see how to convert it to a number. That is the root of the question. e.g.

Can you show us the configuration of one of your Items? Is the Item a pure Number type Item, or something else?

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