Newbie in HA

Hi all

I have used a Fibaro HC2 since 2018 and have a quite a lot of experience on numerous platforms since the eighties. Because the HC-series seem to have struck a dead end I decided to set up a HA Green to move all my automations to the new platform.
I want to write some topics on my adventures with the HA. It was/is a steep learning curve with information scattered around, sometimes too detailed to grasp as a newbie.
Therefore my first suggestion now: would it be a good idea to have a “beginners” category?

Hi, your experience can always be helpful and the value for newcomers of it depends on what and how you share it.
It definitely will not hurt anyone and this is a forum where everyone can participate, within the boundaries of the forum rules.

Anything that helps people find their way is helpful. Maybe you also already came across the cookbook, which tries to link to useful topics on all kinds of subjects:

As first step in configuring my HA Green was to load available integrations. The very first was Fibaro because my HC2 was still doing all the work. To my astonishment all its devices and scripts were accessible as if they were local devices. Thank you @rappenze (on Github) for that impressive piece of work. It helped me a lot to make my first automation steps while using data produced by the HC2.
Also important for me was the Homewizard integration as I have several Homewizard devices. All of their daily data were collected with the HC2 into a global json table and then transferred asynchronously to a Windows platform by the ZeroBrane app with a HC2-library. These Homewizard data were collected with their v1 api. For changing Homewizard parameters you need the v2 api which uses authentication. Despite intensive research I never succeeded to use the v2 api on the HC2. Therefore I could not set the battery mode automatically. A big thanks to @dcsbl of Homewizard for this integration that does all the low level v2 api calls and presents all the devices and entities.
The add-ons Samba share, Studio Code Server, Terminal&SSH and Tailscale would prove to be essential, but later on that.
After these steps I observed the system for several weeks while preparing for some scripting in the HA. And the user interface of HA gave me access to Homewizard battery operating modes which are not available in the Homewzard app. A first win situation!

On Youtube I found the channel of @SmartHomeJunkie. He has an example which makes a button (a Helper), an automation which responds to that helper and a script that is executed by that automation. The script sends Hello world to your phone. All the yaml code to be inserted through the user interface is shown in this video.
Although this sounds quite simple, it already makes use of parameters, parameter passing and defaults and therefore is a very rich example.
Having said that, imho yaml is not a real programming language as I know it. And the curly thingies showed to be jinja code that is almost a language in itself. And there is indentation instead of a decent BEGIN and END or whatever you like to build blocks.
The Studio Code Server helped a lot to get insight in the “under water” file data. As I understand it, in earlier days this was the only programming pathway.
The Helpers I cound not find however. Now some unix/irix/linux experince comes in handy. With the Terminal&SSH add-on you can open a shell.
All the user stuff is the directory

/root/config

In this directory there is a (kind of) hidden directory

.storage

which contains a rather large text file core.entity_registry. Do not change this file or any other in this directory, you are not supposed to come to this place anyway! You can peek safely into the file with the “cat” command.

