solar inverter
Moderator: leecollings
-
- Posts: 4
- Joined: Tuesday 07 March 2023 14:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
solar inverter
Hello everyone. I'm new here and my name is Philip.
I have a script to scrape the data from my solar inverters website but how can i send the scraped data to different dummy devices?
Please help. I'm stuck. Thank you
I have a script to scrape the data from my solar inverters website but how can i send the scraped data to different dummy devices?
Please help. I'm stuck. Thank you
- Attachments
-
- 2023-03-07.jpg (274.5 KiB) Viewed 631 times
-
- Posts: 649
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: solar inverter
If you have the various values already in your python program, then you could use JSON calls to get data into the domoticz database for chosen devices.
https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s
If your website shows the data as in your second screen print, you could also use http poller setup in the hardware section to get the data in.
https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s
If your website shows the data as in your second screen print, you could also use http poller setup in the hardware section to get the data in.
-
- Posts: 4
- Joined: Tuesday 07 March 2023 14:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: solar inverter
Hoe geraak ik aan de json url? Is dit via een script in python?
-
- Posts: 4
- Joined: Tuesday 07 March 2023 14:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: solar inverter
How do I get the json url? Is this via a script in python?
- waltervl
- Posts: 5853
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: solar inverter
Here you have a python script that does something like this for an Omnik Inverter.
https://www.domoticz.com/wiki/Omnik_Solar_Inverter
https://www.domoticz.com/wiki/Omnik_Solar_Inverter
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: 4
- Joined: Tuesday 07 March 2023 14:07
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: solar inverter
Thanks but that's not what I'm looking for. I just want an addition to my script to send the result to domoticz and I also have no idea how to get a json url.
- waltervl
- Posts: 5853
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: solar inverter
Thake a look at this example script https://www.domoticz.com/wiki/Python_-_ ... o_PVOutput
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: 649
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: solar inverter
Here is an extract from one of my python programs. It shows you how to assign a json url string to a variable and then how to call that url.
The string created from the combination of two substrings called "baseJSON" and "apiCall" is called with requests.get.
The string created from the combination of two substrings called "baseJSON" and "apiCall" is called with requests.get.
Code: Select all
import requests, json
## Domoticz server
domoticzIP="127.0.0.1" # internal IP address of the Domoticz server.
domoticzPort="8080" # Domoticz port
baseJSON="http://"+domoticzIP+":"+domoticzPort+"/json.htm?" # the base string for any JSON call.
def getPercentageDevice(varIDX):
# function to get the value of a percentage device indicated by the varIDX number
try:
apiCall="type=devices&rid="+str(varIDX)
response = requests.get(baseJSON+apiCall)
responseResult=str(response.json()["status"])
if responseResult=="ERR":
raise Exception
else:
varString=response.json()["result"][0]["Data"]
varValue=float(varString.split("%")[0])
responseResult=True
except:
print("ERROR: unable to retrieve the value of device with IDX ",varIDX)
print("Response was : ",response.json())
responseResult=False
varValue=None
return responseResult,varValue
-
- Posts: 649
- Joined: Saturday 21 September 2019 17:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.1
- Location: The Netherlands
- Contact:
Re: solar inverter
and a similar construct you can then use to update a device. Here is an example for a text device:
Code: Select all
def setTextDevice(textIDX,displayText):
# update the value of a text device and adds an entry to the device log file
try:
if len(displayText)<=200:
urlText=urllib.parse.quote(displayText)
apiCall="type=command¶m=udevice&idx="+str(textIDX)+"&nvalue=0&svalue="+urlText
response=requests.get(baseJSON+apiCall)
responseResult=str(response.json()["status"])
if responseResult=="ERR":
raise Exception
else:
responseResult=True
else:
print("ERROR: displayText too long (max 200 characters).")
raise Exception
except:
print("ERROR: failed to update text device with IDX ",textIDX)
print("Response was : ",response.json())
responseResult=False
return responseResult
Who is online
Users browsing this forum: No registered users and 1 guest