Johanbos / home-assistant-import

Home Assisant Import

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Home Assistant Import with SQL scripts

Hi, welcome to my attempt at importing data into Home Assistant. The Goal is to import data from

  • Domoticz with P1/DMSR data (Version: 2020.2 (build 12497) Build Hash: c8f1e167e-modified)
  • SMA Inverter with Solar production data (version unknown)

At this point the import tool is usable, but you have to be somethat of a techy to get the options right. This is not an add-on, but a tool that's creates SQL scripts that import data into Home Assistant.

CI

image
I could look at these charts like.. forever ❤️

How to start importing

  1. This tool relies fully on the Home Assistant Community Add-on: SQLite Web. You need to have this installed and know a bit about SQL-queries before continuing.

  2. There is also a thread on the home-assistant community about importing history.

  3. ALWAYS create a backup before experimenting.

  4. Download a release for linux or windows, unzip and (for Windows) run Home Assistant Import.exe. There is no need to compile the code yourself.

image

  1. After starting the application some warnings may appear, because the application is not 'signed'. I have no certificate at the moment. If you trust the application, is up to you. On Windows click 'more info' and the 'Run Anyway'.

image

  1. Follow the steps in the application. Any red text indicates an error and means it will take more time to find out why this is happening.

Importing Domoticz Meter & Multimeter values

Any Meter & Multimeter values can be imported from Domoticz database file. Export the database directly from the dashboard.

image

Importing SMA CSV

A specific configuration of the SMA CVS file is supported at this moment. Follow the tools instructions to create an import script. You can get your export from your SMA webportal. Carefully select the starting date, as the export may give random values if the unit had no values.

image

SMA CSV specifications

SMA has a pretty bespoke specification, so in deviceSma.js a lot or lines are being skipped and it has a custom dateformat. Only first two columns matter, the date and TotWhOut.

sep=,
Version CSV3|Tool WebUI|Linebreaks CR/LF|Delimiter comma

,SN: 1234567890,SN: 1234567890,SN: 1234567890,SN: 1234567890
,SUNNY TRIPOWER 4.0,SUNNY TRIPOWER 4.0,SUNNY TRIPOWER 4.0,SUNNY TRIPOWER 4.0
,1234567890,1234567890,1234567890,1234567890
,Metering.TotWhOut,Metering.GridMs.TotWhOut,Metering.GridMs.TotWhIn,TotVal.TotCsmp
,Analog,Analog,Analog,Analog
DD.MM.YYYY hh:mm:ss,[Wh],[Wh],[Wh],[Wh]
13.09.2019 02:00:00,0,0,0,NaN
14.09.2019 02:00:00,14450,0,0,NaN

Importing generic CSV

A request has been made to create a generic cvs importer. I have not started on this yet. The configurable parts would be:

  • delimiter (if not a comma :D)
  • lines to skip
  • columns to read (date & value)
  • dateformat

Why not an Home Assistant add-on?

Creating an Electron app was on my cool-list. I just needed to try this one out :) I could refactor everything into a Home Assistant add-on. That would make importing history even easier.

About

Home Assisant Import

License:MIT License


Languages

Language:JavaScript 81.1%Language:HTML 17.7%Language:CSS 1.2%