Home Assistant 2 Excel

Getting Started

Usage is super simple.

  1. Install homeassistant2xlsx

    pip3 install homeassistant2xlsx
    
  2. Create a Excel Workbook with any number of sheets. Add any Home Assistant entity name as comment of the first row, sensor.gas for example. Home Assistant stores entities as string by default. Optionally, append |int or |float for a corresponding conversion. sensor.gas|int or sensor.gas|float for example.

    _images/spreadsheet1.png

    The comments (aka entity names) date, time or datetime provide the corresponding timestamps.

  3. Go to your Home Assistant instance and create a Long-Live API Token.

  4. Run homeassistant2xlsx

    homeassistant2xlsx --host localhost --token YOUR_API_TOKEN  my.xlsx
    

Command Line Interface

usage: homeassistant2xls [-h] [--token TOKEN] [--host HOST] [--port PORT]
                         [--timeoffset TIMEOFFSET] [--version]
                         xlsx

Copy Data From Home-Assistant to XLSX files

positional arguments:
  xlsx

optional arguments:
  -h, --help            show this help message and exit
  --token TOKEN         Home Assistant API Token. Mandatory.
  --host HOST           Home Assistant Port. 'localhost' by default.
  --port PORT           Home Assistant Port. '8123' by default.
  --timeoffset TIMEOFFSET
                        Timestamp offset in minutes. Positive and negative
                        numbers are allowed.
  --version             show program's version number and exit

Programming Interface

Add Home Assistant Data to Excel.

homeassistant2xlsx.main(args=None)[source]

Command Line Interface.

homeassistant2xlsx.run(xlsxpath: Path, host: str, port: str, token: str, timestamp: datetime)[source]

Run.

Parameters:

xlsxpath – Path to XLSX file

Keyword Arguments:
  • host – Home Assistant Host

  • port – Home Assistant Port

  • token – Home Assistant Token

  • timestamp – Data Timestamp.