whats wrong in this script?
Moderator: leecollings
-
- Posts: 287
- Joined: Sunday 09 October 2016 20:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Nederland
- Contact:
whats wrong in this script?
im a noob at scripting but this is a atempt
to add my total enphase produced energy with solaredge produced energy
but keep getting errors:
2024-04-14 08:14:00.479 Error: dzVents: Error: (3.1.7) Method updateCustomSensor is not available for device "Opbrengst" (deviceType=General, deviceSubType=kWh).
this was my atempt:
return {
on = { timer = { "every 1 minutes" }}, -- Change to your liking to 1,2,3,4,5,6,10,12,15 or 20
execute = function(dz, item)
local Opbrengst = dz.devices(1813)
local Enphase = dz.devices("Enphase Panelen - total").counterToday
local Solaredge = dz.devices("OpbrengstTotaal").counterToday
Opbrengst.updateCustomSensor(dz.utils.round(Enphase + Solaredge,2)) -- Rounded to two decimals
end
}
"Opbrengst"=dummy device
"Enphase Panelen - Total=enphase total energy device
"OpbrengstTotaal= solaredge total energy device
whats wrong?
to add my total enphase produced energy with solaredge produced energy
but keep getting errors:
2024-04-14 08:14:00.479 Error: dzVents: Error: (3.1.7) Method updateCustomSensor is not available for device "Opbrengst" (deviceType=General, deviceSubType=kWh).
this was my atempt:
return {
on = { timer = { "every 1 minutes" }}, -- Change to your liking to 1,2,3,4,5,6,10,12,15 or 20
execute = function(dz, item)
local Opbrengst = dz.devices(1813)
local Enphase = dz.devices("Enphase Panelen - total").counterToday
local Solaredge = dz.devices("OpbrengstTotaal").counterToday
Opbrengst.updateCustomSensor(dz.utils.round(Enphase + Solaredge,2)) -- Rounded to two decimals
end
}
"Opbrengst"=dummy device
"Enphase Panelen - Total=enphase total energy device
"OpbrengstTotaal= solaredge total energy device
whats wrong?
- habahabahaba
- Posts: 233
- Joined: Saturday 18 March 2023 14:44
- Target OS: Windows
- Domoticz version: 2024.4
- Contact:
-
- Posts: 287
- Joined: Sunday 09 October 2016 20:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Nederland
- Contact:
Re: whats wrong in this script?
Thanks for your help
But where and how to place that in the script?
But where and how to place that in the script?
- habahabahaba
- Posts: 233
- Joined: Saturday 18 March 2023 14:44
- Target OS: Windows
- Domoticz version: 2024.4
- Contact:
Re: whats wrong in this script?
Opbrengst.updateElectricity(power, energy) instead of Opbrengst.updateCustomSensor(value)
-
- Posts: 287
- Joined: Sunday 09 October 2016 20:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Nederland
- Contact:
Re: whats wrong in this script?
its still not working now i get this error :
atempt to call a table value
atempt to call a table value
- habahabahaba
- Posts: 233
- Joined: Saturday 18 March 2023 14:44
- Target OS: Windows
- Domoticz version: 2024.4
- Contact:
Re: whats wrong in this script?
You have to realy know the type/subtype of your sensor (setup -> Devices page) to choose the right method of updating.
-
- Posts: 287
- Joined: Sunday 09 October 2016 20:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Nederland
- Contact:
Re: whats wrong in this script?
Opbrengst device is type is general subtype kwh
The value in the device is correct but it needs to be kw instead of watt
The value in the device is correct but it needs to be kw instead of watt
Last edited by edwin1234 on Sunday 14 April 2024 17:30, edited 1 time in total.
- RonkA
- Posts: 115
- Joined: Tuesday 14 June 2022 12:57
- Target OS: NAS (Synology & others)
- Domoticz version: 2025.1
- Location: Harlingen
- Contact:
Re: whats wrong in this script?
Is this something for you?
I cannot remember why but in a script of mine this works for me..
Code: Select all
return {
on = { timer = { "every 1 minutes" }}, -- Change to your liking to 1,2,3,4,5,6,10,12,15 or 20
execute = function(dz, item)
local Opbrengst = dz.devices(1813) -- should be a dummy type: General - kWh
local Enphase = dz.devices("Enphase Panelen - total").counterToday
local Solaredge = dz.devices("OpbrengstTotaal").counterToday
local OpbrengstValue = Enphase + Solaredge
local OpbrengstValueRound = tonumber(domoticz.utils.round(OpbrengstValue,2)) -- Rounded to two decimals
domoticz.devices(Opbrengst).updateElectricity(OpbrengstValueRound, OpbrengstValue)
end
}
SolarEdge ModbusTCP - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
Work in progress = Life in general..
-
- Posts: 287
- Joined: Sunday 09 October 2016 20:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Nederland
- Contact:
Re: whats wrong in this script?
Thanks
I will try it
Is in your device the value in kw?
Your script doesnt work
Gives errors
I will try it
Is in your device the value in kw?
Your script doesnt work
Gives errors
- RonkA
- Posts: 115
- Joined: Tuesday 14 June 2022 12:57
- Target OS: NAS (Synology & others)
- Domoticz version: 2025.1
- Location: Harlingen
- Contact:
Re: whats wrong in this script?
No its a counter to see how much power my Quooker uses in Kw, so i divide the calculated value by 1000 to get the correct value for 'energy'
Hmm.. maybe you have to divide OpbrengstValue by 1.000.000 to get the correct 'kWh' to display..
But you will soon enough if the values are correct on your setup.
-EDIT-
my bad; The device shows watts and kWh; the energy part is in watt (like habahabahaba states)
Hmm.. maybe you have to divide OpbrengstValue by 1.000.000 to get the correct 'kWh' to display..
But you will soon enough if the values are correct on your setup.
-EDIT-
my bad; The device shows watts and kWh; the energy part is in watt (like habahabahaba states)
Code: Select all
local OpbrengstValue = Enphase + Solaredge / 1000
Last edited by RonkA on Sunday 14 April 2024 19:28, edited 1 time in total.
SolarEdge ModbusTCP - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
Work in progress = Life in general..
-
- Posts: 287
- Joined: Sunday 09 October 2016 20:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Nederland
- Contact:
Re: whats wrong in this script?
Ok thanks
How do you divide the value of “Opbrengst” by 1000 in the script?
How do you divide the value of “Opbrengst” by 1000 in the script?
- habahabahaba
- Posts: 233
- Joined: Saturday 18 March 2023 14:44
- Target OS: Windows
- Domoticz version: 2024.4
- Contact:
-
- Posts: 287
- Joined: Sunday 09 October 2016 20:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Nederland
- Contact:
Re: whats wrong in this script?
Thanks for your help
I did *1000 so now i have 19.500,00watt
In stead of 19,5 watt good enough for me.
I did *1000 so now i have 19.500,00watt
In stead of 19,5 watt good enough for me.
- RonkA
- Posts: 115
- Joined: Tuesday 14 June 2022 12:57
- Target OS: NAS (Synology & others)
- Domoticz version: 2025.1
- Location: Harlingen
- Contact:
Re: whats wrong in this script?
set domoticz.utils.round(OpbrengstValue,2) to domoticz.utils.round(OpbrengstValue,0) to loose those extra zero's after comma
SolarEdge ModbusTCP - Kaku - Synology NAS - Watermeter - ESPEasy - DS18b20
Work in progress = Life in general..
Work in progress = Life in general..
-
- Posts: 287
- Joined: Sunday 09 October 2016 20:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2021.1
- Location: Nederland
- Contact:
Re: whats wrong in this script?
Thanks for the reply
Good suggestion i change that.
Good suggestion i change that.
Who is online
Users browsing this forum: No registered users and 1 guest