Making SQLite sensor connection to different machine

Hi all,

I’m trying to retrieve a value from an external SQLite DB hosted on a different machine than my Hass server. My Hass server is a VM hosted on Win 10. The SQLite service is on the Win 10 host machine. I tried this configuration:

  - platform: sql
    db_url: \\192.168.1.82\c$\Users\Public\SMAdata\SBFspot.db
    queries:
      - name: "Batteries"
        query: "SELECT ChargeStatus FROM vwCurCharge;"
        column: "ChargeStatus"
        unit_of_measurement: "%"

But of course is not so simple. I’m getting this error:

Couldn't connect using \\192.168.1.82\c$\Users\Public\SMAdata\SBFspot.db DB_URL: Could not parse rfc1738 URL from string '\\192.168.1.82\c$\Users\Public\SMAdata\SBFspot.db'

Any ideas? I’m trying to access the SQLite DB that is hosted on a separate windows machine. I’ve shared the DB folder to EVERYONE on the windows machine.

Try :

db_url: sqlite://user:password@host/dbname

example:

db_url: sqlite://user:[email protected]\c$\Users\Public\SMAdata\SBFspot.db

Works for me on a Rpi (without the windows path style)

Thanks Darkd. From what I understand, we can’t pass credentials for windows share folders like that. But I gave it a go in a few variations and still got the same error. I’ve also shared the folder to the “Everyone” group and with firewall turned off. So Hass should get access without credentials.

Is there a way to check if my Hass server has access to the windows machine in the first place?

Oh actually I just realised it does have access as I’m using MQTT hosted on the Windows machine.