Hi,
i want to convert a dimmer into a number inside a variable. How can i do this?
Here are my two places inside the rules:
var Number volume_old = Squeezeplayer_EG_WC_volume.state
Squeezeplayer_EG_WC_volume is a dimmer-item.
error:
{
"resource": "/w:/rules/squeezebox.rules",
"owner": "_generated_diagnostic_collection_name_#0",
"code": "org.eclipse.xtext.xbase.validation.IssueCodes.incompatible_types",
"severity": 8,
"message": "Type mismatch: cannot convert from State to Number",
"startLineNumber": 199,
"startColumn": 28,
"endLineNumber": 199,
"endColumn": 60
}
And the second problem in one of my rules:
How can i convert a string to a number? When i use a number-item between, i think the auto conversion will do this, but is this possible inside a variable declaration too?
This works:
val newValue_uid = transform("JSONPATH", "$.uid", rfid_all_haustuer.state.toString)
if (newValue_uid == 27) return;
This works not:
val newValue_uid = transform("JSONPATH", "$.uid", rfid_all_haustuer.state.toString)
if (newValue_uid < 99) return;
This is also not working:
val Number newValue_uid = transform("JSONPATH", "$.uid", rfid_all_haustuer.state.toString)
rfid_all_haustuer is a string-variable
How can i edit this to get it working?