Couldn't change item dimension

Tags: #<Tag:0x00007f616be94e30> #<Tag:0x00007f616be94d40>

Hi,

i’ve got a item wich is automatically created as number:temperature (Xiaomi). I want to compare it by next rule engine with a state but it wont work. I don’t know why because compare a other item wich is only formatted as number works perfect.

So i want to delete the Dimension of the Xiaomi-Device but i couldn’t do it. Has anyone an idea?

Best regards!
Chris

Leave the Item alone.
Fix your comparison -

Hi rossko,

thanks for that reply. In Next Rule Engine i’ve tried 20 | “°C” but it won’t work. I think i must do it via textfiles in rules but never do it before. I worte:

rule "Werkstatt"
when
	Thing SEN-Xiaomi-Werkstatt received update
then
	if((SEN-Xiaomi-Werkstatt_Temperature.state as DecimalType).floatValue() < 20) {
		PWR-Werkstatt-Heizung.sendCommand(ON)
	}
end

But it gives me an error i do not understand.

2020-09-07 19:44:46.247 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'RLE_Werkstatt_Heizung_ON.rules' has errors, therefore ignoring it: [3,2]: no viable alternative at input 'SEN

It would be nice if you could give me advise.

Best regards
Chris

Ok, learned that the item names are wrong. I’ve switched off simple mode to get the correct itemnames and replaced it.

That is the new error:

2020-09-07 20:11:59.367 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Werkstatt': The name 'mihome_sensor_ht_158d00042600a5_temperature' cannot be resolved to an item or type; line 5, column 6, length 43

Hope i could solve it.

If you mean the graphical rule editor provided in PaperUI, yes it’s incomplete and limited, and will not be completed.

I have no problem with that, but someone will be along in a minute to point out that text based rules (often named DSL rules) is a legacy of openHAB-1. The future of rules for OH3 is “scripted automation” which supports various scripting languages via the new rule engine, like jython.

Which is to say, you may not wish to learn DSL if just starting out.

This complains about

you generally have put " " quotemarks around Thing UIDs used here.
But I don’t think that is a valid UID anyway.

Your new rule is a secret, so that makes it difficult to help.

Somewhere in your new rule you mention something using the name
mihome_sensor_ht_158d00042600a5_temperature
but you do not seem to have an Item or variable of that name.

I made a few mistakes and every answer helped me to learn to configure openhab correct. I don’t find a solution to handle this issue with the “New Rule Engine”.

I’ve deselected the simple mode in Paper UI and added dummy items manually. Then i’ve added a rule manually:

rule "RLE_Werkstatt_Thermostat"
when
	Item mihome_sensor_ht_158d00042600a5_temperature received update or
	Item FKE_Werkstatt_Thermostat changed or
	Item FKE_Werkstatt_Thermostat_Vorwahl changed
then
	if( mihome_sensor_ht_158d00042600a5_temperature.state < FKE_Werkstatt_Thermostat_Vorwahl.state ) {
		if( FKE_Werkstatt_Thermostat.state == ON ) {
			mqtt_topic_PWR_Werkstatt_Heizung_Power.sendCommand(ON)
		}
	} else {
		mqtt_topic_PWR_Werkstatt_Heizung_Power.sendCommand(OFF)
	}
end

The item “FKE_Werkstatt_Themostat_Vorwahl” is defined as Number / Temperature in Paper UI. If you don’t define it as Temperature you could compare the state when you add | "°C" in the code.

This example works fine. There is just a simple bug in my code. The heater will powered on if the temperature is less than defined but only if the dummy switch for this rule is powered on. Now take a look to the “when”-section of the rule. In some case you could deactivate the rule but the heater will heat up to the last defined temperature when you have choose to deactivate the rule trigger after setting a higher temperature. But this is not a problem of the rule or OpenHAB. I have to change the code, it is not a perfect example for a wise solution.