Getting data from homeassistant in .csv format

Hi,
Im new in homeassistant, Im using virtual enviroment on Windows 10.
Is it possible to get data from homeassistant in .csv format? How can I get them?

Sure you write to a csv file with a file notification service. e.g:

notify:
  - platform: file
    name: energy_log
    filename: /config/www/csv_logs/energy_log.csv
    timestamp: false

And in an automation’s actions:

  - service: notify.energy_log
    data_template:
      message: "{{ states('sensor.date') }},{{ states('sensor.energy_t31_light_and_power_day') }},{{ states('sensor.energy_t31_light_and_power_night') }},{{ states('sensor.energy_t31_light_and_power_total') }},{{ states('sensor.energy_t41_heating_day') }},{{ states('sensor.energy_t41_heating_night') }},{{ states('sensor.energy_t41_heating_total') }},{{ states('sensor.total_energy_day') }},{{ states('sensor.total_energy_night') }},{{ states('sensor.total_energy') }},{{ state_attr('sensor.power_stats','min_value') }},{{ state_attr('sensor.power_stats','max_value') }},{{ states('sensor.power_stats') }},{{ states('sensor.total_cost_today') }}"

Gives this sort of file content:

Home Assistant notifications (Log started: 2019-10-15T12:59:50.138638+00:00)
--------------------------------------------------------------------------------
2019-10-15,8.623,7.079,15.702,9.666,2.346,12.012,18.289,9.425,27.714,257.8,6057.6,1296.2,7.48
2019-10-16,5.658,8.290,13.948,6.380,1.645,8.025,12.038,9.935,21.973,256.0,5228.7,887.5,6.31
1 Like

Thanks tom_I! helped me out a lot after a fair bit of head scratching!!