i only can't see the energy used and power used on pvoutput
i have this sctipt in use:
any one who knows how to get these 2 data also in pvoutput.org?
Code: Select all
return {
active = true,
logging = {
--level = domoticz.LOG_DEBUG, -- Uncomment to override the dzVents global logging setting and use debug
marker = 'PVOutput'
},
on = {
timer = {
'every 5 minutes' -- The number of minutes between posts to PVoutput (normal is 5 but when in donation mode it's max 1)
},
httpResponses = { 'triggerPVoutput' }
},
execute = function(domoticz,item)
----------------------------------------------------------------------------------------------------------
-- PVoutput parameters
----------------------------------------------------------------------------------------------------------
local PVoutputApi = 'c550e7568ba649922fd015828f37667bf4xxxxxx8' -- Your PVoutput api key
local PVoutputSystemID = 'xxxxx' -- Your PVoutput System ID
local PVoutputURL = 'http://pvoutput.org/service/r2/addstatus.jsp' -- The URL to the PVoutput Service
----------------------------------------------------------------------------------------------------------
-- Domoticz Sensor parameters
----------------------------------------------------------------------------------------------------------
local tempSensor = 'THB'
local ConsumptionSensor = 'ConsumptionDevice'
domoticz.log('PVOutput script running', domoticz.LOG_DEBUG)
if (item.isTimer) then
local temperature = domoticz.devices(tempSensor).temperature
local Temperature = domoticz.round(temperature,2)
local EnergyConsumption = domoticz.devices(ConsumptionSensor).counterToday*1000 -- v3 in Watt hours
local PowerConsumption = domoticz.devices(ConsumptionSensor).usage -- v4 in Watts
domoticz.log('Temperature is :'..Temperature..' graden', domoticz.LOG_DEBUG)
domoticz.log('EnergyConsumption is :'..EnergyConsumption..' Wh', domoticz.LOG_DEBUG)
domoticz.log('PowerConsumption is :'..PowerConsumption..' watt', domoticz.LOG_DEBUG)
domoticz.log('Call PVOutput url with callback', domoticz.LOG_DEBUG)
-- ASYNC openUrl
domoticz.openURL({
url = PVoutputURL..'?d='..os.date("%Y%m%d")..'&t='..os.date("%H:%M")..'&v3='..EnergyConsumption..'&v4='..PowerConsumption,
method = 'GET',
callback = 'triggerPVoutput',
headers = { ['X-Pvoutput-Apikey'] = PVoutputApi,
['X-Pvoutput-SystemId'] = PVoutputSystemID
}
})
end
if (item.isHTTPResponse) then
domoticz.log('Callback from url requested. Statuscode:'..item.statusCode, domoticz.LOG_DEBUG)
if (item.ok) then
local valid = string.find(item.data, "OK 200: Added Status")
if (valid ~= nil) then
domoticz.log('Response received from PVOutput: '..item.data, domoticz.LOG_DEBUG)
domoticz.log('Current status successfully uploaded to PVoutput.', domoticz.LOG_INFO)
else
domoticz.log('Current status NOT successfully uploaded to PVoutput -> '..item.data, domoticz.LOG_ERROR)
end
else
domoticz.log('Current status NOT successfully uploaded to PVoutput. Statuscode:'..item.statusCode, domoticz.LOG_ERROR)
end
end
end
}