Tag Archive for: httpie

Read IO-Link sensor info

First of all, you need to check your IO-Link master and sensor to know how to proceed, but in most cases between different manufacturers is quite similar thanks to IO-Link standard.

Let’s check an IM5184 sensor connected to port 2 in a AL1350 master at 192.168.0.20

curl

curl -d '{"code":"request","cid":1,"adr":"/iolinkmaster/port[2]/iolinkdevice/iolreadacyclic","data":{"index":1002,"subindex":1}}' http://192.168.0.20

httpie

http POST 192.168.0.20 code=request cid:=1 adr=iolinkmaster/port[2]/iolinkdevice/iolreadacyclic data:='{"index":1002, "subindex":1}'

This would give us an hexadecimal value ready to use.

HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json
Transfer-Encoding: chunked

{
    "cid": 1,
    "code": 200,
    "data": {
        "value": "00022FE5"
    }
}