[SOLVED] Core Temp tcp server

hello all! first post so hope to do it right

enviroment:
OpenHab 2.5.0.M5
Wyse Z90S7 ThinClient with AMD G-T52R processor 1.5GHz/4GB DDR3/120GB SSD
Windows 7 Pro SP1 x64 with zulu8.28.0.1-jdk8.0.163-win_x64

SystemInfo binding works with some channels (like memory#usedPercent, storage#usedPercent) but not with sensor#cpuTemp and cpu#load1 which are vital for me. Tried all I could think of but couldn’t get aything else than -NaN as a value

Thought to bypass the problem by using Core Temp 1.15.1 (alcpu.com/CoreTemp) with Core Temp Remote Server plugin which runs on port 5200 and periodically outputs a JSON structure with all infos, like if i type localhost:5200 in a web browser I get a window with increasing number of telegrams like:

{"CpuInfo":{"uiLoad":[3],"uiTjMax":[100],"uiCoreCnt":1,"uiCPUCnt":1,"fTemp":[35.5],"fVID":1.3499999,"fCPUSpeed":1496.36707,"fFSBSpeed":99.7578049,"fMultiplier":15,"CPUName":"AMD G-T52R (Zacate) ","ucFahrenheit":0,"ucDeltaToTjMax":0,"ucTdpSupported":1,"ucPowerSupported":0,"uiStructVersion":2,"uiTdp":[9],"fPower":[0],"fMultipliers":[15]},"MemoryInfo":{"TotalPhys":3685,"FreePhys":1603,"TotalPage":7368,"FreePage":5075,"TotalVirtual":8388608,"FreeVirtual":8388014,"FreeExtendedVirtual":1,"MemoryLoad":56}}

I installed TCP/UDP binding and JSONPATH transformation and tried this items config with no success:

String CoreTemp_temperature "CPU Temp [%s]" { tcp="<[127.0.0.1:5200:JSONPATH($.CpuInfo.fTemp)]" }

or

Number CoreTemp_temperature "CPU Temp [%.1f °C]" { tcp="<[127.0.0.1:5200:JSONPATH($.CpuInfo.fTemp)]" }

In events.log all I can find is “Item ‘CoreTemp_temperature’ has been updated.”

Running out of ideas of where I could go wrong or what else to try… Any help would be appreciated with either the SystemInfo binding or the Core Temp approach.

Here is your clue I think
If you can see it in the web browser you’ll need to http binding

The binding does not support cputemp anymore because the underlying library doesn’t support it anymore

I would try using the http binding or go down the node-red route

tried http binding first with

String CoreTemp_temperature "CPU Temp" { http="<[http://192.168.0.238:5200/:1000:JSONPATH($.CpuInfo.fTemp)]" }

or using http.cfg with

CoreTempJSON.url=http://192.168.0.238:5200/
CoreTempJSON.updateInterval=1000

and then

String CoreTemp_temperature "CPU Temp" { http="<[CoreTempJSON:1000:JSONPATH($.CpuInfo.fTemp)]" }

but same result… nothing happens and no relevant traces in logs

can you please detail what is the code-red route? thanks

node-red
https://nodered.org/

maybe it’s just me but sound like big overkill to install yet another piece of software (node.js + node-red) just for the simple functionality of getting the cpu temp and load. I’m pretty sure I’m not asking for too much to have this functionality of HTTP get working inside openHAB

I did some sniffinq with wireshark and that’s what I got

I found on the forum another approach of sending a GET http command in rules, so I created:

var String response
var String temperature

rule "Read Core Temperature values"
when
	Time cron "0/10 * * * * ?"
then
	response = sendHttpGetRequest("http://192.168.0.238:5200/")
	temperature = transform("JSONPATH", "$.CpuInfo.fTemp", response)

	CoreTemp_temperature.postUpdate(temperature)
end

sadly this also fails with log entries:

[ERROR] [.smarthome.model.script.actions.HTTP] - Fatal transport error: java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: bad response on HttpConnectionOverHTTP@202af766::SocketChannelEndPoint@6abd00ca{/192.168.0.238:5200<->/192.168.0.238:54337,OPEN,fill=-,flush=-,to=0/0}{io=0/0,kio=0,kro=1}->HttpConnectionOverHTTP@202af766(l:/192.168.0.238:54337 <-> r:/192.168.0.238:5200,closed=false)=>HttpChannelOverHTTP@7cc6883c(exchange=HttpExchange@7fcba7bd req=TERMINATED/null@null res=PENDING/null@null)[send=HttpSenderOverHTTP@55067e(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator@2ecfdee{s=START}],recv=HttpReceiverOverHTTP@4aa302e7(rsp=IDLE,failure=null)[HttpParser{s=CLOSE,0 of -1}]]
1 Like

That seems important, like missing a security step or something.

ok, so, in the end, for what it’s worth, there’s a happy ending to all this:

  • @vzorglub orglub was saying that Systeminfo “binding does not support cputemp anymore because the underlying library doesn’t support it anymore”. I tend not to agree with this statement as after I switched openhab from an administrator account to THE administrator account, temperature info came up just fine. Still no CPU load though
  • on the other hand I had another way to get cpu temperature through Open Hardware Monitor WMI support, called from a batch file (WMIC command+additional parsing) by the EXEC binding
  • CPU load I got through another WMIC batch command (wmic cpu get loadpercentage)

I can’t say I find this optimal as WMIC polls do create a little load but at least it works