Is it possible to create a plugin with data from the webpage of my solar inverter (piko kostal 4.2)
I am interested in DC voltages and AC voltage, and produced power
The webpage looks like this
[code]<!DOCtype HTML PUBLIC “-//W3C//Dtd HTML 4.0 Transitional//EN”>
Your only option is to learn by example. It would help* if you are already a decent programmer. Read code for similar plugins (Weather Underground in your case) and adapt it.
It seems that i might user port 81 also (not http) for the most recent information.
How do i open this port and get data from it ? tcp port 81 not http protocol.
You will need to read up on LUA libraries.
Your initial posted indicated it was HTTP request … if not you can use a socket to read the data.
local host = "192.168.10.100"
local port = 81
local socket = require("socket")
local tcp = socket.tcp()
tcp:settimeout(5)
if (tcp:connect(host, port)) then
...
end
In the weather app i find this part of code. local WEATHER_PATTERN, tmp = string.gsub([[<response>.*
<current_observation>.*<observation_location>.*
<full>(.-)</full>.*
<latitude>(.-)</latitude>.*<longitude>(.-)</longitude>.*</observation_location>.*
<observation_epoch>(%d-)</observation_epoch>.*
<weather>(.*)</weather>.*
<temp_f>(.-)</temp_f>.*<temp_c>(.-)</temp_c>.*
<relative_humidity>(%d-)%%</relative_humidity>.*
<wind_string>(.*)</wind_string>.*<wind_dir>(%a-)</wind_dir>.*<wind_mph>(.-)</wind_mph>.*<wind_kph>(.-)</wind_kph>.*<icon>(.-)</icon>.*
</current_observation>.*
<forecast>.*<simpleforecast><forecastdays><forecastday>.*<period>1</period>
<high><fahrenheit>(.-)</fahrenheit><celsius>(.-)</celsius></high>
<low><fahrenheit>(.-)</fahrenheit><celsius>(.-)</celsius></low>.*
</forecastday>.*<forecastday>.*<period>2</period>.*
]], "%s*", "")
What does (.-) do as i can’t find that on the net. .- can be found but what do the parenthesis add to it ? Capture in stead of replace ?