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

Thank you very much for your answer @H102
I can confirm than OH can communicate with all the items and I can controll them already from the Paper UI Control.

Fronius Binding and MELCloud are working perfectly, big thanks to the developers!!
After 24 hours of brainstorming I ended up with this simple conclusions: (feel free to have fun with my own just created way of coding :rofl: :rofl:)

Fronius + Mitsubishi Kitchen + Mitsubishi Masterbedroom + Mitsubishi Office + soon Pool

Rule should start everyday from 09:00H and end at 18:00H (lets forget about winter or summer for now)

IF Fronius AC Powery solar production is > 1500 W (Fronius Channel ID for that value is “inverterdatachannelpac” - Number)
Mitsubishi Kitchen should be ON (Switch power { channel=“melcloud:acdevice:c8d95999:182085:power” } )
IF AC Powery solar production is < 1500 W
Mitsubishi Kitchen should be OFF

IF Fronius AC Powery solar production is > 2500 W (Fronius Channel ID for that value is “inverterdatachannelpac” - Number)
Mitsubishi Masterbedroom should be ON (Switch power { channel=“melcloud:acdevice:c8d95999:180520:power” } )
IF AC Powery solar production is < 2500 W
Mitsubishi Masterbedroom should be OFF

IF Fronius AC Powery solar production is > 3500 W (Fronius Channel ID for that value is “inverterdatachannelpac” - Number)
Mitsubishi Office should be ON (Switch power { channel=“melcloud:acdevice:c8d95999:99049:power” } )
IF AC Powery solar production is < 3500 W
Mitsubishi Masterbedroom should be OFF

After 18:00H commands will be manual.

Step by step I see the light of the tunnel, Ill be more than happy if i manage to get there :slight_smile:

For starting and stopping rules at a certain time with cron see this link.
https://www.freeformatter.com/cron-expression-generator-quartz.html

In the rule you only need the item name, not the channel. Use the forum search and look over some rule examples. Try creating the rule and if you get stuck post what you have and we can help.

Also, please use code fences when posting itmes, rule, etc… it’s the paper icon to the left of gear icon. :wink:

Thanks for the help @H102 Ill def do it in the future.

All the best!

Does this make any sense for you guys?

rule "TurnOffACKitchen"
when
    Time cron "0 0/1 8-19 ? * * *" or 
	Item AC_Powery changed
then
		
	if (AC_Powery.state>1500 && GF_Kitchen_AirCon.state == OFF )        { 		// AC Powery is > 1500 watts but AC Kitchen is OFF

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

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

	}
		
end

rule "TurnOnACKitchen"
when
	Time cron "0 0 8 ? * *"    				// power on AC Kitchen at 8am everyday
then
    GF_Kitchen_AirCon.sendCommand(ON)
end

Looks good to me, does it work as expected?

This is what Im getting:

18:59:37.958 [WARN ] [del.core.internal.ModelRepositoryImpl] - Configuration model 'Aircoindition.rules' is either empty or cannot be parsed correctly!
18:59:39.888 [INFO ] [del.core.internal.ModelRepositoryImpl] - Loading model 'Aircoindition.rules'
18:59:49.307 [INFO ] [smarthome.event.ItemStateChangedEvent] - fronius_powerinverter_79f1f9e4_inverterdatachannelpac changed from 673.0 to 668.0
18:59:49.427 [INFO ] [smarthome.event.ItemStateChangedEvent] - AC_Powery changed from 673.0 to 668.0
19:07:34.629 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule 'TurnOffACKitchen': The name 'AC_Powery' cannot be resolved to an item or type; line 7, column 6, leng

I understand the problem is with “AC_Powery”

Used that because i saw it on the Fronius Binding
I have to say I dont have any file with the fronius items configurated on a *.items file as I see the information on the Paper UI control.

Well I think I finally manage to make it.

rule "ACBredroom"
when
    Time cron "0 0/1 8-19 ? * * *" or 
	Item fronius_powerinverter_****_inverterdatachannelpac changed
