Homematic Wireless Radiator Thermostat HM-CC-RT-DN > HmIP-eTRV-2

Just wanted to share my current setup of homematic Wireless Radiator Thermostat HM-CC-RT-DN control to get you feedback where/what that can improved

Following functions are implemented:

  • Auto mode - switch into auto_state on mode; Thermostat uses timing rules of homematic
  • Boost mode - switch into boost_mode; quick warm up
  • Day mode - switch into comfort_mode, auto off, low off
  • Night mode - switch into low_mode, auto off, comfort off

Functions via homematic ccu:

  • set timing rules - actually would love to have that configuration in openhab but currently now idea how to implement to enter numbers in openhab.

Major challenge I had is how to receive the status of each mode of the device. While I can request the state for “auto” and “boost”, there seems to be no possiblity to get the state for “comfort” and “low”

As mentioned earlier a “refresh” function for homematic devices would be highly appreciated.

Would appreciate any ideas how to improve configuration below:

items:

/* Heating */
Switch Heating_CE_Office                "Temp. Office"        <heating>    (CE_Office, Heating)
Number Heating_CE_Office_Control         "Mode" <temperature> (CE_Office, Heating)
Switch Heating_CE_Office_Mode_Auto         {homematic="address=KEQ012345, channel=4, parameter=AUTO_MODE"}
Switch Heating_CE_Office_Mode_Boost     {homematic="address=KEQ012345, channel=4, parameter=BOOST_MODE"}
Switch Heating_CE_Office_Mode_Comfort     {homematic="address=KEQ012345, channel=4, parameter=COMFORT_MODE"}
Switch Heating_CE_Office_Mode_Lower     {homematic="address=KEQ012345, channel=4, parameter=LOWERING_MODE"}
Switch Heating_CE_Office_Mode_Manu         {homematic="address=KEQ012345, channel=4, parameter=MANU_MODE"}
Number Heating_CE_Office_Mode_Control     {homematic="address=KEQ012345, channel=4, parameter=CONTROL_MODE"}
Number Heating_CE_Office_SET_TEMP         {homematic="address=KEQ012345, channel=4, parameter=SET_TEMPERATURE"}

rules:

/* Homematic HEATING Office Status Update*/
rule "Update Status Thermostat Office"

when 
    Time cron "0 * * * * ?" or                        // Jede Minute überprüfen, oder
    Item Heating_CE_Office_Mode_Control changed       // oder wenn sich Item ändert

    then
        switch (Heating_CE_Office_Mode_Control.state)
        {
            case 0 : postUpdate(Heating_CE_Office_Control, 0 )
            case 3 : postUpdate(Heating_CE_Office_Control, 1 )
            case 1 : {
                if (Heating_CE_Office_SET_TEMP.state > 20)
                    postUpdate(Heating_CE_Office_Control, 2 )
                else
                    postUpdate(Heating_CE_Office_Control, 3 )            
            }                   
        }
end

/* Homematic HEATING Office */
rule "Select Heating Mode Office"
    when
        Item Heating_CE_Office_Control received command
    then
        switch (Heating_CE_Office_Control.state)
        {
            case 0 : {
                sendCommand(Heating_CE_Office_Mode_Lower, OFF)
                sendCommand(Heating_CE_Office_Mode_Comfort, OFF)
                sendCommand(Heating_CE_Office_Mode_Auto, ON)
            }
            case 1 : {
                sendCommand(Heating_CE_Office_Mode_Boost, ON)
            }
            case 2 : {
                sendCommand(Heating_CE_Office_Mode_Manu, ON)
                sendCommand(Heating_CE_Office_Mode_Lower, OFF)     
                sendCommand(Heating_CE_Office_Mode_Comfort, ON)
            }
            case 3 : {
                sendCommand(Heating_CE_Office_Mode_Manu, ON)
                sendCommand(Heating_CE_Office_Mode_Comfort, OFF)    
                sendCommand(Heating_CE_Office_Mode_Lower, ON)
            }
        }
