I installed openHAB2 on my windows laptop and I have some problems with the TCP Binding.
For interested people I have a (AVR-NET-IO-Fertigmodul https://www.pollin.de/p/avr-net-io-fertigmodul-810073 ) which I want to control.
And for a Digital Output everything works very well.
I connected it to a switch with the following Item definition:
Now I want to read a Digital Input. I connected a sensor for a door on it.
The command which I have to send is “GETPORT 1” and the answer is “0” or “1”
My question is how can I add the sensor for my door?
I think I have 2 possibilities, a String Item or a Contact Item.
What I tried is:
Item:
String Fensterkontakt "Garage Kontakt %s" {tcp=">[192.168.178.198:50290:'GETPORT 1']"}
Sitemap:
Text item=Fensterkontakt label="test [%s]"
But it doesn’t work.
I tried some other things with a contact or rules but nothing worked
My Rule Idea was:
rule "Garagenkontakt_Andreas"
when
Time cron "* * * ? * *"
then
sendCommand(Fensterkontakt,'GETPORT 1')
end
Did anyone have an Idea what I do wrong?
And if I have luck maybe someone can explain me some other things:
How does the reading for sensors like a door contact work, is there a cycle that it will be read every second or do I need a rule for these kind of function?
How can I update my sitemap? I have a switch with a Rule that switch it of after 1 second ON state, but in my Sitemap (I am using google Chrome) the switch is still on until I press F5 (update). Is that a Openhub2 thing or a Chrome thing?
Unfortunately it doesn’t work. I get back the command ‘GETPORT 1’ not the response as you can see in the picture. . And the fascinating thing is that I get the same result with to different item definitions.
Frame label="Garage" {
Switch item=Garage_Andreas
Text item=Fensterkontakt label="Sensor Andreas [%s]"
Switch item=Garage_Mona
Text item=Fensterkontakt3 label="Sensor Mona [%s]"
}
And the tcp.cfg is:
# all parameters can be applied to both the TCP and UDP binding unless
# specified otherwise
# Port to listen for incoming connections
port=50290
# Cron-like string to reconnect remote ends, e.g for unstable connection or remote ends
#reconnectcron=0 0 0 * * ?
# Interval between reconnection attempts when recovering from a communication error,
# in seconds
retryinterval=5
# Queue data whilst recovering from a connection problem (TCP only)
#queue=true
# Maximum buffer size whilst reading incoming data
buffersize=1024
# Share connections within the Item binding configurations
itemsharedconnections=true
# Share connections between Item binding configurations
bindingsharedconnections=true
# Share connections between inbound and outbound connections
#directionssharedconnections=false
# Allow masks in ip:port addressing, e.g. 192.168.0.1:* etc
addressmask=true
# Pre-amble that will be put in front of data being sent
#preamble=
# Post-amble that will be appended to data being sent
#postamble=\r\n
# Perform all write/read (send/receive) operations in a blocking mode, e.g. the binding
# will wait for a reply from the remote end after data has been sent
#blocking=false
# timeout, in milliseconds, to wait for a reply when initiating a blocking write/read
# operation
#timeout=3000
# Update the status of Items using the response received from the remote end (if the
# remote end sends replies to commands)
updatewithresponse=true
# Timeout - or 'refresh interval', in milliseconds, of the worker thread
refreshinterval=250
# Timeout, in milliseconds, to wait when "Selecting" IO channels ready for communication
#selecttimeout=1000
# Used character set
charset=ASCII
Maybe I need more time between the command and the reading?
Is the any possibility to wait maybe 500ms or do you think the problem is an other?