My new openHAB project at home as a total newbie during COVID-19

Hello again guys!

Here I am again facing some issues and learning a lot. I didnt have the time to check properly if the rules I created stop as expected, and no, they dont. I created the rule to work from 9:00H-18:00H after that AC machines should work manually, BUT If I turn then ON manually the go back to OFF mode instantly.

Here are the logs:

19:16:44.124 [INFO ] [smarthome.event.ItemStateChangedEvent] - fronius_powerinverter_79f1f9e4_inverterdatachannelpac changed from 457.0 to 441.0
19:16:44.156 [INFO ] [smarthome.event.ItemStateChangedEvent] - fronius_powerinverter_79f1f9e4_powerflowchannelpgrid changed from 1034.03 to 1063.96
19:16:44.156 [INFO ] [smarthome.event.ItemStateChangedEvent] - fronius_powerinverter_79f1f9e4_powerflowchannelpload changed from -1491.03 to -1504.96
19:16:45.459 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'melcloud_acdevice_c8d95999_182085_power' received command ON
19:16:45.490 [INFO ] [arthome.event.ItemStatePredictedEvent] - melcloud_acdevice_c8d95999_182085_power predicted to become ON
19:16:45.521 [INFO ] [smarthome.event.ItemStateChangedEvent] - melcloud_acdevice_c8d95999_182085_power changed from OFF to ON
19:17:45.422 [INFO ] [smarthome.event.ItemStateChangedEvent] - fronius_powerinverter_79f1f9e4_inverterdatachannelpac changed from 441.0 to 433.0
19:17:45.438 [INFO ] [smarthome.event.ItemStateChangedEvent] - fronius_powerinverter_79f1f9e4_inverterdatachanneldayenergy changed from 51.68 to 51.7
19:17:45.453 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'melcloud_acdevice_c8d95999_182085_power' received command OFF
19:17:45.485 [INFO ] [smarthome.event.ItemStateChangedEvent] - fronius_powerinverter_79f1f9e4_powerflowchannelpgrid changed from 1063.96 to 1402.58
19:17:45.500 [INFO ] [smarthome.event.ItemStateChangedEvent] - fronius_powerinverter_79f1f9e4_powerflowchannelpload changed from -1504.96 to -1835.58
19:17:45.547 [INFO ] [arthome.event.ItemStatePredictedEvent] - melcloud_acdevice_c8d95999_182085_power predicted to become OFF
19:17:45.563 [INFO ] [smarthome.event.ItemStateChangedEvent] - melcloud_acdevice_c8d95999_182085_power changed from ON to OFF

Here is the rule with some minor changes:

rule "kitchen"
when
    Time cron "0 0/1 9-18 ? * * *" or 
	Item fronius_powerinverter_79f1f9e4_inverterdatachannelpac changed
then
		
	if (fronius_powerinverter_79f1f9e4_inverterdatachannelpac.state>1500 && melcloud_acdevice_c8d95999_182085_power.state == OFF )        { 		// AC Powery is > 1500 watts but AC Kitchen is OFF

	
					melcloud_acdevice_c8d95999_182085_power.sendCommand(ON) 	// turn ON AC kitchen
	}

	else if (fronius_powerinverter_79f1f9e4_inverterdatachannelpac.state<1500 && melcloud_acdevice_c8d95999_182085_power.state == ON  )   { 		// AC Powery is < 1500 watts turn OFF AC Kitchen if its ON
					
					melcloud_acdevice_c8d95999_182085_power.sendCommand(OFF)  // turn OFF AC kitchen

	}
		
end

So I supose something is wrongā€¦

Every time fronius_powerinverter_79f1f9e4_inverterdatachannelpac changes the Rule triggers regardless of what time it is. Remember that Rule triggers are events, not states. The time cron trigger runs the rule every minute between the hours of 9 and 18 and the Item trigger runs the Rule whenever that Item changes.

What you need to do is either:

  • remove the Item trigger and let it only trigger once a minuted during the times you define
  • remove the time cron trigger and add a check at the top of the Rule to see if now is between the hours of 9 and 18 and only do the rest of the Rule if it is.

As usual, thanks for the help @rlkoshak and triying to undestand what you are explaining to me, but need to read some extra rule examples in order to undestand you properly, im a little bit lost right now.

Maybe some :beers: :beers: will help me tonight.

Hello everybody again, @rlkoshak i finally manage to fix the problem with the rule, thanks for the help.