end

sitemap:
        Frame label="Office" {
            Switch item=Heating_CE_Office_Control mappings=[0="AUTO", 1="BOOST", 2="Tag", 3="Nacht"]
        }

Please edit your post and mark your code samples as “pre-formatted code”. This will enhance the readability.
You can either use the button “</>” in the editor’s toolbar or simply write 3 backticks (`) before and after the code samples.

Some general comments.

  • In the long run you will run into fewer problems, and it is more efficient to use the sendCommand and postUpdate methods verses the actions. Heating_CE_Office_Mode_Lower.sendCommand(OFF). It’s a long explanation, the tl;dr is that the Action only accepts Strings so when you pass it OFF, it gets converted to a String “OFF”, then has to be parsed back into OFF to be assigned to the Item, and in some cases, particularly with numerical values, this conversion back and forth sometimes doesn’t work right.

  • I personally would use String Items and meaningful names for the states verses numbers. case "OFF": and case "BOOST": are both a lot more self documenting to the coder than case 0: and case 3:.

  • This is also a personal preference, but I prefer to avoid repeating code that causes effects. Instead, I’ll use variables to capture what the new state should be and only call postUpdate or sendCommand the one time. For example, yoiur first Rule I would write as:

    var newVal = Heating_CE_Office_Control.state as Number // by default don't change anything
    switch (Heating_CE_Office_Mode_Control.state.toString) {
        case "OFF": newVal = 0
        case "ON": newVal = 1
        case "BOOST": newVal = if(Heating_CE_Office_SET_TEMP.state as Number > 20) 2 else 3
    }
    Heating_CE_Office_Control.postUpdate(newVal)

Not only is the code a little cleaner to read but if you need to change that postUpdate to a sendCommand, or send it to an additional Item, or add some more logic before you actually postUpdate you only have to change it in one place.

  • Why check every minute in addition to checking for Heating_CE_Office_Mode_Control to change? Why not trigger on both Heating_CE_Office_Mode_Control and Heating_CE_Office_SET_TEMP? Only changes to these two Items will result in any effects that this rule could cause. Running once a minute is wasteful.
1 Like

In addition to what @rlkoshak said about the cron, you should transfer your files to the 2.x notation of the binding (If you are running 2.x, which i suggest as well). I don’t use strings for the mode switching because i use rrd4j persistence service, which is only able to store numbers.

Switch F2HK_AUTO_MODE "Auto F2" { channel = "homematic:HG-HM-CC-RT-DN:homegear:NEQ0875870:4#AUTO_MODE" }
Switch F2HK_BOOST_MODE "Boost F2" { channel = "homematic:HG-HM-CC-RT-DN:homegear:NEQ0875870:4#BOOST_MODE" }
Switch F2HK_LOWERING_MODE "Eco F2" { channel = "homematic:HG-HM-CC-RT-DN:homegear:NEQ0875870:4#LOWERING_MODE" }
Switch F2HK_COMFORT_MODE "Comfort F2" { channel = "homematic:HG-HM-CC-RT-DN:homegear:NEQ0875870:4#COMFORT_MODE" }

Be aware, i am running homegear as ccu2 replacement, so my channels contain an additional HG-prefix, my base-id is homegear. You can review your channel-ids in PaperUI. Be sure to press “Show more” to see all channels

Basically, these thermostats have just two primary modes, auto or manual. Eco and comfort mode just modify the set temperature. In auto-mode this is just temporary until the next profile-defined switch time, in manual mode this is permanent. (if you switch to manual when you want to switch eco or comfort on, you better not forget to switch it back to auto afterwards. I don’t want to forget that, i never use manual.)

You have all information if you just show CONTROL_MODE and SET_TEMPERATURE.

This is my rule for that, just for a few more rooms.

rule "Room_SET_MODE"
when 
    Item AZH_SET_MODE changed or      
    Item ArH_SET_MODE changed or   
    Item B1H_SET_MODE changed or
    Item FEH_SET_MODE changed or 
    Item KUH_SET_MODE changed or 
    Item LeH_SET_MODE changed or    
    Item MiH_SET_MODE changed or
    Item SZH_SET_MODE changed or
    Item WZH_SET_MODE changed or
    Item F2HK_SET_MODE changed or
    Item TEHK_SET_MODE changed or
    Item T1HK_SET_MODE changed or
    Item GZHK_SET_MODE changed    
then    
    val String room = triggeringItem.name.split("_").get(0)
    switch (triggeringItem.state)
    {
        case 0: gSetModes.members.filter[i|i.name==room + "_AUTO_MODE"].last.sendCommand(ON)
        case 1: gSetModes.members.filter[i|i.name==room + "_BOOST_MODE"].last.sendCommand(ON)
        case 2: gSetModes.members.filter[i|i.name==room + "_LOWERING_MODE"].last.sendCommand(ON)
        case 3: gSetModes.members.filter[i|i.name==room + "_COMFORT_MODE"].last.sendCommand(ON)
    }
end

If you want to show the detailed mode, you can use a transformation of your item, no need for a rule:

Number Heating_CE_Office_Control         "Mode [MAP(modes.map):%s]" <temperature> (CE_Office, Heating)

With the following transformation (transform/modes.map):

0=Auto
1=Boost
2=Eco
3=Comfort

But be aware, you need a persistence service to keep the information over restarts of openHAB.

Excellent feedback and recommendation, many thanks.
What is does your sitemap file look like for your example above?

Selection	item=AZH_SET_MODE mappings=[0="AUTO", 1="BOOST", 2="LOWERING", 3="COMFORT"]
1 Like

I usually use switches.

Switch item=AZH_SET_MODE mappings=[0="Auto", 1="Boost", 2="Eco", 3="Comfort"]		

does not work on my setup


2018-01-10 19:19:56.202 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'main.sitemap'
2018-01-10 19:20:10.910 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'AZH_SET_MODE' for widget org.eclipse.smarthome.model.sitemap.Switch
2018-01-10 19:20:10.920 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'AZH_SET_MODE' for widget org.eclipse.smarthome.model.sitemap.Switch
2018-01-10 19:20:10.926 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch
2018-01-10 19:20:10.937 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'AZH_SET_MODE' for widget org.eclipse.smarthome.model.sitemap.Selection
2018-01-10 19:20:10.941 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'AZH_SET_MODE' for widget org.eclipse.smarthome.model.sitemap.Selection
2018-01-10 19:20:10.946 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Selection
2018-01-10 19:20:41.378 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'AZH_SET_MODE' for widget org.eclipse.smarthome.model.sitemap.Switch
2018-01-10 19:20:41.383 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'AZH_SET_MODE' for widget org.eclipse.smarthome.model.sitemap.Switch
2018-01-10 19:20:41.389 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch
2018-01-10 19:20:41.396 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'AZH_SET_MODE' for widget org.eclipse.smarthome.model.sitemap.Selection
2018-01-10 19:20:41.401 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'AZH_SET_MODE' for widget org.eclipse.smarthome.model.sitemap.Selection
2018-01-10 19:20:41.407 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Selection

Do you have an AZH_SET_MODE Item defined?

Did you define this item?

Number AZH_SET_MODE "AZ"

Thank you for feedback; yes, you are right forgot to create item AZH_SET_MODE

Switched from HM-CC-RT-DN to the newer HmIP-eTRV-2
Tried to implement rules in same way, however they do not work.

Below is my setup for two rooms and rules for Room1:

items:

Group  gSetModes
Group  gEcoModes
Group  gSetTempModes
// heating.items
Group  gR1 "Room1"
Number R1_ACTUAL_TEMPERATURE 	    "Temp Room1 Ist" 	                                                    {channel="homematic:HmIP-eTRV-2:ccu:000A1709ACxxxx:1#ACTUAL_TEMPERATURE"}
Number R1_SET_POINT_TEMPERATURE     "Temp Room1 Soll" 	                                    (gSetTempModes) {channel="homematic:HmIP-eTRV-2:ccu:000A1709ACxxxx:1#SET_POINT_TEMPERATURE"}
Number R1_SET_POINT_MODE            "SET-Mode [MAP(HMIP-eTRV.map):%s]"      <temperature>   (gSetModes)     {channel="homematic:HmIP-eTRV-2:ccu:000A1709ACxxxx:1#SET_POINT_MODE"}
Number R1_CONTROL_MODE              "Auto-Mode [MAP(HMIP-eTRV.map):%s]"     <temperature>   (gHeating)      {channel="homematic:HmIP-eTRV-2:ccu:000A1709ACxxxx:1#CONTROL_MODE"}
Switch R1_BOOST_MODE                "Boost"                                 <heating>       (gHeating)      {channel="homematic:HmIP-eTRV-2:ccu:000A1709ACxxxx:1#BOOST_MODE"}
Switch R1_ECO_MODE                  "ECO-Mode"                              <temperature>   (gEcoModes)

Group  gR2 "Room2"
Number R2_ACTUAL_TEMPERATURE	    "Temperatur Room2 Ist" 	                                            {channel="homematic:HmIP-eTRV-2:ccu:000A1709ACyyyy:1#ACTUAL_TEMPERATURE"}
Number R2_SET_POINT_TEMPERATURE     "Temperatur Room2 Soll" 	                            (gSetTempModes) {channel="homematic:HmIP-eTRV-2:ccu:000A1709ACyyyy:1#SET_POINT_TEMPERATURE"}
Number R2_SET_POINT_MODE            "SET-Mode [MAP(HMIP-eTRV.map):%s]"      <temperature>   (gSetModes)     {channel="homematic:HmIP-eTRV-2:ccu:000A1709ACyyyy:1#SET_POINT_MODE"}
Number R2_CONTROL_MODE              "Auto-Mode [MAP(HMIP-eTRV.map):%s]"     <temperature>   (gHeating)      {channel="homematic:HmIP-eTRV-2:ccu:000A1709ACyyyy:1#CONTROL_MODE"}
Switch R2_BOOST_MODE                "Boost"                                 <heating>       (gHeating)      {channel="homematic:HmIP-eTRV-2:ccu:000A1709ACyyyy:1#BOOST_MODE"}
Switch R2_ECO_MODE                  "ECO-Mode"                              <temperature>   (gEcoModes)

and sitemap (just one example or Room1

     		Text		item=R1_ACTUAL_TEMPERATURE		label="Temperatur Ist  [%.1f °C]" valuecolor=[>30="red",>20="orange",>15="green",>1="green",<=1="aqua"] icon="temperature"
     		Setpoint	item=R1_SET_POINT_TEMPERATURE		label="Temperatur Soll [%.1f °C]" minValue=8 maxValue=32 step=1 icon="temperature"
			Switch		item=R1_CONTROL_MODE  			mappings=[0="AUTO", 1="MANU"]
			Switch 	 	item=R1_ECO_MODE
			Switch	 	item=R1_BOOST_MODE

rule for AUT/MANU mode for one single room - works fine

rule "Set AUTO_MANU Mode R1"
when 
    Item R1_SET_POINT_MODE changed
then
    switch (R1_SET_POINT_MODE.state)
    {
	case 0: R1_CONTROL_MODE.sendCommand(0)
	case 1: R1_CONTROL_MODE.sendCommand(1)	
    }
end

rule for ECO mode for one single room - works fine

rule "Set Eco Modus R1"
when 
    Item R1_ECO_MODE changed
then 
    switch (R1_ECO_MODE.state)
    {
   		case OFF: R1_SET_POINT_TEMPERATURE.sendCommand (day)
		case ON: R1_SET_POINT_TEMPERATURE.sendCommand (night)
    } 
end

rule "Check ECO Mode R1"
when 
	Item R1_SET_POINT_TEMPERATURE changed
then
	 var double set_temp = (Office_SET_POINT_TEMPERATURE.state as DecimalType).doubleValue
	 if (set_temp < 21) 
         {
		logInfo("Check ECO Mode", "SET_POINT_TEMPERATURE.state<21")
		R1_ECO_MODE.sendCommand (ON) 
         }
	 else 
         {
		logInfo("Check ECO Mode", "SET_POINT_TEMPERATURE.state>21")
		R1_ECO_MODE.sendCommand (OFF)
         }
end

Now I want to use above recomendations and create rules which work for all rooms:

rules:

//heating.rules
val day = "21"
val night = "17"


rule "Set AUTO_MANU Mode"

when 
	Item 	R1_SET_POINT_MODE changed or
	Item	R2_SET_POINT_MODE changed
        //actually do have more rooms but shortened this
then 
    val String room = triggeringItem.name.split("_").get(0)
    switch (triggeringItem.state)
	{
		case 0: gSetModes.members.filter[i|i.name==room + "_CONTROL_MODE"].last.sendCommand(0)
		case 1: gSetModes.members.filter[i|i.name==room + "_CONTROL_MODE"].last.sendCommand(1)	
	}
end

rule "Set Eco Modus"
when 
	Item R1_ECO_MODE changed or
	Item R2_ECO_MODE changed
then 
    val String room = triggeringItem.name.split("_").get(0)
    switch (triggeringItem.state)
	{
   		case OFF: gEcoModes.members.filter[i|i.name==room + "_SET_POINT_TEMPERATURE" ].last.sendCommand (day)
		case ON: gEcoModes.members.filter[i|i.name==room + "_SET_POINT_TEMPERATURE" ].last.sendCommand (night)
    } 
end

rule "Check ECO Mode"
when 
	Item R1_SET_POINT_TEMPERATURE changed or
	Item R2_SET_POINT_TEMPERATURE changed
then
    val String room = triggeringItem.name.split("_").get(0)
	var double set_temp = (triggeringItem.state as DecimalType).doubleValue
	 if (set_temp < 21) {
		logInfo("Check ECO Mode", "SET_POINT_TEMPERATURE.state<21")
		gSetTempModes.members.filter[i|i.name==room + "_ECO_MODE"].sendCommand (ON) }
	 else {
		logInfo("Check ECO Mode", "SET_POINT_TEMPERATURE.state>21")
		gSetTempModes.members.filter[i|i.name==room + "_ECO_MODE"].sendCommand (OFF) }
end

ECO Mode does not work; if I switch state on app I get following error messages

2018-01-14 16:29:12.122 [INFO ] [marthome.model.script.Check ECO Mode] - SET_POINT_TEMPERATURE.state<21
2018-01-14 16:29:12.143 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Check ECO Mode': 'sendCommand' is not a member of 'com.google.common.collect.Iterables$6'; line 51, column 3, length 75
2018-01-14 16:29:21.080 [INFO ] [marthome.model.script.Check ECO Mode] - SET_POINT_TEMPERATURE.state>21
2018-01-14 16:29:21.090 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Check ECO Mode': 'sendCommand' is not a member of 'com.google.common.collect.Iterables$6'; line 54, column 3, length 76
2018-01-14 16:30:03.608 [INFO ] [marthome.model.script.Check ECO Mode] - SET_POINT_TEMPERATURE.state>21
2018-01-14 16:30:03.618 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Check ECO Mode': 'sendCommand' is not a member of 'com.google.common.collect.Iterables$6'; line 54, column 3, length 76

AUTO/MANU mode works from the app but if change state on device app is not updated.
However if I use this rule for one single room it works in both ways, e.g. works from app and app is update if I change state on device

Would be great to get some further hints how to get this work and improve code

Best, Jens

The group gSetModes does not contain any item which name ends with “_CONTROL_MODE”. Your control mode items are located in the group gHeating.

@Joachim, thanks for the hint, yes you are right and that was the reason why AUTO/MANU rule did not work. Now it works perfectly fine with the code below:

rule "Set AUTO_MANU Mode"

when 
	Item 	R1_SET_POINT_MODE changed or
	Item	R2_SET_POINT_MODE changed
then 
    val String room = triggeringItem.name.split("_").get(0)
    switch (triggeringItem.state)
	{
		case 0: gSetModes.members.filter[i|i.name==room + "_CONTROL_MODE"].last.sendCommand(0)
		case 1: gSetModes.members.filter[i|i.name==room + "_CONTROL_MODE"].last.sendCommand(1)	
	}
end
Group  gSetModes
Group  gEcoModes
Group  gSetTempModes
// heating.items
Group  gOffice "Office"
Number R1_ACTUAL_TEMPERATURE 	"Temp Room1 Ist" 	                                                    {channel="homematic:HmIP-eTRV-2:ccu:000A1709ACxxxx:1#ACTUAL_TEMPERATURE"}
Number R1_SET_POINT_TEMPERATURE "Temp Room1 Soll" 	                                (gSetTempModes) channel="homematic:HmIP-eTRV-2:ccu:000A1709ACxxxx:1#SET_POINT_TEMPERATURE"}
Number R1_SET_POINT_MODE        "SET-Mode [MAP(HMIP-eTRV.map):%s]"      <temperature>   (gHeating)    {channel="homematic:HmIP-eTRV-2:ccu:000A1709ACxxxx:1#SET_POINT_MODE"}
Number R1_CONTROL_MODE          "Auto-Mode [MAP(HMIP-eTRV.map):%s]"     <temperature>   (gSetModes)      {channel="homematic:HmIP-eTRV-2:ccu:000A1709ACxxxx:1#CONTROL_MODE"}
Switch R1_BOOST_MODE            "Boost"                                 <heating>       (gHeating)      {channel="homematic:HmIP-eTRV-2:ccu:000A1709ACxxxx:1#BOOST_MODE"}
Switch R1_ECO_MODE              "ECO-Mode"                              <temperature>   (gEcoModes)

Only problem left is my ECO rule.

rule "Check ECO Mode"
when 
	Item R1_SET_POINT_TEMPERATURE changed or
	Item R2_SET_POINT_TEMPERATURE changed
then
    val String room = triggeringItem.name.split("_").get(0)
	var double set_temp = (triggeringItem.state as DecimalType).doubleValue
	 if (set_temp < 21) {
		logInfo("Check ECO Mode", "SET_POINT_TEMPERATURE.state<21")
		gEcoModes.members.filter[i|i.name==room + "_ECO_MODE"].sendCommand (ON) }
	 else {
		logInfo("Check ECO Mode", "SET_POINT_TEMPERATURE.state>21")
		gEcoModes.members.filter[i|i.name==room + "_ECO_MODE"].sendCommand (OFF) }
end

Following is the ERROR in the logfile, however it does not say anything to me


2018-01-14 20:22:38.384 [INFO ] [marthome.model.script.Check ECO Mode] - SET_POINT_TEMPERATURE.state<21
2018-01-14 20:22:38.422 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Check ECO Mode': 'sendCommand' is not a member of 'com.google.common.collect.Iterables$6'; line 96, column 3, length 71
2018-01-14 20:22:39.928 [INFO ] [marthome.model.script.Check ECO Mode] - SET_POINT_TEMPERATURE.state>21
2018-01-14 20:22:39.939 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Check ECO Mode': 'sendCommand' is not a member of 'com.google.common.collect.Iterables$6'; line 99, column 3, length 72


Compare the control mode sendCommand line against the eco mode sendCommand line and you will find the reason. There is a small but important difference.

found my last error:

code which works is follows:

	 if (set_temp < 21) {
		logInfo("Check ECO Mode", "SET_POINT_TEMPERATURE.state<21")
		gEcoModes.members.filter[i|i.name==room + "_ECO_MODE"].last.sendCommand (ON) }
	 else {
		logInfo("Check ECO Mode", "SET_POINT_TEMPERATURE.state>21")
		gEcoModes.members.filter[i|i.name==room + "_ECO_MODE"].last.sendCommand (OFF) }

not sure why here I have to say “.last.sendCommand” instead of “.sendCommand”

Anyway thanks a lot to all help for the valuable tips and guidance
Jens

nevertheless one minor thing whenever I do a restart of oh2 following error messages occur at the logfile

018-01-14 21:04:26.680 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Check ECO Mode': The name 'triggeringItem' cannot be resolved to an item or type; line 92, column 23, length 14
2018-01-14 21:04:26.681 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Set AUTO_MANU Mode': The name 'triggeringItem' cannot be resolved to an item or type; line 27, column 23, length 14
2018-01-14 21:04:26.762 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Set AUTO_MANU Mode': The name 'triggeringItem' cannot be resolved to an item or type; line 27, column 23, length 14
2018-01-14 21:04:26.778 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Check ECO Mode': The name 'triggeringItem' cannot be resolved to an item or type; line 92, column 23, length 14


.filter returns a collection of items. A collection of items does not define the method sendCommand. You need to select the Item of the collection.

Why did you use .last in your control mode rule and not in your eco mode rule?

I do get error messages

2018-02-03 15:21:07.515 [INFO ] [marthome.model.script.Check ECO Mode] - SET_POINT_TEMPERATURE.state>21
2018-02-03 15:21:07.532 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Check ECO Mode': The name 'gEcoModes' cannot be resolved to an item or type; line 99, column 3, length 9
2018-02-03 15:21:07.536 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Set Eco Modus': The name 'triggeringItem' cannot be resolved to an item or type; line 57, column 23, length 14

on following rules

rule "Set Eco Modus"
when 
	Item Office_ECO_MODE changed or
	Item Studio_ECO_MODE changed or
	Item SBad_ECO_MODE changed or
	Item Philipp_ECO_MODE changed or
	Item Alicia_ECO_MODE changed
then 
    val String room = triggeringItem.name.split("_").get(0)
    switch (triggeringItem.state)
	{
   		case OFF: {
			   logInfo("Check SET Mode", "ECO MODE OFF")
			   gSetTempModes.members.filter[i|i.name==room + "_SET_POINT_TEMPERATURE" ].last.sendCommand (day) }
		case ON: {
			logInfo("Check SET Mode", "ECO MODE ON")
			gSetTempModes.members.filter[i|i.name==room + "_SET_POINT_TEMPERATURE" ].last.sendCommand (night) }
    } 
end
rule "Check ECO Mode"
when 
	Item Office_SET_POINT_TEMPERATURE changed or
	Item Studio_SET_POINT_TEMPERATURE changed or
	Item SBad_SET_POINT_TEMPERATURE changed or
	Item Philipp_SET_POINT_TEMPERATURE changed or
	Item Alicia_SET_POINT_TEMPERATURE changed
then
    val String room = triggeringItem.name.split("_").get(0)
	var double set_temp = (triggeringItem.state as DecimalType).doubleValue
	 if (set_temp < 21) {
		logInfo("Check ECO Mode", "SET_POINT_TEMPERATURE.state<21")
		gEcoModes.members.filter[i|i.name==room + "_ECO_MODE"].last.sendCommand (ON) }
	 else {
		logInfo("Check ECO Mode", "SET_POINT_TEMPERATURE.state>21")
		gEcoModes.members.filter[i|i.name==room + "_ECO_MODE"].last.sendCommand (OFF) }
end

what to do to get rid of it?

1 Like