Hmmm… I’ve been a PHP developer for many years, and all the strange types in these rules really gets me confused every time. And also the lack of a good reference guide…
Anyway, changing Temperature to Number seems to get me closer to a solution. Not all the way though. Neither floatValue, doubleValue or leaving it out completely work, they all tell me it “cannot convert from double to float” or “cannot convert from BigDecimal to float”. I’m too tired now, guess I’ll fix this tomorrow instead…
Maybe the doubleValue is there for a reason. My rules DSL is quite rusty at this point and I never did have a whole lot of experience with QuantityTypes in Rules DSL anyway.
Ok, this made me think it actually might be a good idea looking at some of the new stuff, so I started playing with Blockly here. It’s actually really fun
It’s hard to tell but indeed it looks like “get item state” has a different plug shape from variable. Kind of odd. I’ve not explored much with Blockly yet (beyond helping my seven-year-old make wonderful music in Scratch) but I need to. A page needs to be written about it in the Getting Started Tutorial.
Unfortunately, most of the OH Actions are not (yet?) supported. So those will have to be done in code. I do expect the capabilities of Blockly to grow over time. I also hope that blockly will be a bridge for users to eventually transition to JavaScript rules since when you click on the Code tab with Blockly you should see the JavaScript underlying the blocks. It can be quite a good way to learn.
It’s your thread. I read so many and respond to so many that I usually lose track of what a given thread was originally about anyway. I’m sure that causes much frustration to the other moderators.
But that can’t be done once I’ve started with Blockly, can it? The code seems to be read-only. Guess I could simply copy the generated code to a new script, but it feels like it’ll destroy the fun of Blockly
Unfortunately not I think. You can’t switch between the two, at least at this time. But if it were possible, once you manually edit the code you wouldn’t be able to go back to Blockly.
I try to stick with simple DSL.rules. I’ve rewritten a lot of my rules for oh3. I’ve moved logic to bindings and external scripts. I’m working on a new binding to handle rules in java. I’ve never liked scripts for writing logic (jython/javascripts/dsl)
It’s good to follow a general direction. Currently I’m trying around with all possible ways to do stuff, trying to decide what path to follow. The first thing I’m trying to achieve though is getting rid of all .rules files, after having moved in all items and things into the GUI
Sounds like a good strategy. In general I find it much harder to debug scripts, that’s why I try to keep as much logic as possible in java where I have good debug alternatives and testingframeworks.
Will be interesting to see if this graphical rules stuff (blockly) works. I have bad experiences doing programming in graphical tools, but I guess it’s a lot better now looking at for instance node red.