But of course, now there are new dificulties, been fighting some hours with the beautiful MQTT and Tasmota, finally I manage to make it work, BUT had to do a clean install as apparently a lot of things went wrongā€¦

So new and clean install, MQTT, Fronius, TPlink, MELCloud installed. But now the problem is the channels are not generated automaticly on the Papaer UI con can not be controled from the Control section, so Im def doing something wrong but I cant find the solution.

If it hel

Good morning all! Problem solved, there is nothing coffe could not fix. Item linking was not activated.

I forgot to thank you @rlkoshak

I think I managed to fix it but not sure. Im triying to improve the rule now. For the moment the AC machine is turning ON and OFF depending of the Fronius production and in a period of time, from 9:00H to 18:00H, but not I wanna create a ā€œsubruleā€ of the rule and create a condition of it depending of the temperature of the room (the ac machine gives me that information) lets say TURNO OFF is temp is > than 22

rule "ackitchen"
when
    Time cron "0 0/1 9-18 ? * * *"	
then
		
	if (fronius_powerinverter_9f85d560_inverterdatachannelpac.state>1500 && melcloud_acdevice_91e83952_182085_power.state == OFF )        { 		// AC Powery is > 1500 watts but AC Kitchen is OFF

	
					melcloud_acdevice_91e83952_182085_power.sendCommand(ON) 	// turn ON AC Kitchen
	}

	else if (fronius_powerinverter_9f85d560_inverterdatachannelpac.state<1500 && melcloud_acdevice_91e83952_182085_power.state == ON && GF_Kitchen_Temperature.state>22 )   { 		// AC Powery is < 1500 watts turn OFF AC Kitchen if its ON
					
					melcloud_acdevice_91e83952_182085_power.sendCommand(OFF)  // turn OFF AC Kitchen

	}


		
end

I think this wil not workā€¦ as is only will turn off if production is <1500 AND the temp is > 22, right?

Quick update on the project:

  • Fronius Binding
  • MELCloud
  • Alexa Smart Home Skill
  • MQTT working with SONOFF Tasmota
  • Spotify

I wish had the time before to start with OpenHAB :rofl: :rofl:

You could use and OR insted of an AND.

Writted a little bit cleaner the rule and added a ā€œjust in caseā€ turn OFF at 18:00H lets test it.

rule "TurnONACkitchen"
when
    Time cron "0 0/1 9-18 ? * * *" 
	or 
	Item GF_Kitchen_Temperature changed
then
		
	if (fronius_powerinverter_9f85d560_inverterdatachannelpac.state>1500 && melcloud_acdevice_91e83952_182085_power.state == OFF )        { 		// AC Powery is > 1500 watts but AC Kitchen is OFF

	
					melcloud_acdevice_91e83952_182085_power.sendCommand(ON) 	// turn ON AC Kitchen IF Fronius production is > than 1500 Watts
	}

	else if (fronius_powerinverter_9f85d560_inverterdatachannelpac.state<1500 && melcloud_acdevice_91e83952_182085_power.state == ON )   { 		// AC Powery is < 1500 watts turn OFF AC Kitchen if its ON
					
					melcloud_acdevice_91e83952_182085_power.sendCommand(OFF)  // turn OFF AC Kitchen IF Fronius production is < than 1500 Watts

	}

	else if (GF_Kitchen_Temperature.state>22 && melcloud_acdevice_91e83952_182085_power.state == ON )   { 	// AC Powery is < 1500 watts turn OFF AC Kitchen if its ON
					
					melcloud_acdevice_91e83952_182085_power.sendCommand(OFF)  // turn OFF AC Kitchen IF Temp is > 22

	}
		
end

rule "TurnOFFACkitchen"
when
	Time cron "0 0 18 ? * *"    				// power OFF at 18:00H every day
then
    melcloud_acdevice_91e83952_182085_power.sendCommand(OFF)
end

Def not working, is constantly sending an ON OFF orderā€¦

Reedited still recieving ON OFF

rule "TurnONACkitchen"
when
    Time cron "0 0/1 9-18 ? * * *" 

then
		
	if (fronius_powerinverter_9f85d560_inverterdatachannelpac.state>1500 && melcloud_acdevice_91e83952_182085_power.state == OFF )        { 		// AC Powery is > 1500 watts but AC Kitchen is OFF

	
					melcloud_acdevice_91e83952_182085_power.sendCommand(ON) 	// turn ON AC Kitchen IF Fronius production is > than 1500 Watts
	}

	else if (fronius_powerinverter_9f85d560_inverterdatachannelpac.state<1500 || GF_Kitchen_Temperature.state>22 && melcloud_acdevice_91e83952_182085_power.state == ON )   { 		// AC Powery is < 1500 watts turn OFF AC Kitchen if its ON
					
					melcloud_acdevice_91e83952_182085_power.sendCommand(OFF)  // turn OFF AC Kitchen IF Fronius production is < than 1500 Watts

	}

		
