W&T digital web i/o

Hello out there,

I’ve been using Home Assistant for over 1 year now and I am really happy about it. I would like to thank you all for your advices on other topics, because I read a lot out there. Till now I newer signed up, because I found the solutions, but unfortunately, I got stuck.

I have a pretty old W&T Web I/O device. The newer versions come with Modbus and MQTT support. Mine does not have this. The device is quite simple: I can turn on or off an output or I can read an input. And I do that with http requests:

  1. */outputaccess0?PW=admin&State=OFF => Turns the device off
  2. */outputaccess0?PW=admin&State=ON => Turns the device on
  3. */input0?PW=admin => Returns “input0;OFF” or “input0;ON”
  4. */input?PW=admin => Returns “input;0004” the “0004” is hex code and needs to be transformed to binary: 0000 0000 0000 0100. This means only Input Nr. 3 is ON, all others are off (third digit from the right is 1. The device has 12 inputs.
    *=http://192.168.178.15 (I am only allowed to post 2 links)

My current solution works without inputs and looks like that:

configuration.yaml:

rest_command:
  turn_off_0000:
    url: "http://192.168.178.15/outputaccess0"
    payload: "PW=admin&State=OFF"
    method: POST
  turn_on_0000:
    url: "http://192.168.178.15/outputaccess0"
    payload: "PW=admin&State=ON"
    method: POST
  turn_off_0001:
    url: "http://192.168.178.15/outputaccess1"
    payload: "PW=admin&State=OFF"
    method: POST
  turn_on_0001:
    url: "http://192.168.178.15/outputaccess1"
    payload: "PW=admin&State=ON"
    method: POST
  input_0000:
    url: "http://192.168.178.15/input0?PW=admin"
    method: GET
  input_0001:
    url: "http://192.168.178.15/input1?PW=admin"
    method: GET
  inputs_00:
    url: "http://192.168.178.15/input?PW=admin"
    method: GET

I then created a template switch which is using rest_command.turn_on_0001 on turn on and rest_command.turn_off_0001 on turn off.

This works for switches which only the W&T Web I/O can turn on or off. This is for example my circulation pump for hot water.

In future I also want to turn on/off lights. Lights can also be used with a physical light switch. Therefore I need to read the input to set the state of the template switch. And for that I would like to use the http request 4. (see above) instead of 3. because it catches all 12 inputs in one request.

My first approach is to make an automation which calls a script all 5 second. The script calls the rest_command.inputs_00 and sets a return variable. I need to replace the “input;” with nothing, then I cast it to int:
"{{ value |replace('input;','') |int(base=16,default=0) }}
Now I can read the input values with

“{{ value |bitwise_and(2**x) != 0 }}" then input x is turned on

But here is the thing: I don’t know how to write that and I am wondering if I am on the right track to implement those switches.

I would really appreciate your help and time.

BR, Stefan

I still appreciate the help :slight_smile:

Hi,
I’ve just moved to HA and have 3 “old” WebIOs from W&T and I’m having the same problem. Have you solved it yet?