johnpdowling / hassio-addons

repository for my homeassistant addons
MIT License
17 stars 10 forks source link

fff-api #5

Closed ronschaeffer closed 3 years ago

ronschaeffer commented 4 years ago

Thanks for the great add-on. Everything works as expected except that PercentageCompleted value at the /progress endpoint is always zero. For example, while a print job is running:

http://192.168.86.111:5013/192.168.86.32/progress

{"BytesPrinted":"159","BytesTotal":"1000","PercentageCompleted":0}

johnpdowling commented 4 years ago

I didn't write the server, just packaged it into an add-on. For what it's worth, this is how I run my sensor:

- platform: rest name: "3D Print Job" resource: "http://a6b98bcd-fff-api:5000/10.x.y.z/progress" method: GET unit_of_measurement: '%' value_template: "{{ 100|float * value_json.BytesPrinted|float / value_json.BytesTotal|float | round(1) }}" force_update: true