Best practice parsing wine cellar data

Hi!

Pretty new to Hassio after making the change from Domoticz so don’t know my way around yet… I am currently looking for a solution getting my wine cellar data from cellartracker.com into Hassio.

What I want to track is:

  • Bottles in my cellar (total amount)
  • Bottles divided per country (% per country)
  • Total value (sum of price)
  • Consumed per month (amount + list of wines)
  • Added per month (amount + list of wines)

Cellartracker offers a csv export (read more here) that I’am planning to use. The CSV file contains the following fields:

CellarTrackerId (not unique); Location; Bin, Size; Price; Purchase Date; Vintage; Wine; Country; Region; Type; BeginConsume; EndConsume

My idea is to create a php script that downloads the CSV once an hour and then updates Hassio.

The first part is really simple but I don’t really know how to get the data in Hassio the best way. I was thinking about MQTT but doesn’t really know how to set up the sensor (?) to be able to display the way I want.

Or can Hassio (or any plugin) read the CSV data directly?

Anyone that can point me in the right direction?

I have a couple of php scripts doing something similar, albeit not wine data.

My php script parses the csv file, and for each value I want publishes the data to an mqtt topic.

Eg publish the number of bottles to wine/total_bottles.

You then setup a mqtt sensor in ha which which listens / subscribes to wine/total_bottles.

There are a few php mqtt libraries around, the simplest I found is bluerhino.

Hi!

Thanks, I’ve come a bit further regarding “static” values that I know only have X amount of values; for example Total number of bottles is always one number.

But e.g. I would also want to show bottles per different countries in a pie chart or bar graph.

In this case I don’t know how many countries I have represented but I know that each line would consist of Country, Number of bottles, % of bottles of all.

Any ideas how to save this?

BR,
Andreas

MQTT auto discovery might help you there! Send your messages as json to make it easier to parse in HA.

This will probably work! Will look into this the following weeks! Thanks!

Got it to work! Here’s the result!

Wow that’s nice! Care to share your code?

Thanks.

I must say, I’m definitely a fan of your wine collection.

Might be time for me to invest in cellar tracker!