Creating a Sensor with Data from External Website

I have my own website, with a database of info and I would like to get some data from this database into home assistant.

My ultimate goal would be to have multiple sensors. EG:
Entity: sensor.mywebsite_total_posts
State: 265
Filter Attributes:
friendly_name: Total Post Count
icon: mdi:web

Entity: sensor.mywebsite_subscriber_count
State: 200
Filter Attributes:
friendly_name: Total Subscribers
icon: mdi:web

I am a web developer, so on the web side of things, I can produce anything I want. JSON, a text page or anything else. I can even create a cron to ping home assistant with info.

I am stuck on the home assistant side. I am new to it all, and just need to understand it’s possibilities. Does it retrieve the data? Do I ping it with data? Do I just get it to read the database directly? I just have no idea.

If anyone can point me in the right direction here, that would be awesome.

restful sensor and peel out the json info.

@petro
Thank you. It looks good.
I am setting it up now to test. Thank you for the quick reply.

Ok. That was really easy. Thanks @petro
I got it all up and running in no time.

Just a question, how often does it update? Can I set the time? I can’t see that as an option.

1 Like

Use scan_interval to set the refresh frequency: https://www.home-assistant.io/docs/configuration/platform_options/#scan-interval

1 Like