then
		
	if (fronius_powerinverter_****_inverterdatachannelpac.state>3500 && melcloud_acdevice_****_****_power.state == OFF )        { 		// AC Powery is > 1500 watts but AC Kitchen is OFF

	
					melcloud_acdevice_****_****_power.sendCommand(ON) 	// turn ON AC Bedroom
	}

	else if (fronius_powerinverter_****_inverterdatachannelpac.state<3000 && melcloud_acdevice_****_****_power.state == ON  )   { 		// AC Powery is < 1500 watts turn OFF AC Kitchen if its ON
					
					melcloud_acdevice_****_****_power.sendCommand(OFF)  // turn OFF AC Bedroom

	}
		
end

The problem was with the items name and some problems on the writing, what i did was to start checking on the log the proper item names after sending the orders manually.

So now I have some questions:

  • If all the setup is done thru the graphic enviroment, Paper UI, and bidings too. Where do you check the items names created by default? My items folder are empty, only way to make it was thru the logs.

Such a shame is raining here today if the sun pops ups ill try it with the 3 AC machines at the same time

Thank you so much for the help @H102 this just opend a new world!!!

Most will setup the Thing using PaperUI and use files for items. Placing the item in files will give you more flexibility with names, tags, etc… The location for items file is /etc/openhab2/itmes To get the correct channel for each item just copy it from PaperUI Things channel. No need to link the item via PaperUI b/c that will be done automatically when you place the item in a file and save it.

Item example:

Switch CouchLight "Couch Light" <light>  ["Lighting"]  { channel="mqtt:topic:pibroker:sonoff2:power" }

Using this item in a rule I can simply use the name CouchLight. :wink:

Hope this helps.

Just to be clear, everything that is done in PaperUI get’s saved to a text file in /var/lib/openhab2/jsondb. All of the files in the directory get automatically backed up on every change to /var/lib/openhab2/jsondb/backups. openhab-cli backup includes that directory among many others in that userdata folder when it takes a backup. It’s a text file so it is very compatible with using with source control like git.

I know you didn’t necessarily mean to, but I feel compelled to respond when there is even a hint that PaperUI configs cannot be backed up, migrated to an new OH instance, or use with configuration control.

I’ll also add that if all you are including in your backups is /etc/openhab2 (i.e. conf) you are missing a whole lot of important stuff from the userdata folder.

I think cron triggers are broken in PaperUI so probably not.

1 Like

Thank you for the information @rlkoshak,
Where is the text file located in the Windows version?
I manage to create some mess in order to find out most of the things, but the log is more than amazing.

For some reason I can not loggin with visualstudio from localhost, but I can thru a VPN that I have between my office and my house. (there is always a way)

https://www.openhab.org/docs/installation/windows.html#file-locations almost always has the answers to such questions. In this case it’s userdata/jsondb. You will not be editing the JSONDB by hand so VSCode isn’t really relevant unless you just want to use it to look at the files.

If you write .rules files, see the same link above for where the conf folder is located.

Thank again @rlkoshak :wink:

Good morning all!

After messing a little bit I managed finally to connect properly the VSC to the OpenHAB server, for some reason I dont undertand I was only able to connect it remotely.
Im facing a small issue, this it the code I did:

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

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

	else if (fronius_powerinverter_****_inverterdatachannelpac.state<500 && GF_Kitchen_AirCon.state == ON  )   { 		// AC Powery is < 1500 watts turn OFF AC Kitchen if its ON
					
					GF_Kitchen_AirCon.sendCommand(OFF)  // turn OFF AC kitchen

	}
		
end

VSC is giving me this message as a a problem:

The type ACkitchenRules is already defined in ACkitchen.rules.

Im pretty sure is easy thing but i can not fix it.

What’s with the _****_? * is not a valid to use in an Item’s name. * is not a wild card in this context.

The error means you have ACkitchenRules defined twice. I don’t see ACkitchenRules in the code snippet above at all so I can’t tell you what the problem is.

Sorry @rlkoshak it was just a secure mesure, on the rule the input is correct.

I manage to find the problem. There was a mess on the sitemap I created.

Currently 3 diferent AC machines are working with 3 different rules. Im soooo dam happy, expecting a huge sonOff tasmota delivery this week, I have a plenty of crazy ideas.

Thank for the help to all the community

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.