Restful binary sensor with arduino mega

Hi,

i’m using Home Assistant : 0.83.3
I 'm trying to communicate with arduino mega running arest restful framework and now i can control it using arestful switch or browser but when trying to connect motion sensor to arduino state of sensor changed only using url browser and also command line : ```
$ curl -X GET http://192.168.1.15/digital/11 worked and state changed as below:
{“return_value”: 0, “id”: “008”, “name”: “dapper_drake”, “hardware”: “arduino”, “connected”: true} (no motion)
{“return_value”: 1, “id”: “008”, “name”: “dapper_drake”, “hardware”: “arduino”, “connected”: true} (motion detected)
but in front end the state not changed even if i trying to change it using developer tool it returns back to clear state after couples of seconds i also used command line binary sensor and arestful binary sensor but same problem.
below is myconfiguration.yaml:

binary_sensor:

  • platform: rest
    resource: http://192.168.1.15/digital/11
    method: GET
    name: motion
    device_class: motion
    value_template: ‘{{ value_json.return_value }}’

Thanks.

updates:
after monitoring the state of sensor in front end for couples of minutes some times the state changed and some times not is this a problem of update cycle ? ? ?

any one can help