Solaredge inverter via Modbus TCP 2

Heavily based on this topic created by @tkuehne I decided to take the information and move it to the Modbus 2 binding. Below you will find the result up to now.

I have a SolarEdge SE5000H (no display, but SetApp) with CPU version 4.6.27.

I have read a lot on not being able to reach the commissioning interface of the SolarEdge invertor. That is why I have placed my invertor in the 172.16.0.X/24 network. In this network 172.16.0.1 is taken by the SE itself (also used during commissioning by the SetApp) and so my gateway for this segment is 172.16.0.10.

First of all -----> make sure the modbus binding is installed <-----------------

Create a modbus.things file. I have commented out all the stuff I do not use yet, but it is there for convenience. I have noted that somehow my invertor is 1 address different from the ones mentioned in the SunSpec document.

Bridge modbus:tcp:SE5000TCP [ host="172.16.0.12", port=1502, id=1, timeBetweenTransactionsMillis=60, 
timeBetweenReconnectMillis=0, connectMaxTries=3, reconnectAfterMillis=0, connectTimeoutMillis=10000 ] {

    Bridge poller Registers [ start=69, length=50, refresh=5000, type="holding" ] {
      // Setting polling to 1000 ms sometimes led to strange values in I_AC_POWER

     //   Thing data C_DeviceAddress   [ readStart="69", readValueType="uint16" ]        // MODBUS Unit ID
        Thing data C_SunSpec_DID     [ readStart="69", readValueType="uint16" ]        // 101 = single phase, 102 = split phase, 103 = three phase 
        Thing data C_SunSpec_Length  [ readStart="70", readValueType="uint16" ]        // 50 = Length of model block
        Thing data I_AC_Current      [ readStart="71", readValueType="uint16" ]        // AC Total Current value
     //   Thing data I_AC_CurrentA     [ readStart="72", readValueType="uint16" ]        // AC Phase A Current value
     //   Thing data I_AC_CurrentB     [ readStart="73", readValueType="uint16" ]        // AC Phase B Current value
     //   Thing data I_AC_CurrentC     [ readStart="74", readValueType="uint16" ]        // AC Phase C Current value
        Thing data I_AC_Current_SF   [ readStart="75", readValueType="int16"  ]        // AC Current scale factor
     //   Thing data I_AC_VoltageAB    [ readStart="76", readValueType="uint16" ]        // AC Voltage Phase AB value
     //   Thing data I_AC_VoltageBC    [ readStart="77", readValueType="uint16" ]        // AC Voltage Phase BC value
     //   Thing data I_AC_VoltageCA    [ readStart="78", readValueType="uint16" ]        // AC Voltage Phase CA value
     //   Thing data I_AC_VoltageAN    [ readStart="79", readValueType="uint16" ]        // AC Voltage Phase A to N value
     //   Thing data I_AC_VoltageBN    [ readStart="80", readValueType="uint16" ]        // AC Voltage Phase B to N value
     //   Thing data I_AC_VoltageCN    [ readStart="81", readValueType="uint16" ]        // AC Voltage Phase C to N value
     //   Thing data I_AC_Voltage_SF   [ readStart="82", readValueType="int16"  ]        // AC Voltage scale factor
        Thing data I_AC_Power        [ readStart="83", readValueType="int16"  ]        // AC Power value
        Thing data I_AC_Power_SF     [ readStart="84", readValueType="int16"  ]        // AC Power scale factor
        Thing data I_AC_Frequency    [ readStart="85", readValueType="uint16" ]        // AC Frequency value
     //   Thing data I_AC_Frequency_SF [ readStart="86", readValueType="int16"  ]        // Scale factor
     //   Thing data I_AC_VA           [ readStart="87", readValueType="int16"  ]        // Apparent Power
     //   Thing data I_AC_VA_SF        [ readStart="88", readValueType="int16"  ]        // Scale factor
     //   Thing data I_AC_VAR          [ readStart="89", readValueType="int16"  ]        // Reactive Power
     //   Thing data I_AC_VAR_SF       [ readStart="90", readValueType="int16"  ]        // Scale factor
     //   Thing data I_AC_PF           [ readStart="91", readValueType="int16"  ]        // Power Factor
     //   Thing data I_AC_PF_SF        [ readStart="92", readValueType="int16"  ]        // Scale factor
        Thing data I_AC_Energy_WH    [ readStart="93", readValueType="acc32"  ]        // AC Lifetime Energy Production
        Thing data I_AC_Energy_WH_SF [ readStart="95", readValueType="uint16" ]        // Scale factor
        Thing data I_DC_Current      [ readStart="96", readValueType="uint16" ]        // DC Current value
        Thing data I_DC_Current_SF   [ readStart="97", readValueType="int16"  ]        // Scale factor
        Thing data I_DC_Voltage      [ readStart="98", readValueType="uint16" ]        // DC Voltage value
        Thing data I_DC_Voltage_SF   [ readStart="99", readValueType="int16"  ]        // Scale factor
        Thing data I_DC_Power        [ readStart="100", readValueType="int16" ]        // DC Power value
        Thing data I_DC_Power_SF     [ readStart="101", readValueType="int16" ]        // Scale factor
        Thing data I_Temp_Sink       [ readStart="103", readValueType="int16" ]        // Heat sink temperature
        Thing data I_Temp_SF         [ readStart="106", readValueType="int16" ]        // Scale factor
        Thing data I_Status          [ readStart="107", readValueType="uint16"]        // Operating state
     //   Thing data I_Status_Vendor   [ readStart="109", readValueType="uint16"]        // Vendor-defined operating state and error codes

    }

Items file

Number C_SunSpec_DID "Invertor type" 
	{channel="modbus:data:SE5000TCP:Registers:C_SunSpec_DID:number" }
Number Sensor_VH_Meterkast_SE5000H_ModBus_I_AC_Power "AC Power value" 
	{channel="modbus:data:SE5000TCP:Registers:I_AC_Power:number" }
Number Sensor_VH_Meterkast_SE5000H_ModBus_AC_Power "PV opbrengst [%.0f Wh]" 								<sun>				(gPowerMeasurement)
Number Sensor_VH_Meterkast_SE5000H_ModBus_AC_Power_Graph
Number I_AC_Power_SF "AC Power scale" 
	{channel="modbus:data:SE5000TCP:Registers:I_AC_Power_SF:number" }

Number Sensor_VH_Meterkast_SE5000_I_Temp_Sink
	{channel="modbus:data:SE5000TCP:Registers:I_Temp_Sink:number" }								
Number Sensor_VH_Meterkast_SE5000_Temp_Sink "SE5000 temperatuur [%d C]"															(gClimateItems)	
Number I_Temp_SF "SE5000 temperatuur scale" 
	{channel="modbus:data:SE5000TCP:Registers:I_Temp_SF:number" }

Number Sensor_VH_Meterkast_SE5000_ModBus_I_Status		"Invertor status [MAP(SE5000_status.map):%s]"		<energy>			(gStatusItems,gApparatuur)
	{channel="modbus:data:SE5000TCP:Registers:I_Status:number", autoupdate="false" }

MAP file

//  SE5000H Inverter Device Status Values
//	The following I_Status_ xxxx values are supported:
//	Parameter 				Value 					Description
//	I_STATUS_OFF 				1 					Off
//	I_STATUS_SLEEPING 			2 					Sleeping (auto-shutdown) – Night mode
//	I_STATUS_STARTING 			3 					Grid Monitoring/wake-up
//	I_STATUS_MPPT 				4 					Inverter is ON and producing power
//	I_STATUS_THROTTLED 			5 					Production (curtailed)
//	I_STATUS_SHUTTING_DOWN 		6 					Shutting down
//	I_STATUS_FAULT 				7 					Fault
//	I_STATUS_STANDBY 			8 					Maintenance/setup

1=OFF
2=SLEEPING
3=WAKEUP
4=PRODUCTIE
5=PRODUCTIE_THROTTLED
6=SHUTTING_DOWN
7=MAINT
=UNDEFINED

Rules file

rule "Zonnepanelen AC productie momentaan"
when
	Item Sensor_VH_Meterkast_SE5000H_ModBus_I_AC_Power changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
	var Double power = (Sensor_VH_Meterkast_SE5000H_ModBus_I_AC_Power.state as DecimalType).doubleValue
	var Double SF = (I_AC_Power_SF.state as DecimalType).doubleValue
	var Double result = power * Math::pow(10,SF)
	postUpdate(Sensor_VH_Meterkast_SE5000H_ModBus_AC_Power, Math.round(result))
end

rule "SE5000 temperatuur"
when
	Item Sensor_VH_Meterkast_SE5000_I_Temp_Sink changed
then
    var Double temp = (Sensor_VH_Meterkast_SE5000_I_Temp_Sink.state as DecimalType).doubleValue
	var Double SF = (I_Temp_SF.state as DecimalType).doubleValue
	var Double result = temp * Math::pow(10,SF)
	postUpdate(Sensor_VH_Meterkast_SE5000_Temp_Sink, result)
end

Sitemap file

Text item=Sensor_VH_Meterkast_SE5000H_ModBus_AC_Power

ATM I am fighting with the rule file still a bit, because as far as I can see the values in the registers for the items I use are integer plus a scale factor. So I think the “double” variables can go.

I use the above calculated value to calculate my current power use via a rule and the variables I get from my smart meter:

ule "Calculate own power use every 10 seconds"
when 
	Time cron "0/10 * * ? * * *" 
then 
	if (Sensor_VH_Meterkast_SE5000_ModBus_I_Status.state == 4 || Sensor_VH_Meterkast_SE5000_ModBus_I_Status.state == 5) {
		Calculated_InternalPowerUse.postUpdate(
			
			(Sensor_VH_Meterkast_SE5000H_ModBus_AC_Power.state as Number) 
			+ ((Sensor_VH_Meterkast_emeter_actual_delivery.state as Number)*1000) 
			- ((Sensor_VH_Meterkast_emeter_actual_production.state as Number)*1000)
			)
		}
 	else {
		Calculated_InternalPowerUse.postUpdate((Sensor_VH_Meterkast_emeter_actual_delivery.state as Number)*1000)
		}
end 

Hopefully this is interesting for somebody.

4 Likes

Excellent! I have put off converting my setup to the modbus 2 binding, because it took me weeks to finally get my conversion from KNX1.x to 2.x done, and I was dreading having to recode everything. But now, I can maybe see a project for the christmas break, using your foundation. :slight_smile:

Thanks,

Thomas

Allthough the majority of the values coming from ModBus are ok, sometimes I get very strange results:

2019-11-22 16:23:11.266 [INFO ] [ome.model.script.[se5k] I_AC_Power: ] - Sensor_VH_Meterkast_SE5000H_ModBus_I_AC_Power (Type=NumberItem, State=17520, Label=AC Power value, Category=null, Groups=[gVoltageMeasument])
2019-11-22 16:23:11.267 [INFO ] [smarthome.model.script.[se5k] power ] - 17520.0
2019-11-22 16:23:11.268 [INFO ] [se.smarthome.model.script.[se5k] SF ] - 0.0
2019-11-22 16:23:11.270 [INFO ] [arthome.model.script.[se5k] Result: ] - 17520.0
2019-11-22 16:23:11.271 [INFO ] [thome.model.script.[se5k] DB value: ] - Sensor_VH_Meterkast_SE5000H_ModBus_AC_Power (Type=NumberItem, State=0, Label=PV opbrengst, Category=sun, Groups=[gPowerMeasurement])
2019-11-22 16:23:12.320 [INFO ] [clipse.smarthome.model.script.[se5k]] - *****************************************Zonnepanelen AC productie momentaan*************************************************
2019-11-22 16:23:12.325 [INFO ] [ome.model.script.[se5k] I_AC_Power: ] - Sensor_VH_Meterkast_SE5000H_ModBus_I_AC_Power (Type=NumberItem, State=18133, Label=AC Power value, Category=null, Groups=[gVoltageMeasument])
2019-11-22 16:23:12.326 [INFO ] [smarthome.model.script.[se5k] power ] - 18133.0
2019-11-22 16:23:12.327 [INFO ] [se.smarthome.model.script.[se5k] SF ] - -6.0
2019-11-22 16:23:12.329 [INFO ] [arthome.model.script.[se5k] Result: ] - 0.018133
2019-11-22 16:23:13.355 [INFO ] [clipse.smarthome.model.script.[se5k]] - *****************************************Zonnepanelen AC productie momentaan*************************************************
2019-11-22 16:23:13.357 [INFO ] [ome.model.script.[se5k] I_AC_Power: ] - Sensor_VH_Meterkast_SE5000H_ModBus_I_AC_Power (Type=NumberItem, State=6900, Label=AC Power value, Category=null, Groups=[gVoltageMeasument])
2019-11-22 16:23:13.358 [INFO ] [smarthome.model.script.[se5k] power ] - 6900.0
2019-11-22 16:23:13.359 [INFO ] [se.smarthome.model.script.[se5k] SF ] - -4.0
2019-11-22 16:23:13.362 [INFO ] [arthome.model.script.[se5k] Result: ] - 0.6900000000000001
2019-11-22 16:23:13.364 [INFO ] [thome.model.script.[se5k] DB value: ] - Sensor_VH_Meterkast_SE5000H_ModBus_AC_Power (Type=NumberItem, State=1, Label=PV opbrengst, Category=sun, Groups=[gPowerMeasurement])
2019-11-22 16:23:14.429 [INFO ] [clipse.smarthome.model.script.[se5k]] - *****************************************Zonnepanelen AC productie momentaan*************************************************
2019-11-22 16:23:14.432 [INFO ] [ome.model.script.[se5k] I_AC_Power: ] - Sensor_VH_Meterkast_SE5000H_ModBus_I_AC_Power (Type=NumberItem, State=8288, Label=AC Power value, Category=null, Groups=[gVoltageMeasument])
2019-11-22 16:23:14.434 [INFO ] [smarthome.model.script.[se5k] power ] - 8288.0
2019-11-22 16:23:14.437 [INFO ] [se.smarthome.model.script.[se5k] SF ] - -4.0
2019-11-22 16:23:14.438 [INFO ] [arthome.model.script.[se5k] Result: ] - 0.8288000000000001
2019-11-22 16:23:14.441 [INFO ] [thome.model.script.[se5k] DB value: ] - Sensor_VH_Meterkast_SE5000H_ModBus_AC_Power (Type=NumberItem, State=1, Label=PV opbrengst, Category=sun, Groups=[gPowerMeasurement])
2019-11-22 16:23:15.483 [INFO ] [clipse.smarthome.model.script.[se5k]] - *****************************************Zonnepanelen AC productie momentaan*************************************************
2019-11-22 16:23:15.485 [INFO ] [ome.model.script.[se5k] I_AC_Power: ] - Sensor_VH_Meterkast_SE5000H_ModBus_I_AC_Power (Type=NumberItem, State=10169, Label=AC Power value, Category=null, Groups=[gVoltageMeasument])
2019-11-22 16:23:15.486 [INFO ] [smarthome.model.script.[se5k] power ] - 10169.0
2019-11-22 16:23:15.487 [INFO ] [se.smarthome.model.script.[se5k] SF ] - -4.0
2019-11-22 16:23:15.489 [INFO ] [arthome.model.script.[se5k] Result: ] - 1.0169000000000001
2019-11-22 16:23:15.490 [INFO ] [thome.model.script.[se5k] DB value: ] - Sensor_VH_Meterkast_SE5000H_ModBus_AC_Power (Type=NumberItem, State=1, Label=PV opbrengst, Category=sun, Groups=[gPowerMeasurement])
2019-11-22 16:23:16.548 [INFO ] [clipse.smarthome.model.script.[se5k]] - *****************************************Zonnepanelen AC productie momentaan*************************************************
2019-11-22 16:23:16.550 [INFO ] [ome.model.script.[se5k] I_AC_Power: ] - Sensor_VH_Meterkast_SE5000H_ModBus_I_AC_Power (Type=NumberItem, State=0, Label=AC Power value, Category=null, Groups=[gVoltageMeasument])
2019-11-22 16:23:16.551 [INFO ] [smarthome.model.script.[se5k] power ] - 0.0
2019-11-22 16:23:16.552 [INFO ] [se.smarthome.model.script.[se5k] SF ] - -4.0
2019-11-22 16:23:16.557 [INFO ] [arthome.model.script.[se5k] Result: ] - 0.0
2019-11-22 16:23:16.558 [INFO ] [thome.model.script.[se5k] DB value: ] - Sensor_VH_Meterkast_SE5000H_ModBus_AC_Power (Type=NumberItem, State=1, Label=PV opbrengst, Category=sun, Groups=[gPowerMeasurement])
2019-11-22 16:23:18.634 [INFO ] [clipse.smarthome.model.script.[se5k]] - *****************************************Zonnepanelen AC productie momentaan*************************************************
2019-11-22 16:23:18.636 [INFO ] [ome.model.script.[se5k] I_AC_Power: ] - Sensor_VH_Meterkast_SE5000H_ModBus_I_AC_Power (Type=NumberItem, State=3942, Label=AC Power value, Category=null, Groups=[gVoltageMeasument])
2019-11-22 16:23:18.637 [INFO ] [smarthome.model.script.[se5k] power ] - 3942.0
2019-11-22 16:23:18.639 [INFO ] [se.smarthome.model.script.[se5k] SF ] - 0.0
2019-11-22 16:23:18.641 [INFO ] [arthome.model.script.[se5k] Result: ] - 3942.0

looks like there is a glitch when reading the produced PV power and the correlating SF (Scale Factor).
First value is the value coming from ModBus, the second value is de SF also from ModBus. “Result” is the result from the math calculation in my rules.
At 2019-11-22 16:23:11.267 my PV panels are producing 17,5 kW, naahhh don’t think so. Maximum is 5kW and because its winter at this time of the day it should be something like 17,5 or even 1,75 watt.

I think the produced PV Power and SF do not belong together. I am open for suggestions :joy:

I wonder if work by @mrbig might be relevant : https://github.com/openhab/openhab2-addons/pull/6331

It is sunspec binding built on top of openhab2 modbus, to provide first class support for these devices.

@ssalonen I think it is relevant, but no idea how to use it yet.

@mrbig, any chance I can have some files and a bit of guidance to test this?

Hello @havaak,

Power and the Scaling factor for the power go together, alright. I can’t spot anything wrong with your code, The only thing I noted is that you are reading individual registers with the correct datatype (int16, uint16, and so on). Maybe this is a timing thing on the modbus, or the modbus registers are being updated by the converter while you are reading the registers.

What I did to prevent this from happening, was to read all registers at once using uint16 and then having some code to extract the signed variants manually (for the scaling factors) or the 32bit counters by putting two bytes together. Not sure if that is what’s happening here, though.

Best,

Thomas

Each poller Thing reads its specified block of registers in one transfer.
It doesn’t matter how you arrange its data Things.

If you try to process several data Things in one rule, there is a risk of getting chunks from different transfers. Not recommended, choose rule triggers very carefully.

I should expand on that, perhaps.
Example rule from earlier -

rule "Calculate own power use every 10 seconds"
when 
	Time cron "0/10 * * ? * * *" 
then 
	if (Sensor_VH_Meterkast_SE5000_ModBus_I_Status.state == 4 || Sensor_VH_Meterkast_SE5000_ModBus_I_Status.state == 5) {
		Calculated_InternalPowerUse.postUpdate(
			
			(Sensor_VH_Meterkast_SE5000H_ModBus_AC_Power.state as Number) 
			+ ((Sensor_VH_Meterkast_emeter_actual_delivery.state as Number)*1000) 
			- ((Sensor_VH_Meterkast_emeter_actual_production.state as Number)*1000)
			)
		}
 	else {
		Calculated_InternalPowerUse.postUpdate((Sensor_VH_Meterkast_emeter_actual_delivery.state as Number)*1000)
		}
end

Okay, so what are the risks here? The rule is periodically triggered by cron, it’s not synchronized with the Modbus poll in any way. The rule can run just before, or just after a poll - or a poll can take place when we’re part way through the rule. That’s a disaster - we will have some Item values from one poll cycle, and some from a different poll. They don’t belong together.

What can be done? Let’s look at rule triggers. Is running from a cron sensible? Do you need to do calculations if nothing actually changes? I’d look to trigger the rule from a key Item changed. Remember you can trigger a rule from an Item and not use that Item in the rule at all.

I don’t fully understand your Items here - is there one like a cumulative kWh reading that you can be sure changes on every poll? Use that as a trigger.

That still leaves a small risk - all the Items associated with one poll are not instantly updated at the same moment. With bad luck, we could trigger a rule off one Item and have another Item change a millisecond later - part way through the rule.

To get round that, a simple delay after rule triggering - just 50mS probably - should allow the binding to complete its cycle of updates before we process them.

These careful precautions are not need when dealing with readings like temperature and humidity, which never change much from one Modbus poll to the next.
But where you’ve got things like a number and a scale factor, which could change in big steps, care is needed to make sure you are dealing with a “matched pair”.

1 Like

@havaak I’ve sent you a PM with the details

I see what you are getting at but (there is always a but :grinning:) the 3 variables used here a coming from different systems; 1 is coming from modbus (solar panels) and the other from a smart meter. So what ever I do, start a rule on one of the 3 changing or cron, I always have a risk on colliding data. I choose the cron option as it will always make the calculation of my internal power use, even if none of the variables have changed.

And like always its useful remarks like these that make you think as well: “maybe if I change this, then…”. So I had another look at my rule where I calculate my solar panel produced power:

and when looking at this I realised that if the rule is being called, the modbus read was started milliseconds ago. So if the rule is started it could be possible that the next value was not yet read or updated. So I changed my rule to incorporate a 100 ms delay:

rule "Zonnepanelen AC productie momentaan"
when
	Item Sensor_VH_Meterkast_SE5000H_ModBus_I_AC_Power changed
then
	Thread::sleep(100)						// Let modbus finish reading all registers
	var Double power = (Sensor_VH_Meterkast_SE5000H_ModBus_I_AC_Power.state as DecimalType).doubleValue
	var Double SF = (I_AC_Power_SF.state as DecimalType).doubleValue
	var Double result = power * Math::pow(10,SF)
	postUpdate(Sensor_VH_Meterkast_SE5000H_ModBus_AC_Power, Math.round(result))
end

I am now checking if all the values are up to spec…

1 Like

Values are still within spec so I think my problem is solved. I will update my first post. Thx all for helping out!

How you Calculate the Sensor_VH_Meterkast_emeter_actual_delivery and Sensor_VH_Meterkast_emeter_actual_production Value?

Thanks Marijan

Hey Marijan,

these values are not calculated but are coming from my smartmeter

kr

Han

Thanks, @rossko57,

I never realized that the modbus read will read all registers in one go regardless of how you define the things. Even more incentive to move to modbus2, since with modbus 1, you have to stick to a single data format per read for all registers, which makes this a bit more complex in post processing (i.e. converting from uint16 to int16 or getting the uint32 value out of two unit16 registers).

Your hint about putting the thread to sleep to ensure all items are up to date is really useful too!

Hello Han,

Has there been any additional development since Dec 19th?

Today they installed the SE4000H and had a second ago my first successful reading.
Next step to tweak the rules file to adapt to my my electricity meter readings.

Wonder if you extended on rules and sitemaps to create visibility and integration with other HA parts.

PS. I have a list of Modbus things listed. Shouldn’t this be a single thing with channels?

Thanks for the binding (kudo’s),
Ferry

Hey @Ferry,

no changes so far but the software of the SE4000H itself. My installer did some work and upgraded my system (done before I knew). I have lost local access to the commissioning interface. Modbus still works though

kr

Han

Hello @havaak, thanks for your example, it’s working great :slight_smile:

One question however: I want to monitor the total production with the I_AC_Energy_WH thing, but I’m getting the following error:

Status: OFFLINE - CONFIGURATION_ERROR Thing modbus:data:SolarEdgeTCP:Registers:I_AC_Energy_WH readValueType=acc32 is invalid!

I used your configuration from above. Is it working for you?

Regards, Christian

Modbus binding doesn’t support an acc32 datatype.
I’d try int32 instead.
Note that small Thing edits like this probably won’t take effect until the binding is restarted.

1 Like

Perfect, it worked instantly :smiley::+1:

Thanks

1 Like

(Part 1/3)

Hi to all,

I have been using the information of this topic by @havaak and the previous one by @tkuehne.
Although the Modbus Sunspec Bundle is now available, I will keep this setup for the while.

I made some modifications to fit my needs and composed it to the following set of files, which I want to share with you.
I am living in Germany, so the most labels are in German.

  • I have a SolarEdge SE2200 inverter and a WattNode WNC-3Y-400-MB meter which is connected to the inverter via RS485 connection. The inverter is connected to the network via LAN.

  • I commented out all values which I do not use or which are not available on my inverter/meter.

  • I added a “scale all values”-rule trigger to prevent openhab from generating errors because of some NULL-values if you e.g. restart openHAB during the night where there is no change in the inverter values.

  • The “scale all values”-rule gets triggered after system start of openHAB automatically.

modbusSolaredge.things

Bridge modbus:tcp:SolarEdgeConverter [ host="192.168.115.164", port=502, id=1, timeBetweenTransactionsMilli=60, timeBetweenReconnectMillis=0, connectMaxTries=3, reconnectAfterMillis=0, connectTimeoutMillis=5000 ] {
    Bridge poller Registers [ start=69, length=50, refresh=5000, type="holding" ] {
        Thing data C_SunSpec_DID        [ readStart="69", readValueType="uint16" ]      // 101 = single phase, 102 = split phase, 103 = three phase 
        Thing data C_SunSpec_Length     [ readStart="70", readValueType="uint16" ]      // 50 = Length of model block
        Thing data I_AC_Current         [ readStart="71", readValueType="uint16" ]      // AC Total Current value
        Thing data I_AC_CurrentA        [ readStart="72", readValueType="uint16" ]      // AC Phase A Current value
        //Thing data I_AC_CurrentB        [ readStart="73", readValueType="uint16" ]      // AC Phase B Current value
        //Thing data I_AC_CurrentC        [ readStart="74", readValueType="uint16" ]      // AC Phase C Current value
        Thing data I_AC_Current_SF      [ readStart="75", readValueType="int16"  ]      // AC Current scale factor
        Thing data I_AC_VoltageAB       [ readStart="76", readValueType="uint16" ]      // AC Voltage Phase AB value
        //Thing data I_AC_VoltageBC       [ readStart="77", readValueType="uint16" ]      // AC Voltage Phase BC value
        //Thing data I_AC_VoltageCA       [ readStart="78", readValueType="uint16" ]      // AC Voltage Phase CA value
        //Thing data I_AC_VoltageAN       [ readStart="79", readValueType="uint16" ]      // AC Voltage Phase A to N value
        //Thing data I_AC_VoltageBN       [ readStart="80", readValueType="uint16" ]      // AC Voltage Phase B to N value
        //Thing data I_AC_VoltageCN       [ readStart="81", readValueType="uint16" ]      // AC Voltage Phase C to N value
        Thing data I_AC_Voltage_SF      [ readStart="82", readValueType="int16"  ]      // AC Voltage scale factor
        Thing data I_AC_Power           [ readStart="83", readValueType="int16"  ]      // AC Power value
        Thing data I_AC_Power_SF        [ readStart="84", readValueType="int16"  ]      // AC Power scale factor
        Thing data I_AC_Frequency       [ readStart="85", readValueType="uint16" ]      // AC Frequency value
        Thing data I_AC_Frequency_SF    [ readStart="86", readValueType="int16"  ]      // Scale factor
        Thing data I_AC_VA              [ readStart="87", readValueType="int16"  ]      // Apparent Power
        Thing data I_AC_VA_SF           [ readStart="88", readValueType="int16"  ]      // Scale factor
        Thing data I_AC_VAR             [ readStart="89", readValueType="int16"  ]      // Reactive Power
        Thing data I_AC_VAR_SF          [ readStart="90", readValueType="int16"  ]      // Scale factor
        Thing data I_AC_PF              [ readStart="91", readValueType="int16"  ]      // Power Factor
        Thing data I_AC_PF_SF           [ readStart="92", readValueType="int16"  ]      // Scale factor
        Thing data I_AC_Energy_WH       [ readStart="93", readValueType="uint32" ]      // AC Lifetime Energy Production
        Thing data I_AC_Energy_WH_SF    [ readStart="95", readValueType="uint16" ]      // Scale factor
        Thing data I_DC_Current         [ readStart="96", readValueType="uint16" ]      // DC Current value
        Thing data I_DC_Current_SF      [ readStart="97", readValueType="int16"  ]      // Scale factor
        Thing data I_DC_Voltage         [ readStart="98", readValueType="uint16" ]      // DC Voltage value
        Thing data I_DC_Voltage_SF      [ readStart="99", readValueType="int16"  ]      // Scale factor
        Thing data I_DC_Power           [ readStart="100", readValueType="int16" ]      // DC Power value
        Thing data I_DC_Power_SF        [ readStart="101", readValueType="int16" ]      // Scale factor
        Thing data I_Temp_Sink          [ readStart="103", readValueType="int16" ]      // Heat sink temperature
        Thing data I_Temp_SF            [ readStart="106", readValueType="int16" ]      // Scale factor
        Thing data I_Status             [ readStart="107", readValueType="uint16"]      // Operating state
        Thing data I_Status_Vendor      [ readStart="108", readValueType="uint16"]      // Vendor-defined operating state and error codes
    }

    Bridge poller RegistersMeter [ start=188, length=105, refresh=5000, type="holding" ] {
        Thing data M_C_SunSpec_DID      [ readStart="188", readValueType="uint16" ]     // 
        Thing data M_C_SunSpec_Length   [ readStart="189", readValueType="uint16" ]     // 50 = Length of model block
        Thing data M_AC_Current         [ readStart="190", readValueType="int16" ]      // AC Total Current value
        Thing data M_AC_Current_A       [ readStart="191", readValueType="int16" ]      // AC L1 Current value
        Thing data M_AC_Current_B       [ readStart="192", readValueType="int16" ]      // AC L2 Current value
        Thing data M_AC_Current_C       [ readStart="193", readValueType="int16" ]      // AC L3 Current value
        Thing data M_AC_Current_SF      [ readStart="194", readValueType="int16" ]      // AC Total Current scaling factor
        Thing data M_AC_Voltage_LN      [ readStart="195", readValueType="int16" ]      // Line to Neutral AC Voltage (average of active phases)
        Thing data M_AC_Voltage_AN      [ readStart="196", readValueType="int16" ]      // Phase A to Neutral AC Voltage
        Thing data M_AC_Voltage_BN      [ readStart="197", readValueType="int16" ]      // Phase B to Neutral AC Voltage
        Thing data M_AC_Voltage_CN      [ readStart="198", readValueType="int16" ]      // Phase C to Neutral AC Voltage
        //Thing data M_AC_Voltage_LL      [ readStart="199", readValueType="int16" ]      // Line to Line AC Voltage (average of active phases)
        //Thing data M_AC_Voltage_AB      [ readStart="200", readValueType="int16" ]      // Phase A to Phase B AC Voltage
        //Thing data M_AC_Voltage_BC      [ readStart="201", readValueType="int16" ]      // Phase B to Phase C AC Voltage
        //Thing data M_AC_Voltage_CA      [ readStart="202", readValueType="int16" ]      // Phase C to Phase A AC Voltage
        Thing data M_AC_Voltage_SF      [ readStart="203", readValueType="int16" ]      // AC Voltage Scale Factor
        Thing data M_AC_Freq            [ readStart="204", readValueType="int16" ]      // AC Frequency
        Thing data M_AC_Freq_SF         [ readStart="205", readValueType="int16" ]      // AC Frequency Scale Factor
        Thing data M_AC_Power           [ readStart="206", readValueType="int16" ]      // Total Real Power (sum of active phases)
        Thing data M_AC_Power_A         [ readStart="207", readValueType="int16" ]      // Phase A AC Real Power
        Thing data M_AC_Power_B         [ readStart="208", readValueType="int16" ]      // Phase B AC Real Power
        Thing data M_AC_Power_C         [ readStart="209", readValueType="int16" ]      // Phase C AC Real Power
        Thing data M_AC_Power_SF        [ readStart="210", readValueType="int16" ]      // AC Real Power Scale Factor
        Thing data M_AC_VA              [ readStart="211", readValueType="int16" ]      // Total AC Apparent Power (sum of active phases)
        Thing data M_AC_VA_A            [ readStart="212", readValueType="int16" ]      // Phase A AC Apparent Power
        Thing data M_AC_VA_B            [ readStart="213", readValueType="int16" ]      // Phase B AC Apparent Power
        Thing data M_AC_VA_C            [ readStart="214", readValueType="int16" ]      // Phase C AC Apparent Power
        Thing data M_AC_VA_SF           [ readStart="215", readValueType="int16" ]      // AC Apparent Power Scale Factor
        //Thing data M_AC_VAR             [ readStart="216", readValueType="int16" ]      // Total AC Reactive Power (sum of active phases)
        //Thing data M_AC_VAR_A           [ readStart="217", readValueType="int16" ]      // Phase A AC Reactive Power
        //Thing data M_AC_VAR_B           [ readStart="218", readValueType="int16" ]      // Phase B AC Reactive Power
        //Thing data M_AC_VAR_C           [ readStart="219", readValueType="int16" ]      // Phase C AC Reactive Power
        //Thing data M_AC_VAR_SF          [ readStart="220", readValueType="int16" ]      // AC Reactive Power Scale Factor
        Thing data M_AC_PF              [ readStart="221", readValueType="int16" ]      // Average Power Factor (average of active phases)
        Thing data M_AC_PF_A            [ readStart="222", readValueType="int16" ]      // Phase A Power Factor
        Thing data M_AC_PF_B            [ readStart="223", readValueType="int16" ]      // Phase B Power Factor
        Thing data M_AC_PF_C            [ readStart="224", readValueType="int16" ]      // Phase C Power Factor
        Thing data M_AC_PF_SF           [ readStart="225", readValueType="int16" ]      // AC Power Factor Scale Factor
        Thing data M_Exported           [ readStart="226", readValueType="uint32" ]     // Total Exported Real Energy
        Thing data M_Exported_A         [ readStart="228", readValueType="uint32" ]     // Phase A Exported Real Energy
        Thing data M_Exported_B         [ readStart="230", readValueType="uint32" ]     // Phase B Exported Real Energy
        Thing data M_Exported_C         [ readStart="232", readValueType="uint32" ]     // Phase C Exported Real Energy
        Thing data M_Imported           [ readStart="234", readValueType="uint32" ]     // Total Imported Real Energy
        Thing data M_Imported_A         [ readStart="236", readValueType="uint32" ]     // Phase A Imported Real Energy
        Thing data M_Imported_B         [ readStart="238", readValueType="uint32" ]     // Phase B Imported Real Energy
        Thing data M_Imported_C         [ readStart="240", readValueType="uint32" ]     // Phase C Imported Real Energy
        Thing data M_Energy_W_SF        [ readStart="242", readValueType="int16" ]      // Real Energy Scale Factor
        //Thing data M_Exported_VA        [ readStart="243", readValueType="uint32" ]     // Total Exported Apparent Energy
        //Thing data M_Exported_VA_A      [ readStart="245", readValueType="uint32" ]     // Phase A Exported Apparent Energy
        //Thing data M_Exported_VA_B      [ readStart="247", readValueType="uint32" ]     // Phase B Exported Apparent Energy
        //Thing data M_Exported_VA_C      [ readStart="249", readValueType="uint32" ]     // Phase C Exported Apparent Energy
        //Thing data M_Imported_VA        [ readStart="251", readValueType="uint32" ]     // Total Imported Apparent Energy
        //Thing data M_Imported_VA_A      [ readStart="253", readValueType="uint32" ]     // Phase A Imported Apparent Energy
        //Thing data M_Imported_VA_B      [ readStart="255", readValueType="uint32" ]     // Phase B Imported Apparent Energy
        //Thing data M_Imported_VA_C      [ readStart="257", readValueType="uint32" ]     // Phase C Imported Apparent Energy
        //Thing data M_Energy_VA_SF       [ readStart="259", readValueType="int16" ]      // Apparent Energy Scale Factor
        //Thing data M_Import_VARh_Q1     [ readStart="260", readValueType="uint32" ]     // Quadrant 1: Total Imported Reactive Energy
        //Thing data M_Import_VARh_Q1A    [ readStart="262", readValueType="uint32" ]     // Phase A - Quadrant 1: Imported Reactive Energy
        //Thing data M_Import_VARh_Q1B    [ readStart="264", readValueType="uint32" ]     // Phase B - Quadrant 1: Imported Reactive Energy
        //Thing data M_Import_VARh_Q1C    [ readStart="266", readValueType="uint32" ]     // Phase C - Quadrant 1: Imported Reactive Energy
        //Thing data M_Import_VARh_Q2     [ readStart="268", readValueType="uint32" ]     // Quadrant 2: Total Imported Reactive Energy
        //Thing data M_Import_VARh_Q2A    [ readStart="270", readValueType="uint32" ]     // Phase A - Quadrant 2: Imported Reactive Energy
        //Thing data M_Import_VARh_Q2B    [ readStart="272", readValueType="uint32" ]     // Phase B - Quadrant 2: Imported Reactive Energy
        //Thing data M_Import_VARh_Q2C    [ readStart="274", readValueType="uint32" ]     // Phase C - Quadrant 2: Imported Reactive Energy
        //Thing data M_Import_VARh_Q3     [ readStart="276", readValueType="uint32" ]     // Quadrant 3: Total Exported Reactive Energy
        //Thing data M_Import_VARh_Q3A    [ readStart="278", readValueType="uint32" ]     // Phase A - Quadrant 3: Exported Reactive Energy
        //Thing data M_Import_VARh_Q3B    [ readStart="280", readValueType="uint32" ]     // Phase B - Quadrant 3: Exported Reactive Energy
        //Thing data M_Import_VARh_Q3C    [ readStart="282", readValueType="uint32" ]     // Phase C - Quadrant 3: Exported Reactive Energy
        //Thing data M_Import_VARh_Q4     [ readStart="284", readValueType="uint32" ]     // Quadrant 4: Total Exported Reactive Energy
        //Thing data M_Import_VARh_Q4A    [ readStart="286", readValueType="uint32" ]     // Phase A - Quadrant 4: Exported Reactive Energy
        //Thing data M_Import_VARh_Q4B    [ readStart="288", readValueType="uint32" ]     // Phase B - Quadrant 4: Exported Reactive Energy
        //Thing data M_Import_VARh_Q4C    [ readStart="290", readValueType="uint32" ]     // Phase C - Quadrant 4: Exported Reactive Energy
        //Thing data M_Energy_VAR_SF      [ readStart="292", readValueType="int16" ]      // Reactive Energy Scale Factor
    }
}

solaredgeInverter.items

// ########## SolarEdge General Items ##########
Switch						SE2K_ScaleAll				"Alle SE2K-Skalierungsregeln ausfĂĽhren"										(gSE2K)				{expire="10s,command=OFF"}

// ########## SolarEdge Wechselrichter Gruppen ##########
// SolarEdge Wechselrichter
Group						gSE2KStat					"Wechselrichter PV-Anlage (Status-Werte, nicht skalierbar)"					(GF_Hwr)
Group						gSE2KInt					"Wechselrichter PV-Anlage (int-Werte, skalierbar)"							(GF_Hwr)
Group						gSE2KSfInt					"Wechselrichter PV-Anlage Skalierungsfaktoren (int-Werte)"					(GF_Hwr)
Group						gSE2K						"Wechselrichter PV-Anlage (float-Werte, skaliert)"							(GF_Hwr)

// ########## ModBus Inverter Items (integer values) ##########
// PV WR ID / ModBus specific items
Number						SE2K_C_SunSpec_DID_int		"PV WR Typ [MAP(solaredgeInverterType.map):%s]"								(gSE2KStat)			{channel="modbus:data:SolarEdgeConverter:Registers:C_SunSpec_DID:number", autoupdate="false"}
Number						SE2K_C_SunSpec_Length_int	"PV WR Sunspec Datensatz Länge (int) [%d]"									(gSE2KStat)			{channel="modbus:data:SolarEdgeConverter:Registers:C_SunSpec_Length:number", autoupdate="false"}

// Current across all phases, Phases A,B,C and scaling factor
//Number SE2K_I_AC_Current_int "PV WR AC Strom gesamt (int) [%d A]" (gSE2Kint)     {channel="modbus:data:SolarEdgeConverter:Registers:I_AC_Current:number" }
Number						SE2K_I_AC_CurrentA_int		"PV WR AC Strom Ph.A (int) [%d A]"											(gSE2Kint)			{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_CurrentA:number"}
//Number SE2K_I_AC_CurrentB_int "PV WR AC Strom Ph.B (int) [%d A]" (gSE2Kint)           {channel="modbus:data:SolarEdgeConverter:Registers:I_AC_CurrentB:number" }
//Number SE2K_I_AC_CurrentC_int "PV WR AC Strom Ph.C (int) [%d A]" (gSE2Kint)           {channel="modbus:data:SolarEdgeConverter:Registers:I_AC_CurrentC:number" }
Number						SE2K_I_AC_Current_SF_int	"PV WR AC Strom Ph.A SF (int) [%d]"											(gSE2KSfInt)		{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_Current_SF:number"}

// Voltage for Phases A,B,C and scaling factor
Number						SE2K_I_AC_VoltageAB_int		"PV WR AC Spannung AB (int) [%d V]"											(gSE2Kint)			{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_VoltageAB:number"}
//Number SE2K_I_AC_VoltageBC_int "PV WR AC Spannung BC (int) [%d V]" (gSE2Kint) {channel="modbus:data:SolarEdgeConverter:Registers:I_AC_VoltageBC:number" }
//Number SE2K_I_AC_VoltageCA_int "PV WR AC Spannung CA (int) [%d V]" (gSE2Kint) {channel="modbus:data:SolarEdgeConverter:Registers:I_AC_VoltageCA:number" }
//Number SE2K_I_AC_VoltageAN_int "PV WR AC Spannung AN (int) [%d V]" (gSE2Kint) {channel="modbus:data:SolarEdgeConverter:Registers:I_AC_VoltageAN:number" }
//Number SE2K_I_AC_VoltageBN_int "PV WR AC Spannung BN (int) [%d V]" (gSE2Kint) {channel="modbus:data:SolarEdgeConverter:Registers:I_AC_VoltageBN:number" }
//Number SE2K_I_AC_VoltageCN_int "PV WR AC Spannung CN (int) [%d V]" (gSE2Kint) {channel="modbus:data:SolarEdgeConverter:Registers:I_AC_VoltageCN:number" }
Number						SE2K_I_AC_Voltage_SF_int	"PV WR AC Spannung SF (int) [%d]"											(gSE2KSfInt)		{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_Voltage_SF:number"}

// Real Power and SF
Number						SE2K_I_AC_Power_int			"PV WR AC Leistung (int) [%d W]"											(gSE2KInt)			{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_Power:number"}
Number						SE2K_I_AC_Power_SF_int		"PV WR AC Leistung SF (int) [%d]"											(gSE2KSfInt)		{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_Power_SF:number"}

// Frequency and SF
Number						SE2K_I_AC_Frequency_int		"PV WR AC Frequenz (int) [%d Hz]"											(gSE2KInt)			{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_Frequency:number"}
Number						SE2K_I_AC_Frequency_SF_int	"PV WR AC Frequenz SF (int) [%d]"											(gSE2KSfInt)		{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_Frequency_SF:number"}

// Apparent Power and SF
Number						SE2K_I_AC_VA_int			"PV WR AC Scheinleistung (int) [%d VA]"										(gSE2KInt)			{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_VA:number"}
Number						SE2K_I_AC_VA_SF_int			"PV WR AC Scheinleistung SF (int) [%d]"										(gSE2KSfInt)		{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_VA_SF:number"}

// Reactive Power and SF
Number						SE2K_I_AC_VAR_int			"PV WR AC Blindleistung (int) [%d var]"										(gSE2KInt)			{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_VAR:number"}
Number						SE2K_I_AC_VAR_SF_int		"PV WR AC Blindleistung SF (int) [%d]"										(gSE2KSfInt)		{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_VAR_SF:number"}

// Power factor
Number						SE2K_I_AC_PF_int			"PV WR AC Leistungsfaktor (int) [%d %%]"									(gSE2KInt)			{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_PF:number"}
Number						SE2K_I_AC_PF_SF_int			"PV WR AC Leistungsfaktor SF (int) [%d]"									(gSE2KSfInt)		{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_PF_SF:number"}

// Lifetime generated energy (acc32-Value / 32-Bit-Wert - im Gegensatz zu allen anderen!)
Number						SE2K_I_AC_Energy_WH_int		"PV WR AC Erzeugungszaehler (int) [%d Wh]"									(gSE2KInt)			{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_Energy_WH:number"}
Number						SE2K_I_AC_Energy_WH_SF_int	"PV WR AC Erzeugungszaehler SF (int) [%d]"									(gSE2KSfInt)		{channel="modbus:data:SolarEdgeConverter:Registers:I_AC_Energy_WH_SF:number"}

// DC side current
Number						SE2K_I_DC_Current_int		"PV WR DC Strom (int) [%d A]"												(gSE2KInt)			{channel="modbus:data:SolarEdgeConverter:Registers:I_DC_Current:number"}
Number						SE2K_I_DC_Current_SF_int	"PV WR DC Strom SF (int) [%d]"												(gSE2KSfInt)		{channel="modbus:data:SolarEdgeConverter:Registers:I_DC_Current_SF:number"}

// DC side voltage
Number						SE2K_I_DC_Voltage_int		"PV WR DC Spannung (int) [%d V]"											(gSE2KInt)			{channel="modbus:data:SolarEdgeConverter:Registers:I_DC_Voltage:number"}
Number						SE2K_I_DC_Voltage_SF_int	"PV WR DC Spannung SF (int) [%d]"											(gSE2KSfInt)		{channel="modbus:data:SolarEdgeConverter:Registers:I_DC_Voltage_SF:number"}

// DC side power
Number						SE2K_I_DC_Power_int			"PV WR DC Leistung (int) [%d W]"											(gSE2KInt)			{channel="modbus:data:SolarEdgeConverter:Registers:I_DC_Power:number"}
Number						SE2K_I_DC_Power_SF_int		"PV WR DC Leistung SF (int) [%d]"											(gSE2KSfInt)		{channel="modbus:data:SolarEdgeConverter:Registers:I_DC_Power_SF:number"}

// Temperature heat sink
Number						SE2K_I_TempSink_int			"PV WR Temperatur Kühlplatte (int) [%d °C]"									(gSE2KInt)			{channel="modbus:data:SolarEdgeConverter:Registers:I_Temp_Sink:number"}
Number						SE2K_I_TempSink_SF_int		"PV WR Temperatur KĂĽhlplatte SF (int) [%d]"									(gSE2KSfInt)		{channel="modbus:data:SolarEdgeConverter:Registers:I_Temp_SF:number"}

// Operating state
Number						SE2K_I_Status_int			"PV WR Status [MAP(solaredgeStatus.map):%s]"								(gSE2KStat)			{channel="modbus:data:SolarEdgeConverter:Registers:I_Status:number", autoupdate="false"}
Number						SE2K_I_Status_Vendor_int	"PV WR Status (SE-spezifisch) [%d]"											(gSE2KStat)			{channel="modbus:data:SolarEdgeConverter:Registers:I_Status_Vendor:number", autoupdate="false"}


// ########## ModBus Inverter Items (float values) ##########
// AC Current across all phases
Number:ElectricCurrent		SE2K_I_AC_CurrentA			"PV WR AC Strom gesamt [%.2f A]"							<energy>		(gSE2K)

// AC Voltage for all phases
Number:ElectricPotential	SE2K_I_AC_VoltageAB			"PV WR AC Spannung [%.2f V]"								<energy>		(gSE2K)

// AC Real power
Number:Power				SE2K_I_AC_Power				"PV WR AC Wirkleistung [%.2f W]"							<energy>		(gSE2K)

// AC Frequency
Number:Frequency			SE2K_I_AC_Frequency			"PV WR Netzfrequenz [%.3f Hz]"								<line>			(gSE2K)

// AC Apparent power
Number:Power				SE2K_I_AC_VA				"PV WR AC Scheinleistung [%.2f VA]"							<energy>		(gSE2K)

// AC Reactive power
Number:Power				SE2K_I_AC_VAR				"PV WR AC Blindleistung [%.2f var]"							<energy>		(gSE2K)

// AC Power factor
Number:Dimensionless		SE2K_I_AC_PF				"PV WR AC Leistungsfaktor [%.2f %%]"						<line>			(gSE2K)

// Lifetime generated energy
Number:Energy				SE2K_I_AC_Energy_WH			"PV WR AC Erzeugungszaehler [%.2f Wh]"						<energy>		(gSE2K)

// DC Current
Number:ElectricCurrent		SE2K_I_DC_Current			"PV WR DC Strom [%.2f A]"									<energy>		(gSE2K)

// DC Voltage
Number:ElectricPotential	SE2K_I_DC_Voltage			"PV WR DC Spannung [%.2f V]"								<energy>		(gSE2K)

// DC Power
Number:Power				SE2K_I_DC_Power				"PV WR DC Leistung [%.2f W]"								<energy>		(gSE2K)

// Temperature heat sink
Number:Temperature			SE2K_I_TempSink				"PV WR Temperatur Kühlplatte [%.2f °C]"						<temperature>	(gSE2K)

solaredgeMeter.items

// ########## SolarEdge General Items ##########
Switch						SE2KM_ScaleAll					"Alle SE2KM-Skalierungsregeln ausfĂĽhren"									(gSE2KM)					{expire="10s,command=OFF"}

// ########## SolarEdge Meter Gruppen ##########
// SolarEdge Meter
Group						gSE2KMStat						"Meter PV-Anlage (Status-Werte, nicht skalierbar)"							(GF_Hwr)
Group						gSE2KMInt						"Meter PV-Anlage (int-Werte, skalierbar)"									(GF_Hwr)
Group						gSE2KMSfInt						"Meter PV-Anlage Skalierungsfaktoren (int-Werte)"							(GF_Hwr)
Group						gSE2KM							"Meter PV-Anlage (float-Werte, skaliert)"									(GF_Hwr)
Group						gSE2KMMomentan					"Meter PV-Anlage (Momentan-Leistungen)"										(GF_Hwr)

// ########## ModBus Meter Items (integer values) ##########
// PV Meter ID / ModBus specific items
Number						SE2K_M_C_SunSpec_DID_int		"PV Meter Typ [MAP(solaredgeMeterType.map):%s]"								(gSE2KMStat)				{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_C_SunSpec_DID:number", autoupdate="false"}
Number						SE2K_M_C_SunSpec_Length_int		"PV Meter Sunspec Datensatz Länge (int) [%d]"								(gSE2KMStat)				{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_C_SunSpec_Length:number"}

// PV Meter Amps Across all phases, Phases A,B,C and scaling factor
Number						SE2K_M_AC_Current_int			"PV Meter AC Strom (Summe) (int) [%d A]"									(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Current:number"}
Number						SE2K_M_AC_Current_A_int			"PV Meter AC Strom Phase A (int) [%d A]"									(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Current_A:number"}
Number						SE2K_M_AC_Current_B_int			"PV Meter AC Strom Phase B (int) [%d A]"									(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Current_B:number"}
Number						SE2K_M_AC_Current_C_int			"PV Meter AC Strom Phase C (int) [%d A]"									(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Current_C:number"}
Number						SE2K_M_AC_Current_SF_int		"PV Meter AC Strom SF (int) [%d]"											(gSE2KMSfInt)				{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Current_SF:number"}

// PV Meter Voltage for Phases A,B,C and scaling factor
Number						SE2K_M_AC_Voltage_LN_int		"PV Meter Spannung LN (Avg.) (int) [%d V]"									(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Voltage_LN:number"}
Number						SE2K_M_AC_Voltage_AN_int		"PV Meter Spannung AN (int) [%d V]"											(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Voltage_AN:number"}
Number						SE2K_M_AC_Voltage_BN_int		"PV Meter Spannung BN (int) [%d V]"											(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Voltage_BN:number"}
Number						SE2K_M_AC_Voltage_CN_int		"PV Meter Spannung CN (int) [%d V]"											(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Voltage_CN:number"}
//Number SE2K_M_AC_Voltage_LL_int "PV Meter Spannung LL (Avg.) (int) [%d V]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Voltage_LL:number" }
//Number SE2K_M_AC_Voltage_AB_int "PV Meter Spannung AB (int) [%d V]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Voltage_AB:number" }
//Number SE2K_M_AC_Voltage_BC_int "PV Meter Spannung BC (int) [%d V]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Voltage_BC:number" }
//Number SE2K_M_AC_Voltage_CA_int "PV Meter Spannung CA (int) [%d V]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Voltage_CA:number" }
Number						SE2K_M_AC_Voltage_SF_int		"PV Meter Spannung SF (int) [%d]"											(gSE2KMSfInt)				{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Voltage_SF:number"}

// PV Meter Frequency and SF
Number						SE2K_M_AC_Freq_int				"PV Meter Frequenz (int) [%d Hz]"											(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Freq:number"}
Number						SE2K_M_AC_Freq_SF_int			"PV Meter Frequenz SF (int) [%d]"											(gSE2KMSfInt)				{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Freq_SF:number"}

// Real Power and SF
Number						SE2K_M_AC_Power_int				"PV Meter Wirkleistung (Summe) (int) [%d W]"								(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Power:number"}
Number						SE2K_M_AC_Power_A_int			"PV Meter Wirkleistung Phase A (int) [%d W]"								(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Power_A:number"}
Number						SE2K_M_AC_Power_B_int			"PV Meter Wirkleistung Phase B (int) [%d W]"								(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Power_B:number"}
Number						SE2K_M_AC_Power_C_int			"PV Meter Wirkleistung Phase C (int) [%d W]"								(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Power_C:number"}
Number						SE2K_M_AC_Power_SF_int			"PV Meter Wirkleistung SF [%d]"												(gSE2KMSfInt)				{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_Power_SF:number"}

// Apparent Power and SF
Number						SE2K_M_AC_VA_int				"PV Meter Scheinleistung (Summe) (int) [%d VA]"								(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_VA:number"}
Number						SE2K_M_AC_VA_A_int				"PV Meter Scheinleistung Phase A (int) [%d VA]"								(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_VA_A:number"}
Number						SE2K_M_AC_VA_B_int				"PV Meter Scheinleistung Phase B (int) [%d VA]"								(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_VA_B:number"}
Number						SE2K_M_AC_VA_C_int				"PV Meter Scheinleistung Phase C (int) [%d VA]"								(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_VA_C:number"}
Number						SE2K_M_AC_VA_SF_int				"PV Meter Scheinleistung SF (int) [%d]"										(gSE2KMSfInt)				{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_VA_SF:number"}

// Reactive Power and SF
//Number SE2K_M_AC_VAR_int "PV Meter Blindleistung (Summe) (int) [%d var]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_VAR:number" }
//Number SE2K_M_AC_VAR_A_int "PV Meter Blindleistung Phase A (int) [%d var]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_VAR_A:number" }
//Number SE2K_M_AC_VAR_B_int "PV Meter Blindleistung Phase B (int) [%d var]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_VAR_B:number" }
//Number SE2K_M_AC_VAR_C_int "PV Meter Blindleistung Phase C (int) [%d var]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_VAR_C:number" }
//Number SE2K_M_AC_VAR_SF_int "PV Meter Blindleistung SF (int) [%d]" (gSE2KMSfInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_VAR_SF:number" }

// Power factor
Number						SE2K_M_AC_PF_int				"PV Meter Leistungsfaktor (Avg.) (int) [%d %%]"								(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_PF:number"}
Number						SE2K_M_AC_PF_A_int				"PV Meter Leistungsfaktor Phase A (int) [%d %%]"							(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_PF_A:number"}
Number						SE2K_M_AC_PF_B_int				"PV Meter Leistungsfaktor Phase B (int) [%d %%]"							(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_PF_B:number"}
Number						SE2K_M_AC_PF_C_int				"PV Meter Leistungsfaktor Phase C (int) [%d %%]"							(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_PF_C:number"}
Number						SE2K_M_AC_PF_SF_int				"PV Meter Leistungsfaktor SF (int) [%d %%]"									(gSE2KMSfInt)				{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_AC_PF_SF:number"}

// Accumulated Energy (Real Energy)
Number						SE2K_M_Exported_int				"PV Meter Einspeisezähler Wirkenergie (Summe) (int) [%d Wh]"				(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Exported:number"}
Number						SE2K_M_Exported_A_int			"PV Meter Einspeisezähler Wirkenergie Phase A (int) [%d Wh]"				(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Exported_A:number"}
Number						SE2K_M_Exported_B_int			"PV Meter Einspeisezähler Wirkenergie Phase B (int) [%d Wh]"				(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Exported_B:number"}
Number						SE2K_M_Exported_C_int			"PV Meter Einspeisezähler Wirkenergie Phase C (int) [%d Wh]"				(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Exported_C:number"}
Number						SE2K_M_Imported_int				"PV Meter Bezugszähler Wirkenergie (Summe) (int) [%d Wh]"					(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Imported:number"}
Number						SE2K_M_Imported_A_int			"PV Meter Bezugszähler Wirkenergie Phase A (int) [%d Wh]"					(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Imported_A:number"}
Number						SE2K_M_Imported_B_int			"PV Meter Bezugszähler Wirkenergie Phase B (int) [%d Wh]"					(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Imported_B:number"}
Number						SE2K_M_Imported_C_int			"PV Meter Bezugszähler Wirkenergie Phase C (int) [%d Wh]"					(gSE2KMInt)					{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Imported_C:number"}
Number						SE2K_M_Energy_W_SF_int			"PV Meter Zähler Wirkenergie SF (int) [%d]"									(gSE2KMSfInt)				{channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Energy_W_SF:number"}

// Accumulated Energy (Apparent Energy)
//Number SE2K_M_Exported_VA_int "PV Meter Einspeisezähler Scheinenergie (Summe) (int) [%d VAh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Exported_VA:number" }
//Number SE2K_M_Exported_VA_A_int "PV Meter Einspeisezähler Scheinenergie Phase A (int) [%d VAh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Exported_VA_A:number" }
//Number SE2K_M_Exported_VA_B_int "PV Meter Einspeisezähler Scheinenergie Phase B (int) [%d VAh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Exported_VA_B:number" }
//Number SE2K_M_Exported_VA_C_int "PV Meter Einspeisezähler Scheinenergie Phase C (int) [%d VAh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Exported_VA_C:number" }
//Number SE2K_M_Imported_VA_int "PV Meter Bezugszähler Scheinenergie (Summe) (int) [%d VAh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Imported_VA:number" }
//Number SE2K_M_Imported_VA_A_int "PV Meter Bezugszähler Scheinenergie Phase A (int) [%d VAh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Imported_VA_A:number" }
//Number SE2K_M_Imported_VA_B_int "PV Meter Bezugszähler Scheinenergie Phase B (int) [%d VAh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Imported_VA_B:number" }
//Number SE2K_M_Imported_VA_C_int "PV Meter Bezugszähler Scheinenergie Phase C (int) [%d VAh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Imported_VA_C:number" }
//Number SE2K_M_Energy_VA_SF_int "PV Meter Zähler Scheinenergie SF (int) [%d]" (gSE2KMSfInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Energy_VA_SF:number" }

// Accumulated Energy (Reactive Energy)
//Number SE2K_M_Import_VARh_Q1_int "PV Meter Bezugszähler Blindenergie Q1 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q1:number" }
//Number SE2K_M_Import_VARh_Q1A_int "PV Meter Bezugszähler Blindenergie Ph. A Q1 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q1A:number" }
//Number SE2K_M_Import_VARh_Q1B_int "PV Meter Bezugszähler Blindenergie Ph. B Q1 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q1B:number" }
//Number SE2K_M_Import_VARh_Q1C_int "PV Meter Bezugszähler Blindenergie Ph. C Q1 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q1C:number" }
//Number SE2K_M_Import_VARh_Q2_int "PV Meter Bezugszähler Blindenergie Q2 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q2:number" }
//Number SE2K_M_Import_VARh_Q2A_int "PV Meter Bezugszähler Blindenergie Ph. A Q2 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q2A:number" }
//Number SE2K_M_Import_VARh_Q2B_int "PV Meter Bezugszähler Blindenergie Ph. B Q2 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q2B:number" }
//Number SE2K_M_Import_VARh_Q2C_int "PV Meter Bezugszähler Blindenergie Ph. C Q2 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q2C:number" }
//Number SE2K_M_Import_VARh_Q3_int "PV Meter Bezugszähler Blindenergie Q3 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q3:number" }
//Number SE2K_M_Import_VARh_Q3A_int "PV Meter Bezugszähler Blindenergie Ph. A Q3 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q3A:number" }
//Number SE2K_M_Import_VARh_Q3B_int "PV Meter Bezugszähler Blindenergie Ph. B Q3 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q3B:number" }
//Number SE2K_M_Import_VARh_Q3C_int "PV Meter Bezugszähler Blindenergie Ph. C Q3 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q3C:number" }
//Number SE2K_M_Import_VARh_Q4_int "PV Meter Bezugszähler Blindenergie Q4 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q4:number" }
//Number SE2K_M_Import_VARh_Q4A_int "PV Meter Bezugszähler Blindenergie Ph. A Q4 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q4A:number" }
//Number SE2K_M_Import_VARh_Q4B_int "PV Meter Bezugszähler Blindenergie Ph. B Q4 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q4B:number" }
//Number SE2K_M_Import_VARh_Q4C_int "PV Meter Bezugszähler Blindenergie Ph. C Q4 (Summe) (int) [%d VARh]" (gSE2KMInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Import_VARh_Q4C:number" }
//Number SE2K_M_Energy_VAR_SF_int "PV Meter Zähler Blindenergie SF (int) [%d]" (gSE2KMSfInt) {channel="modbus:data:SolarEdgeConverter:RegistersMeter:M_Energy_VAR_SF:number" }

// PV Meter Events
Number						SE2K_M_Events_int				"PV Meter Events [%h]"														(gSE2KMStat)				{channel="modbus:data:SolarEdgeConverter:Registers:M_Events:number"}


// ########## ModBus Meter Items (float values) ##########
// PV Meter Amps Across all phases, Phases A,B,C and scaling factor
Number:ElectricCurrent		SE2K_M_AC_Current				"PV Meter AC Strom (Summe) [%.2f A]"							<energy>	(gSE2KM)
Number:ElectricCurrent		SE2K_M_AC_Current_A				"PV Meter AC Strom Phase A [%.2f A]"							<energy>	(gSE2KM)
Number:ElectricCurrent		SE2K_M_AC_Current_B				"PV Meter AC Strom Phase B [%.2f A]"							<energy>	(gSE2KM)
Number:ElectricCurrent		SE2K_M_AC_Current_C				"PV Meter AC Strom Phase C [%.2f A]"							<energy>	(gSE2KM)
// PV Amps calculated from Power and Voltage
Number:ElectricCurrent		SE2K_M_AC_Current_calc			"PV Meter AC Strom (Summe, berechnet) [%.2f A]"					<energy>	(gSE2KM)
Number:ElectricCurrent		SE2K_M_AC_Current_A_calc		"PV Meter AC Strom Phase A (berechnet) [%.2f A]"				<energy>	(gSE2KM)
Number:ElectricCurrent		SE2K_M_AC_Current_B_calc		"PV Meter AC Strom Phase B (berechnet) [%.2f A]"				<energy>	(gSE2KM)
Number:ElectricCurrent		SE2K_M_AC_Current_C_calc		"PV Meter AC Strom Phase C (berechnet) [%.2f A]"				<energy>	(gSE2KM)

// PV Meter Voltage for Phases A,B,C and scaling factor
Number:ElectricPotential	SE2K_M_AC_Voltage_LN			"PV Meter Spannung LN (Avg.) [%.2f V]"							<energy>	(gSE2KM)
Number:ElectricPotential	SE2K_M_AC_Voltage_AN			"PV Meter Spannung AN [%.2f V]"									<energy>	(gSE2KM)
Number:ElectricPotential	SE2K_M_AC_Voltage_BN			"PV Meter Spannung BN [%.2f V]"									<energy>	(gSE2KM)
Number:ElectricPotential	SE2K_M_AC_Voltage_CN			"PV Meter Spannung CN [%.2f V]"									<energy>	(gSE2KM)
//Number:ElectricPotential SE2K_M_AC_Voltage_LL "PV Meter Spannung LL (Avg.) [%.2f V]" <energy> (gSE2KM)
//Number:ElectricPotential SE2K_M_AC_Voltage_AB "PV Meter Spannung AB [%.2f V]" <energy> (gSE2KM)
//Number:ElectricPotential SE2K_M_AC_Voltage_BC "PV Meter Spannung BC [%.2f V]" <energy> (gSE2KM)
//Number:ElectricPotential SE2K_M_AC_Voltage_CA "PV Meter Spannung CA [%.2f V]" <energy> (gSE2KM)

// PV Meter Frequency and SF
Number:Frequency			SE2K_M_AC_Freq					"PV Meter Frequenz [%.3f Hz]"									<line>		(gSE2KM)

// Real Power and SF
Number:Power				SE2K_M_AC_Power					"PV Meter Wirkleistung (Summe) [%.2f W]"						<energy>	(gSE2KM)
Number:Power				SE2K_M_AC_Power_A				"PV Meter Wirkleistung Phase A [%.2f W]"						<energy>	(gSE2KM)
Number:Power				SE2K_M_AC_Power_B				"PV Meter Wirkleistung Phase B [%.2f W]"						<energy>	(gSE2KM)
Number:Power				SE2K_M_AC_Power_C				"PV Meter Wirkleistung Phase C [%.2f W]"						<energy>	(gSE2KM)

// Apparent Power and SF
Number:Power				SE2K_M_AC_VA					"PV Meter Scheinleistung (Summe) [%.2f VA]"						<energy>	(gSE2KM)
Number:Power				SE2K_M_AC_VA_A					"PV Meter Scheinleistung Phase A [%.2f VA]"						<energy>	(gSE2KM)
Number:Power				SE2K_M_AC_VA_B					"PV Meter Scheinleistung Phase B [%.2f VA]"						<energy>	(gSE2KM)
Number:Power				SE2K_M_AC_VA_C					"PV Meter Scheinleistung Phase C [%.2f VA]"						<energy>	(gSE2KM)

// Reactive Power and SF
//Number:Power SE2K_M_AC_VAR "PV Meter Blindleistung (Summe) [%.2f var]" <energy> (gSE2KM)
//Number:Power SE2K_M_AC_VAR_A "PV Meter Blindleistung Phase A [%.2f var]" <energy> (gSE2KM)
//Number:Power SE2K_M_AC_VAR_B "PV Meter Blindleistung Phase B [%.2f var]" <energy> (gSE2KM)
//Number:Power SE2K_M_AC_VAR_C "PV Meter Blindleistung Phase C [%.2f var]" <energy> (gSE2KM)

// Power factor
Number:Dimensionless		SE2K_M_AC_PF					"PV Meter Leistungsfaktor (Avg.) [%.2f %%]"						<line>		(gSE2KM)
Number:Dimensionless		SE2K_M_AC_PF_A					"PV Meter Leistungsfaktor Phase A [%.2f %%]"					<line>		(gSE2KM)
Number:Dimensionless		SE2K_M_AC_PF_B					"PV Meter Leistungsfaktor Phase B [%.2f %%]"					<line>		(gSE2KM)
Number:Dimensionless		SE2K_M_AC_PF_C					"PV Meter Leistungsfaktor Phase C [%.2f %%]"					<line>		(gSE2KM)

// Accumulated Energy (Real Energy)
Number:Energy				SE2K_M_Exported					"PV Meter Einspeisezähler Wirkenergie (Summe) [%.2f Wh]"		<energy>	(gSE2KM)
Number:Energy				SE2K_M_Exported_A				"PV Meter Einspeisezähler Wirkenergie Phase A [%.2f Wh]"		<energy>	(gSE2KM)
Number:Energy				SE2K_M_Exported_B				"PV Meter Einspeisezähler Wirkenergie Phase B [%.2f Wh]"		<energy>	(gSE2KM)
Number:Energy				SE2K_M_Exported_C				"PV Meter Einspeisezähler Wirkenergie Phase C [%.2f Wh]"		<energy>	(gSE2KM)
Number:Energy				SE2K_M_Imported					"PV Meter Bezugszähler Wirkenergie (Summe) [%.2f Wh]"			<energy>	(gSE2KM)
Number:Energy				SE2K_M_Imported_A				"PV Meter Bezugszähler Wirkenergie Phase A [%.2f Wh]"			<energy>	(gSE2KM)
Number:Energy				SE2K_M_Imported_B				"PV Meter Bezugszähler Wirkenergie Phase B [%.2f Wh]"			<energy>	(gSE2KM)
Number:Energy				SE2K_M_Imported_C				"PV Meter Bezugszähler Wirkenergie Phase C [%.2f Wh]"			<energy>	(gSE2KM)

// Accumulated Energy (Apparent Energy)
//Number:Energy SE2K_M_Exported_VA "PV Meter Einspeisezähler Scheinenergie (Summe) [%.2f VAh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Exported_VA_A "PV Meter Einspeisezähler Scheinenergie Phase A [%.2f VAh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Exported_VA_B "PV Meter Einspeisezähler Scheinenergie Phase B [%.2f VAh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Exported_VA_C "PV Meter Einspeisezähler Scheinenergie Phase C [%.2f VAh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Imported_VA "PV Meter Bezugszähler Scheinenergie (Summe) [%.2f VAh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Imported_VA_A "PV Meter Bezugszähler Scheinenergie Phase A [%.2f VAh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Imported_VA_B "PV Meter Bezugszähler Scheinenergie Phase B [%.2f VAh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Imported_VA_C "PV Meter Bezugszähler Scheinenergie Phase C [%.2f VAh]" <energy> (gSE2KM)

// Accumulated Energy (Reactive Energy)
//Number:Energy SE2K_M_Import_VARh_Q1 "PV Meter Bezugszähler Blindenergie Q1 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q1A "PV Meter Bezugszähler Blindenergie Ph. A Q1 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q1B "PV Meter Bezugszähler Blindenergie Ph. B Q1 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q1C "PV Meter Bezugszähler Blindenergie Ph. C Q1 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q2 "PV Meter Bezugszähler Blindenergie Q2 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q2A "PV Meter Bezugszähler Blindenergie Ph. A Q2 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q2B "PV Meter Bezugszähler Blindenergie Ph. B Q2 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q2C "PV Meter Bezugszähler Blindenergie Ph. C Q2 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q3 "PV Meter Bezugszähler Blindenergie Q3 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q3A "PV Meter Bezugszähler Blindenergie Ph. A Q3 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q3B "PV Meter Bezugszähler Blindenergie Ph. B Q3 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q3C "PV Meter Bezugszähler Blindenergie Ph. C Q3 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q4 "PV Meter Bezugszähler Blindenergie Q4 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q4A "PV Meter Bezugszähler Blindenergie Ph. A Q4 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q4B "PV Meter Bezugszähler Blindenergie Ph. B Q4 (Summe) [%.2f VARh]" <energy> (gSE2KM)
//Number:Energy SE2K_M_Import_VARh_Q4C "PV Meter Bezugszähler Blindenergie Ph. C Q4 (Summe) [%.2f VARh]" <energy> (gSE2KM)

// Other calculated Items
Number:Power				SE2KM_EigenverbrauchGesamt		"Eigenverbrauch Gesamt [%.2f Wh]"								<energy>	(gSE2KM)
Number:Power				SE2KM_GesamtverbrauchGesamt		"Gesamtverbrauch Gesamt [%.2f Wh]"								<energy>	(gSE2KM)
Number:Dimensionless		SE2KM_SolarerDeckungsgradGesamt	"SolarerDeckungsgrad Gesamt [%.2f %%]"							<line>		(gSE2KM)
Number:Power				SE2KM_DirektverbrauchMomentan	"Direktverbrauch Momentan [%.2f W]"								<energy>	(gSE2KM,gSE2KMMomentan)
Number:Power				SE2KM_HausverbrauchMomentan		"Hausverbrauch Momentan [%.2f W]"								<energy>	(gSE2KM,gSE2KMMomentan)
Number:Power				SE2KM_NetzleistungMomentan		"Netzleistung Momentan [%.2f W]"								<energy>	(gSE2KM,gSE2KMMomentan)
1 Like

(Part 2/3)

solaredge.rules (part 1/2)

import java.lang.Math
import java.lang.Double

// Fire scaling rules on system startup
rule SE2K_SE2KM_ScaleOnStartup
when
    System started
then
    SE2K_ScaleAll.sendCommand(ON)
    SE2KM_ScaleAll.sendCommand(ON)
end

// ########## SolarEdge Inverter Item Scaling rules ##########
rule SE2K_I_AC_CurrentA_Scaling
when 
    Item SE2K_ScaleAll changed to ON or
    Item SE2K_I_AC_CurrentA_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_I_AC_CurrentA - '

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_I_AC_Current_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = (SE2K_I_AC_CurrentA_int.state as DecimalType).doubleValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_I_AC_CurrentA_int.state.toString + ', SF: 10^' + SE2K_I_AC_Current_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_I_AC_CurrentA.postUpdate(result)
end

rule SE2K_I_AC_VoltageAB_Scaling
when 
    Item SE2K_ScaleAll changed to ON or
    Item SE2K_I_AC_VoltageAB_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_I_AC_VoltageAB - '

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_I_AC_Voltage_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = (SE2K_I_AC_VoltageAB_int.state as DecimalType).doubleValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_I_AC_VoltageAB_int.state.toString + ', SF: 10^' + SE2K_I_AC_Voltage_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_I_AC_VoltageAB.postUpdate(result)
end

rule SE2K_I_AC_Power_Scaling
when 
    Item SE2K_ScaleAll changed to ON or
    Item SE2K_I_AC_Power_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_I_AC_Power - '

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_I_AC_Power_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = (SE2K_I_AC_Power_int.state as DecimalType).doubleValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_I_AC_Power_int.state.toString + ', SF: 10^' + SE2K_I_AC_Power_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_I_AC_Power.postUpdate(result)
end

rule SE2K_I_AC_Frequency_Scaling
when 
    Item SE2K_ScaleAll changed to ON or
    Item SE2K_I_AC_Frequency_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_I_AC_Frequency - '

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_I_AC_Frequency_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = (SE2K_I_AC_Frequency_int.state as DecimalType).doubleValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_I_AC_Frequency_int.state.toString + ', SF: 10^' + SE2K_I_AC_Frequency_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_I_AC_Frequency.postUpdate(result)
end

rule SE2K_I_AC_VA_Scaling
when 
    Item SE2K_ScaleAll changed to ON or
    Item SE2K_I_AC_VA_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_I_AC_VA - '

    // Wert normieren
    var Double intValue = (SE2K_I_AC_VA_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_I_AC_VA_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_I_AC_VA_int.state.toString + ', SF: 10^' + SE2K_I_AC_VA_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_I_AC_VA.postUpdate(result)
end

rule SE2K_I_AC_VAR_Scaling
when 
    Item SE2K_ScaleAll changed to ON or
    Item SE2K_I_AC_VAR_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_I_AC_VAR - '

    // Wert normieren
    var Double intValue = (SE2K_I_AC_VAR_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_I_AC_VAR_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_I_AC_VAR_int.state.toString + ', SF: 10^' + SE2K_I_AC_VAR_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_I_AC_VAR.postUpdate(result)
end

rule SE2K_I_AC_PF_Scaling
when 
    Item SE2K_ScaleAll changed to ON or
    Item SE2K_I_AC_PF_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_I_AC_PF - '

    // Wert normieren
    var Double intValue = (SE2K_I_AC_PF_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_I_AC_PF_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_I_AC_PF_int.state.toString + ', SF: 10^' + SE2K_I_AC_PF_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_I_AC_PF.postUpdate(result)
end

rule SE2K_I_AC_Energy_WH_Scaling
when 
    Item SE2K_ScaleAll changed to ON or
    Item SE2K_I_AC_Energy_WH_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_I_AC_Energy_WH - '

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_I_AC_Energy_WH_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = (SE2K_I_AC_Energy_WH_int.state as DecimalType).doubleValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_I_AC_Energy_WH_int.state.toString + ', SF: 10^' + SE2K_I_AC_Energy_WH_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_I_AC_Energy_WH.postUpdate(result)
end

rule SE2K_I_DC_Current_Scaling
when 
    Item SE2K_ScaleAll changed to ON or
    Item SE2K_I_DC_Current_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_I_DC_Current - '

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_I_DC_Current_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = (SE2K_I_DC_Current_int.state as DecimalType).doubleValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_I_DC_Current_int.state.toString + ', SF: 10^' + SE2K_I_DC_Current_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_I_DC_Current.postUpdate(result)
end

rule SE2K_I_DC_Voltage_Scaling
when 
    Item SE2K_ScaleAll changed to ON or
    Item SE2K_I_DC_Voltage_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_I_DC_Voltage - '

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_I_DC_Voltage_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = (SE2K_I_DC_Voltage_int.state as DecimalType).doubleValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_I_DC_Voltage_int.state.toString + ', SF: 10^' + SE2K_I_DC_Voltage_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_I_DC_Voltage.postUpdate(result)
end

rule SE2K_I_DC_Power_Scaling
when 
    Item SE2K_ScaleAll changed to ON or
    Item SE2K_I_DC_Power_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_I_DC_Power - '

    // Wert normieren
    var Double intValue = (SE2K_I_DC_Power_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_I_DC_Power_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_I_DC_Power_int.state.toString + ', SF: 10^' + SE2K_I_DC_Power_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_I_DC_Power.postUpdate(result)
end

rule SE2K_I_TempSink_Scaling
when 
    Item SE2K_ScaleAll changed to ON or
    Item SE2K_I_TempSink_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_I_TempSink - '

    // Wert normieren
    var Double intValue = (SE2K_I_TempSink_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_I_TempSink_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_I_TempSink_int.state.toString + ', SF: 10^' + SE2K_I_TempSink_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_I_TempSink.postUpdate(result)
end


// ########## SolarEdge Meter Item Scaling rules ##########
rule SE2K_M_AC_Current_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Current_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Current - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Current_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Current_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Current_int.state.toString + ', SF: 10^' + SE2K_M_AC_Current_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Current.postUpdate(result)

    // Wert aus Leistung und Spannung parallel berechnen
    var Double valueCalc = (SE2K_M_AC_Power.state as QuantityType<Power>).doubleValue / ((SE2K_M_AC_Voltage_LN.state as QuantityType<ElectricPotential>).doubleValue * ((SE2K_M_AC_PF.state as QuantityType<Dimensionless>).doubleValue / 100.0 ))
    SE2K_M_AC_Current_calc.postUpdate(valueCalc)
end

rule SE2K_M_AC_Current_A_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Current_A_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Current_A - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Current_A_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Current_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Current_A_int.state.toString + ', SF: 10^' + SE2K_M_AC_Current_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Current_A.postUpdate(result)

    // Wert aus Scheinleistung und Spannung parallel berechnen
    // Bug: SE2K_M_AC_VA_A wird nicht als QuantityType<Power> erkannt, deshalb DecimalType
    var Double valueCalc = (SE2K_M_AC_VA_A.state as DecimalType).doubleValue / (SE2K_M_AC_Voltage_AN.state as QuantityType<ElectricPotential>).doubleValue
    if ((SE2K_M_AC_Power_A.state as QuantityType<Power>).doubleValue < 0.0) {
        valueCalc = -1.0 * valueCalc
    } 
    SE2K_M_AC_Current_A_calc.postUpdate(valueCalc)
end

rule SE2K_M_AC_Current_B_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Current_B_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Current_B - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Current_B_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Current_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Current_B_int.state.toString + ', SF: 10^' + SE2K_M_AC_Current_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Current_B.postUpdate(result)

    // Wert aus Scheinleistung und Spannung parallel berechnen
    // Bug: SE2K_M_AC_VA_B wird nicht als QuantityType<Power> erkannt, deshalb DecimalType
    var Double valueCalc = (SE2K_M_AC_VA_B.state as DecimalType).doubleValue / (SE2K_M_AC_Voltage_BN.state as QuantityType<ElectricPotential>).doubleValue
    if ((SE2K_M_AC_Power_B.state as QuantityType<Power>).doubleValue < 0.0) {
        valueCalc = -1.0 * valueCalc
    } 
    SE2K_M_AC_Current_B_calc.postUpdate(valueCalc)
end

rule SE2K_M_AC_Current_C_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Current_C_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Current_C - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Current_C_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Current_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Current_C_int.state.toString + ', SF: 10^' + SE2K_M_AC_Current_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Current_C.postUpdate(result)

    // Wert aus Scheinleistung und Spannung parallel berechnen
    // Bug: SE2K_M_AC_VA_C wird nicht als QuantityType<Power> erkannt, deshalb DecimalType
    var Double valueCalc = (SE2K_M_AC_VA_C.state as DecimalType).doubleValue / (SE2K_M_AC_Voltage_CN.state as QuantityType<ElectricPotential>).doubleValue
    if ((SE2K_M_AC_Power_C.state as QuantityType<Power>).doubleValue < 0.0) {
        valueCalc = -1.0 * valueCalc
    } 
    SE2K_M_AC_Current_C_calc.postUpdate(valueCalc)
end

rule SE2K_M_AC_Voltage_LN_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Voltage_LN_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Voltage_LN - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Voltage_LN_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Voltage_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Voltage_LN_int.state.toString + ', SF: 10^' + SE2K_M_AC_Voltage_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Voltage_LN.postUpdate(result)
end

rule SE2K_M_AC_Voltage_AN_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Voltage_AN_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Voltage_AN - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Voltage_AN_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Voltage_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Voltage_AN_int.state.toString + ', SF: 10^' + SE2K_M_AC_Voltage_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Voltage_AN.postUpdate(result)
end

rule SE2K_M_AC_Voltage_BN_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Voltage_BN_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Voltage_BN - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Voltage_BN_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Voltage_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Voltage_BN_int.state.toString + ', SF: 10^' + SE2K_M_AC_Voltage_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Voltage_BN.postUpdate(result)
end

rule SE2K_M_AC_Voltage_CN_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Voltage_CN_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Voltage_CN - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Voltage_CN_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Voltage_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Voltage_CN_int.state.toString + ', SF: 10^' + SE2K_M_AC_Voltage_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Voltage_CN.postUpdate(result)
end

/*rule SE2K_M_AC_Voltage_LL_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Voltage_LL_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Voltage_LL - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Voltage_LL_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Voltage_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Voltage_LL_int.state.toString + ', SF: 10^' + SE2K_M_AC_Voltage_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Voltage_LL.postUpdate(result)
end*/

/*rule SE2K_M_AC_Voltage_AB_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Voltage_AB_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Voltage_AB - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Voltage_AB_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Voltage_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Voltage_AB_int.state.toString + ', SF: 10^' + SE2K_M_AC_Voltage_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Voltage_AB.postUpdate(result)
end*/

/*rule SE2K_M_AC_Voltage_BC_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Voltage_BC_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Voltage_BC - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Voltage_BC_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Voltage_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Voltage_BC_int.state.toString + ', SF: 10^' + SE2K_M_AC_Voltage_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Voltage_BC.postUpdate(result)
end*/

/*rule SE2K_M_AC_Voltage_CA_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Voltage_CA_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Voltage_CA - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Voltage_CA_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Voltage_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Voltage_CA_int.state.toString + ', SF: 10^' + SE2K_M_AC_Voltage_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Voltage_CA.postUpdate(result)
end*/

rule SE2K_M_AC_Freq_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Freq_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Freq - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Freq_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Freq_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Freq_int.state.toString + ', SF: 10^' + SE2K_M_AC_Freq_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Freq.postUpdate(result)
end

rule SE2K_M_AC_Power_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Power_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Power - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Power_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Power_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    // Achtung: Das SolarEdge-Meter bewertet exportierten Strom positiv 
    //          -> anders als alle anderen Darstellungen, deshalb Multiplikation mit -1.0
    var Double result = -1.0 * intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Power_int.state.toString + ', SF: 10^' + SE2K_M_AC_Power_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Power.postUpdate(result)
end

rule SE2K_M_AC_Power_A_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Power_A_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Power_A - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Power_A_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Power_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    // Achtung: Das SolarEdge-Meter bewertet exportierten Strom positiv 
    //          -> anders als alle anderen Darstellungen, deshalb Multiplikation mit -1.0
    var Double result = -1.0 * intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Power_A_int.state.toString + ', SF: 10^' + SE2K_M_AC_Power_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Power_A.postUpdate(result)
end

rule SE2K_M_AC_Power_B_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Power_B_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Power_B - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Power_B_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Power_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    // Achtung: Das SolarEdge-Meter bewertet exportierten Strom positiv 
    //          -> anders als alle anderen Darstellungen, deshalb Multiplikation mit -1.0
    var Double result = -1.0 * intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Power_B_int.state.toString + ', SF: 10^' + SE2K_M_AC_Power_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Power_B.postUpdate(result)
end

rule SE2K_M_AC_Power_C_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_Power_C_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_Power_C - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_Power_C_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_Power_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    // Achtung: Das SolarEdge-Meter bewertet exportierten Strom positiv 
    //          -> anders als alle anderen Darstellungen, deshalb Multiplikation mit -1.0
    var Double result = -1.0 * intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_Power_C_int.state.toString + ', SF: 10^' + SE2K_M_AC_Power_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_Power_C.postUpdate(result)
end

rule SE2K_M_AC_VA_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_VA_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_VA - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_VA_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_VA_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_VA_int.state.toString + ', SF: 10^' + SE2K_M_AC_VA_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_VA.postUpdate(result)
end

rule SE2K_M_AC_VA_A_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_VA_A_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_VA_A - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_VA_A_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_VA_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_VA_A_int.state.toString + ', SF: 10^' + SE2K_M_AC_VA_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_VA_A.postUpdate(result)
end

rule SE2K_M_AC_VA_B_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_VA_B_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_VA_B - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_VA_B_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_VA_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_VA_B_int.state.toString + ', SF: 10^' + SE2K_M_AC_VA_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_VA_B.postUpdate(result)
end

rule SE2K_M_AC_VA_C_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_VA_C_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_VA_C - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_VA_C_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_VA_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_VA_C_int.state.toString + ', SF: 10^' + SE2K_M_AC_VA_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_VA_C.postUpdate(result)
end

/*rule SE2K_M_AC_VAR_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_VAR_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_VAR - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_VAR_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_VAR_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_VAR_int.state.toString + ', SF: 10^' + SE2K_M_AC_VAR_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_VAR.postUpdate(result)
end*/

/*rule SE2K_M_AC_VAR_A_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_VAR_A_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_VAR_A - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_VAR_A_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_VAR_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_VAR_A_int.state.toString + ', SF: 10^' + SE2K_M_AC_VAR_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_VAR_A.postUpdate(result)
end*/

/*rule SE2K_M_AC_VAR_B_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_VAR_B_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_VAR_B - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_VAR_B_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_VAR_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_VAR_B_int.state.toString + ', SF: 10^' + SE2K_M_AC_VAR_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_VAR_B.postUpdate(result)
end*/

/*rule SE2K_M_AC_VAR_C_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_VAR_C_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_VAR_C - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_VAR_C_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_VAR_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_VAR_C_int.state.toString + ', SF: 10^' + SE2K_M_AC_VAR_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_VAR_C.postUpdate(result)
end*/

rule SE2K_M_AC_PF_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_PF_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_PF - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_PF_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_PF_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_PF_int.state.toString + ', SF: 10^' + SE2K_M_AC_PF_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_PF.postUpdate(result)
end

rule SE2K_M_AC_PF_A_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_PF_A_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_PF_A - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_PF_A_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_PF_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_PF_A_int.state.toString + ', SF: 10^' + SE2K_M_AC_PF_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_PF_A.postUpdate(result)
end

rule SE2K_M_AC_PF_B_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_PF_B_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_PF_B - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_PF_B_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_PF_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_PF_B_int.state.toString + ', SF: 10^' + SE2K_M_AC_PF_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_PF_B.postUpdate(result)
end

rule SE2K_M_AC_PF_C_Scaling
when 
    Item SE2KM_ScaleAll changed to ON or
    Item SE2K_M_AC_PF_C_int changed
then
    Thread::sleep(100)						// Let modbus finish reading all registers
    val String logPrefix = 'SolarEdge Werteskalierung - SE2K_M_AC_PF_C - '

    // Wert normieren
    var Double intValue = (SE2K_M_AC_PF_C_int.state as DecimalType).doubleValue
    if (intValue > 32767) intValue = intValue - (65536).doubleValue

    // Skalierungsfaktor normieren
    var Double scalingFactor = (SE2K_M_AC_PF_SF_int.state as DecimalType).doubleValue
    if (scalingFactor > 32767) scalingFactor = scalingFactor - (65536).doubleValue

    // Wert skalieren
    var Double result = intValue * Math::pow(10,scalingFactor)

    // Float-Wert schreiben
    if (EnableLog_SolarEdgeRules.state == ON) logInfo('solaredge.rules', logPrefix + 'Rohwert: ' + SE2K_M_AC_PF_C_int.state.toString + ', SF: 10^' + SE2K_M_AC_PF_SF_int.state.toString + '; skaliert: ' + result.toString)
    SE2K_M_AC_PF_C.postUpdate(result)
end
1 Like