And then there is the quoting. Sometimes you will see jinja code quoted ( “{{ …}” ), and in other places not ( {{…} ). If within your jinja code also quotes are needed there are two ways: use two double quotes ( “” ) or the single quote ( ’ ). I strongly prefer the latter. Anyone who has scripted in some unix shell knows this quote mixing. Example: “{{ states(‘some_entity’) | float }}”. By default all values are text, even when you see a number. To handle it is a number you have to pipe the output through a filter like float, int or bool.

This post is about writing data to a file and how that compares to my experience in the Fibaro HomeCenter 2.
I care a lot about my carbon footprint and therefore have been gathering daily consumption data since early 2023. The Homewizard v1 api offers an easy access on the local network. My Fibaro HC2 was the perfect tool for it, although this kind of communication is definitely advanced programming on that platform. In the Fibaro setup a global json table was maintained with also programmed purging to limit the size. This table was accessed by an application on my Windows system where new found lines in the table were added to a file.
So this had to become my first automation on HA. Only after a lot internet research I discovered the file integration. As all *nix i/o is file based I was a bit surprised that it needed this extra integration. I created a new directory “/share”. You can do that with the Studio Code Server or the Terminal&SSH add-on. Within this new directory I created an empty file “daily_state.txt”. You also have to expose this path in the configuration.yaml:

homeassitant:
  allowlist_external_dirs:
    - /share

Only after I made these choices I read some warnings on the internet that “/share” had already some reserved objective, but it was not existent on the HA Green.
To create an easy pathway to my Windows platforms I installed also the Samba share add-on.
With file integration you can now create a file-based sensor. All this seems complicated but is little work. Setting up the Samba share is the most complicated part. Just read the documentation carefully.
Mentally fully prepared to attack the HA with full-blown scripting it was astonishing simple. Create an automation with a fixed time-based trigger. No further condions are needed. As action I choose to run a small script. You can find a lot of examples for this kind of simple scripts. You can also enter the script in the scripting tab. New script, action: send a notification message, select the file target. The only hard part is now to write a template. To comply with my already existent data stream I wanted lines startig with a unix timestamp and then followed by a series of data, all seperated with tabs or in plain code “\t”. After completion it will appear in the scripts.yaml. Or when you introduce it in the scripts.yaml, you will find it also in the scripts tab.

notification_write_daily_state:
  sequence:
  - target:
      entity_id: notify.share_file_daily_state
    data:
      message: "{{ as_timestamp(now(),0)|round + 3600}}\t{{ states('sensor.p1_meter_energy_import')|float}}\t{{
        states('sensor.p1_meter_energy_export')|float}}\t{{ states('sensor.batterei_energy_import')|float}}\t{{
        states('sensor.batterei_energy_export')|float}}\t{{ states('sensor.gas_meter_gas')|float}}\t{{
        states('sensor.gemiddelde_daktemperatuur')|float }}\t{{ states('sensor.gemiddelde_kamertemperatuur')|float
        }}\t{{ states('sensor.gemiddelde_cv_temperatuur')|float }}\t{{ states('sensor.watermeter_total_water_usage')|float}}"
    action: notify.send_message
  alias: 'Notification: write data to file'

Some notes:
For my local region I had to add 3600 second to the HA timestamp which is utc-based. For some reason timestamps on my Fibaro HC2 were already for the local timezone.
The as_local filter converts now() to local time but that fails as input for the as_timestamp(). The addition of 1 hour is the quick fix.
For this post I tried in the automation to set op a notify action, but I could not configure that to the same result. Mayby I’m missing here something.
Open for all comments, but I was relieved that all the real programming was reduced to one single, albeit long, jinja statement.
In the development tools you can find a template tab. There you can experiment with the jinja statement until it works and is to you likings.

Hi, as a “dedicated” Beginner i assume You want your tips and recommendations easy “Searchable”
Im Sure that a “newbie” wouldn’t Use i.e “Newbie” in hos search “words/line”

And then you continue under this " Topic Header “, With “Post’s” about with various integrations/, templates, automationns etc. etc., in 1 (eventually) Huge Topic for which there are specified Topics about.(but no links to further"i.e your searches in the matter”)

Im not Sure which category your Topic belongs to, could be as mentioned as above “The CookBook” or more precise “The Community Guides section” (Which actually could be “renamed” to something more distinct “Community Help/Howto/Solution Guides section”

Until “this” matter is solved, i recommend you to Write Posts, with a clear distinct description(of the content, experience) in first line of every Post

As of now it’s just a huge line of Post, which are VERY difficult to distinct and not even a Search-In-This-Topic would be easy for a “Newbie”, (i.e) HC2 is mention in most(3 Of your Posts), with no apparent “red line”

As a “Newbie” You might “differ” from most Newbies, do to the fact many newbies seems to have “problems” with their ability to “search and read” in a structured manner, their patience also makes them “skip the reading of long Topics/Posts” , and simply open a Topic them self, in the hope someone “Steps in” and provide a solution for them

Because they actually don’t wanna read “rTFM” or any other helpful experiences, but rather want/need a short structured description to “solve/help” them with their “Issue”

Take Help of i.e The CookBook, and other Topics, to structure up This your Topic

And use i.e “Post Headers”
Fibaro HC2 - Simple Automation / Notification-Automation :slight_smile:

This way would the “Posts” be more “prone” to end up in a search, if another newbie would go this way , and this Topic would be easy to search/scroll in !
( Remember “some/many” people have little or no patience in either Searching OR Scrolling ) nor more in reading long Posts

2 Likes