Hi all:
some users have been looking (as myself) for a way to get Solax data into Domoticz. there's some plugins, but also a easy way via Dzvents.
bellow code I use.
Helder Nogueira
Solax data
Moderator: leecollings
-
- Posts: 25
- Joined: Saturday 28 November 2015 12:10
- Target OS: Windows
- Domoticz version:
- Contact:
Re: Solax data
-- Script to retrieve real-time data from a Solax solar inverter and update a Domoticz device
return {
-- Define triggers for the script
on = {
timer = { 'every 2 minutes' },
httpResponses = { 'trigger' }
},
-- Configure logging settings
logging = {
level = domoticz.LOG_INFO,
marker = 'solar-inverter'
},
-- Define the main function of the script
execute = function(domoticz, item)
-- Handle the timer trigger
if item.isTimer then
domoticz.openURL({
url = 'https://www.solaxcloud.com/proxyApp/pro ... xdfgdstgzg',
method = 'GET',
callback = 'trigger'
})
end
-- Handle the HTTP response trigger
if item.isHTTPResponse then
-- Check if the response was successful
if item.ok then
-- Check if the response is in JSON format
if item.isJSON then
-- Extract the relevant data from the response
local inverterData = item.json.result
if inverterData == nil then
-- Log a message indicating failure
domoticz.log('Problemas de comunicação')
domoticz.log(item)
else
-- Update the Domoticz device with the retrieved data
local device = domoticz.devices('Uso Baterias')
device.updateEnergy(inverterData.batPower)
local device = domoticz.devices('Carga baterias')
device.updateText(inverterData.soc.." %")
local device = domoticz.devices('Consumo Casa')
device.updateElectricity(inverterData.acpower)
-- Log a message indicating success
domoticz.log('Data updated successfully', domoticz.LOG_INFO)
end
end
end
end
end
}
return {
-- Define triggers for the script
on = {
timer = { 'every 2 minutes' },
httpResponses = { 'trigger' }
},
-- Configure logging settings
logging = {
level = domoticz.LOG_INFO,
marker = 'solar-inverter'
},
-- Define the main function of the script
execute = function(domoticz, item)
-- Handle the timer trigger
if item.isTimer then
domoticz.openURL({
url = 'https://www.solaxcloud.com/proxyApp/pro ... xdfgdstgzg',
method = 'GET',
callback = 'trigger'
})
end
-- Handle the HTTP response trigger
if item.isHTTPResponse then
-- Check if the response was successful
if item.ok then
-- Check if the response is in JSON format
if item.isJSON then
-- Extract the relevant data from the response
local inverterData = item.json.result
if inverterData == nil then
-- Log a message indicating failure
domoticz.log('Problemas de comunicação')
domoticz.log(item)
else
-- Update the Domoticz device with the retrieved data
local device = domoticz.devices('Uso Baterias')
device.updateEnergy(inverterData.batPower)
local device = domoticz.devices('Carga baterias')
device.updateText(inverterData.soc.." %")
local device = domoticz.devices('Consumo Casa')
device.updateElectricity(inverterData.acpower)
-- Log a message indicating success
domoticz.log('Data updated successfully', domoticz.LOG_INFO)
end
end
end
end
end
}
- waltervl
- Posts: 5846
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Solax data
Thanks, but please edit your post and put your script in code brackets. That makes it much more readable and easier to copy.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 24
- Joined: Friday 06 September 2019 11:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10717
- Contact:
Re: Solax data
Hey hnogueira,
Thanks for that, I am looking to get solax data in domoticz as well without any exotic stuff which needs config and hours... Question is, when I copy the script I have one device from one Inverter correct? Would it be possible to adjust the script to pull let's say 5 or 6 values from 2 or 3 Inverters? Also, I think the Cloud does not deliver values every 2 mins, one would need to read the data from LAN?
thx,
Bert
Thanks for that, I am looking to get solax data in domoticz as well without any exotic stuff which needs config and hours... Question is, when I copy the script I have one device from one Inverter correct? Would it be possible to adjust the script to pull let's say 5 or 6 values from 2 or 3 Inverters? Also, I think the Cloud does not deliver values every 2 mins, one would need to read the data from LAN?
thx,
Bert
- waltervl
- Posts: 5846
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Solax data
Did you check the solax plugin viewtopic.php?t=33872
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 25
- Joined: Saturday 28 November 2015 12:10
- Target OS: Windows
- Domoticz version:
- Contact:
Re: Solax data
Code: Select all
{-- Script to retrieve real-time data from a Solax solar inverter and update a Domoticz device
return {
-- Define triggers for the script
on = {
timer = { 'every 2 minutes' },
httpResponses = { 'trigger' }
},
-- Configure logging settings
logging = {
level = domoticz.LOG_INFO,
marker = 'solar-inverter'
},
-- Define the main function of the script
execute = function(domoticz, item)
-- Handle the timer trigger
if item.isTimer then
domoticz.openURL({
url = 'https://www.solaxcloud.com/proxyApp/pro ... xdfgdstgzg',
method = 'GET',
callback = 'trigger'
})
end
-- Handle the HTTP response trigger
if item.isHTTPResponse then
-- Check if the response was successful
if item.ok then
-- Check if the response is in JSON format
if item.isJSON then
-- Extract the relevant data from the response
local inverterData = item.json.result
if inverterData == nil then
-- Log a message indicating failure
domoticz.log('Problemas de comunicação')
domoticz.log(item)
else
-- Update the Domoticz device with the retrieved data
local device = domoticz.devices('Uso Baterias')
device.updateEnergy(inverterData.batPower)
local device = domoticz.devices('Carga baterias')
device.updateText(inverterData.soc.." %")
local device = domoticz.devices('Consumo Casa')
device.updateElectricity(inverterData.acpower)
-- Log a message indicating success
domoticz.log('Data updated successfully', domoticz.LOG_INFO)
end
end
end
end
end
}
}
-
- Posts: 25
- Joined: Saturday 28 November 2015 12:10
- Target OS: Windows
- Domoticz version:
- Contact:
Re: Solax data
@waltervl, I did and could manage to make it work
-
- Posts: 25
- Joined: Saturday 28 November 2015 12:10
- Target OS: Windows
- Domoticz version:
- Contact:
Re: Solax data
yes, could make it to work
Who is online
Users browsing this forum: No registered users and 1 guest