FTP server sensor

Hi guys, wondering if someone could help me create a sensor that identifies if the FTP addon (HASSIO) is running or not? I’d like a quick visual cue on my front-end to let me know that the FTP server is running or not. Bonus points if it’s possible to add a script to turn on/off the addon!
Thanks in advance

Would be very possible using AppDaemon but will require some light coding and standing up your AppDaemon environment.

Sensor:

Switch:

https://github.com/SilvrrGIT/HomeAssistant/blob/master/switches.yaml

1 Like

Thanks for this. Unfortaunely I can’t seem to get it to work. I just get an ‘Unknown’ state for my sensor.
Here is what I have:

- platform: rest
  resource: http://192.***.***.***:8123/hassio/addon/core_samba
  name: Samba
  value_template: '{{ value_json.data.state }}'
  scan_interval: 5
  verify_ssl: false
  headers:
    Authorization: !secret llt
    Content-Type: application/json

The resource is the url I see in the browser when on the addon page. Is this how it should be?
My Authorization secret is in the form “Bearer KEY”, have tried with and without quotations.

Any suggestions?

Any errors in the log?

Yes, sorry should have posted that as well:

Error fetching data: <PreparedRequest [GET]> from http://192.***.***.***:8123/hassio/addon/core_samba failed with HTTPConnectionPool(host='192.***.***.***', port=8123): Max retries exceeded with url: /hassio/addon/core_samba (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x72364210>: Failed to establish a new connection: [Errno 111] Connection refused'))

The Connection refused part leads me to suspect there is a problem with the authentification?

in your secrets .yaml do you have

llt: Bearer 12345678910

Have you double checked the token? Also, at startup it may error but the state will be available after everything is up and running.

Yep I have that in my secrets.yaml
I created a new token again and put it directly into my sensors.yaml file and had the same result.
Ah ok, I will give it a bit of time and see if anything changes. Thanks

Ill try to remember to look at my secrets file later, I seem to recall that it was either quotes or the capitalization of bearer that was the trick.

Ok my secrets.yaml file has

llt: "Bearer 12345678910"