end

rule "TurnOFFACkitchen"
when
	Time cron "0 0 18 ? * *"    				// power OFF at 18:00H every day
then
    melcloud_acdevice_91e83952_182085_power.sendCommand(OFF)
end

IĀ“m no good at the crone jobs, so I cant tell if thats what messing up thingā€¦
But you didnt change the line I suggested to ORā€¦

YouĀ“re second else if is not what you wantā€¦

You want to check wether the power is less than 1500 watt OR! the temperature is lower than 22ā€¦ But thats not what your doing. There is no need to check if the AC is ON or OFF, as this is what youĀ“re controlling in the rule.

You need to use the OR.

Apparently we were writting at the same time :rofl: :rofl: Thanks for the time @Kim_Andersen

Get rid of the crone job (for testing the functions)ā€¦
I dont think you need the second else if. I dont see it makes much senseā€¦

Try this. Its more simple and should work if the temperature is below 22, and power is above 1500:

rule "TurnONACkitchen"
when
    Item fronius_powerinverter_9f85d560_inverterdatachannelpac or 
    Item GF_Kitchen_Temperature changed
then
        // AC Powery is > 1500 watts but AC Kitchen is OFF and temperature is lower than 22
        if (fronius_powerinverter_9f85d560_inverterdatachannelpac.state>1500 && GF_Kitchen_Temperature.state<22 ) {
           melcloud_acdevice_91e83952_182085_power.sendCommand(ON)     // turn ON AC Kitchen IF Fronius production is > than 1500 Watts
   }

        // AC Powery is < 1500 watts turn OFF AC Kitchen if its ON
   else if (fronius_powerinverter_9f85d560_inverterdatachannelpac.state<1500 || GF_Kitchen_Temperature.state>22 )  {
           melcloud_acdevice_91e83952_182085_power.sendCommand(OFF)    // turn OFF AC Kitchen IF Fronius production is < than 1500 Watts
   }
end

Suggestion:
Next time keep a more simple naming of itemsā€¦ ItĀ“s driven me nuts looking at those long items names in a rule which can be difficult to read anyway :smiley:

Why do you need the crone job anyway? I doubt the Fronius will be creating much power at night. And since you already trigger on its power above 1500 and the temperature is less than 22ā€¦ There is no need of an cronejobā€¦ Only need is if you dont what this rule to run every day 24/7.

And have you thought of the situation: If there isnt enough power, and the temperature is below 22? :smiley:

I agree, learning is a step by step thing for me. Names are crazy I know, but I started learning how it works everything from the logsā€¦ no items.list no items etc
Im getting this wonderful message

] [del.core.internal.ModelRepositoryImpl] - Configuration model 'ACKitchen.rules' has errors, therefore ignoring it: [3,5]: no viable alternative at input 'or'

Ahh damitā€¦ You need to change the when statement to:

when
    Item fronius_powerinverter_9f85d560_inverterdatachannelpac changed or 
    Item GF_Kitchen_Temperature changed
then

Sorry my mistake

This is a bit more simple:

rule "TurnONACkitchen"
when
    Item fronius_powerinverter_9f85d560_inverterdatachannelpac changed or 
    Item GF_Kitchen_Temperature changed
then
        // AC Powery is > 1500 watts and temperature is lower than 22
        if (fronius_powerinverter_9f85d560_inverterdatachannelpac.state > 1500 && GF_Kitchen_Temperature.state < 22 ) {
           melcloud_acdevice_91e83952_182085_power.sendCommand(ON)     // turn ON AC Kitchen IF Fronius production is > than 1500 Watts
   }

        // AC Powery is less than 1500 watts or temperature is above 22
      else
           melcloud_acdevice_91e83952_182085_power.sendCommand(OFF)    // turn OFF AC Kitchen IF Fronius production is < than 1500 Watts
end

I believe this is a good starting point to get the idea how to build it futher.

That is some serious change/improvement, let me test is with all the machines from the house.
Thank for you time @Kim_Andersen I really apreciate it!
As you can see im looking for the best performance of the house temperature. Ill kepp you updated with the results