Hi,
I am using some KMTronic LAN Ethernet IP 8 channels WEB Relay boards succesfully on 2.5.x. Because the worlds moves on and OH moves with it, I am starting migration to 4.x
I’ve get those cheap things working with the http-binding, but getting the state give me a small headache. I have the impression that it goes wrong when transformation is (not) done. Because of that the items go back to undef after sending the ON or OFF command.
This is the code of the thing :
UID: http:url:KMTronic1
label: KMTronic 8 Relais 1
thingTypeUID: http:url
configuration:
authMode: BASIC
ignoreSSLErrors: false
baseURL: http://hostname/
delay: 1000
stateMethod: POST
refresh: 30
commandMethod: GET
contentType: text/html
timeout: 3000
bufferSize: 2048
channels:
- id: KMTronic-1-2
channelTypeUID: http:switch
label: KMTronic 1 Kanaal 2
description: ""
configuration:
onValue: FF0201
stateContent: XPATH:/response/relay2/text()
offValue: FF0200
stateExtension: status.xml
commandExtension: "%2$s"
stateTransformation: MAP:1ON0OFF.map
- id: KMTronic-1-1
channelTypeUID: http:switch
label: KMTronic 1 Kanaal 1
description: ""
configuration:
onValue: FF0101
stateContent: XPATH:/response/relay1/text()
offValue: FF0100
stateExtension: status.xml
commandExtension: "%2$s"
stateTransformation: MAP:1ON0OFF.map
....
In the .map I’ve used all of these :
key=value
ON="1"
OFF="0"
onValue="1"
offValue="0"
ON=1
OFF=0
onValue=1
offValue=0
=default
In the http log
send (works fine) :
2024-04-18 21:53:59.941 [TRACE] [nding.http.internal.HttpThingHandler] - Sending to 'http://hostname/FF0101': Method = {GET}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.52.v20230823}, Content = {null}
2024-04-18 21:54:00.031 [TRACE] [p.internal.http.HttpResponseListener] - Received from 'http://hostname/FF0101': Code = {200}, Headers = {Connection: close, Cache-Control: no-cache}, Content = {<div>
<font size="5"> Licht Inkom Buiten <span style="color:red">1 </span> </font>
<br />
<br />
<br />
<font size="5"> Licht Inkom Binnen <span style="color:red">0 </span> </font>
<br />
<br />
<br />
<font size="5"> Licht Garage <span style="color:red">0 </span> </font>
<br />
<br />
<br />
<font size="5"> Driewegkraan <span style="color:red">0 </span> </font>
<br />
<br />
<br />
<font size="5"> Vat CV Kraan <span style="color:red">0 </span> </font>
<br />
<br />
<br />
<font size="5"> Thermostaat Berging 0 <span style="color:red">0 </span> </font>
<br />
<br />
<br />
<font size="5"> Schakelaar Pomp Vat <span style="color:red">0 </span> </font>
<br />
<br />
<br />
<font size="5"> Schakelaar Pomp CV <span style="color:red">0 </span> </font>
</div>
<div>
<p hidden>
Status: 1 0 0 0 0 0 0 0
Relay1: Licht Inkom Buiten
Relay2: Licht Inkom Binnen
Relay3: Licht Garage
Relay4: Driewegkraan
Relay5: Vat CV Kraan
Relay6: Thermostaat Berging 0
Relay7: Schakelaar Pomp Vat
Relay8: Schakelaar Pomp CV
</p>
get state :
2024-04-18 21:33:49.899 [TRACE] [ttp.internal.http.RefreshingUrlCache] - Sending to 'http://hostname/status.xml': Method = {POST}, Headers = {Accept-Encoding: gzip, User-Agent: Jetty/9.4.52.v20230823}, Content = {XPATH:/response/relay8/text()}
2024-04-18 21:33:49.927 [TRACE] [p.internal.http.HttpResponseListener] - Received from 'http://hostname/status.xml': Code = {200}, Headers = {Connection: close, Content-Type: text/xml, Cache-Control: no-cache}, Content = {<response>
<relay0>1</relay0>
<relay1>0</relay1>
<relay2>0</relay2>
<relay3>0</relay3>
<relay4>0</relay4>
<relay5>1</relay5>
<relay6>0</relay6>
<relay7>0</relay7>
<relay8>1</relay8>
</response>
there are no errors in other log files.
I never used transformations in 2.5, so I think I am missing something at that level…