Integrate Solis S6 inverter in Home Assistant

First set up your Solis PV installation in the SolisCloud app.

  1. Create your installation
  2. Connect your Datalogger to your WiFi network
    • Select your installation, then go to Device S/N tab – Datalogger
    • Click the + icon on the bottom
    • Scan the QR code from on the Datalogger
    • Follow the steps given by the wizard
    • Your Datalogger is connected to your WiFi network
  3. Add your inverter to your installation
    • Select your installation, then go to Device S/N tab – Inverter
    • Click the + icon on the bottom
    • Scan the QR code from on the Inverter
      • If yhis doesn’t work, you can manually enter the S/N in the wizard
    • Follow the steps given by the guide
    • Your inverter is added to your PV installation

Now you have to wait a while until your installation comes online and you see the values produced by the solar panels.

Next up is to integrate it in Home Assistant

First install HACS in Home Assistant and search for the Solis integration.
Install the Solis integration

Then go to your Home Assistant settings/devices-services view
add a new service and look for the Solis service. Once found, install it.

Open the Solis service, name your inverter and select the Solis cloud option. When done, follow the guide from the developer on his github page to obtain the needed secret, StationId and API key from Solis.
Select the

Once you have completed all these steps, you should see all entities of the Solis inverter in your Home Assistant and notice they are getting feeded by values.

Now open the energy page and click on the 3 dots in right hand top corner and select energy configuration.
There you can add the solis_s6_energy_today sensor in your solar production tab.

That is all you have to do to get the solar production in your Home assistant.

Tuya ZigBee Energiemeter 80A

Deze week een energiemeter van AliExpress ontvangen. Het model is _TZE204_cjbofhxw (TS0601).
Deze gekoppeld in mijn ZHA, maar er was geen enkele entiteit beschikbaar. Dus op zoek op het www en natuurlijk had iemand al een oplossing gevonden in de vorm van een custom quirk.

Om een custom quirk te kunnen laden, moet eerst de configuration.yaml aangepast worden dat deze ook geladen kunnen worden. Voeg de volgende code toe in je configuration.yaml.

#ZHA custom quirks
zha:
  enable_quirks: true
  custom_quirks_path: /config/zha_quirks

Natuurlijk moet de map zha_quirks nog aangemaakt worden in je config folder in Home Assistant.

Daarna pak volgend bestand uit en upload naar de zha_quirks map

Herstart Home Assistant en ga dan naar je ZHA integratie. Koppel de energiemeter, geef hem een naam en plaats hem in een kamer.

Nu zou je in de eigenschappen van de energiemeter het gebruik van de quirk moeten zien

Herstart Home Assistant opnieuw en alles zou nu moeten werken. Dit kan je zien door de power led van de vermogensmeter die nu knippert en niet meer continue brandt. De vermogensweergave wordt pas zichtbaar nadat je de klem gebruikt hebt.

Indien er een entiteit of sensor niet zichtbaar zijn, herstart Home Assistant dan eens.

Solaredge PV convertor readings in KWh for Home Assistant

Add following code in the configuration.yaml, configured for your SolarEdge entities, in the sensor section.

sensor:
  - platform: template
  # SolarEdge zonnepanelen in KWh
    sensors:
      solaredge_energy_this_year_kwh:
        friendly_name: "SolarEdge Jaaropbrengst"
        unit_of_measurement: 'KWh'
        value_template: "{{ (states('sensor.solaredge_energy_this_year')|float / 1000)|round(2) }}"
        icon_template: "mdi:solar-power"
      solaredge_energy_this_month_kwh:
        friendly_name: "SolarEdge Maandopbrengst"
        unit_of_measurement: 'KWh'
        value_template: "{{ (states('sensor.solaredge_energy_this_month')|float / 1000)|round(2) }}"
        icon_template: "mdi:solar-power"
      solaredge_energy_today_kwh:
        friendly_name: "SolarEdge Dagopbrengst"
        unit_of_measurement: 'KWh'
        value_template: "{{ (states('sensor.solaredge_energy_today')|float / 1000)|round(2) }}"
        icon_template: "mdi:solar-power"
      solaredge_current_power_kwh:
        friendly_name: "SolarEdge Huidig vermogen"
        unit_of_measurement: 'KWh'
        value_template: "{{ (states('sensor.solaredge_current_power')|float / 1000)|round(3) }}"
        icon_template: "mdi:solar-power"
      solaredge_lifetime_energy_kwh:
        friendly_name: "SolarEdge Totaal"
        unit_of_measurement: 'KWh'
        value_template: "{{ (states('sensor.solaredge_lifetime_energy')|float / 1000)|round(0) }}"
        icon_template: "mdi:solar-power"

Now add the created sensors in your lovelace dashboard and you will see all readings in KWh instead of W

Create a temperature sensor for Netatmo Thermostat and Radiator Valves

Copy and adapt (for your entities) the following code in your configuration.yaml under the sensor section.

- platform: template
  sensors:
     woonkamer_temperatuur_netatmo:
         friendly_name: Woonkamer temperatuur
         unit_of_measurement: '°C'
         value_template: "{{ state_attr('climate.woonkamer_2', 'current_temperature') }}"

The sensor name woonkamer_temperatuur_netatmo has to be unique for each sensor you define.
Change the climate.woonkamer_2 in the entity you find in your home assistant entities list.

Then in the lovelace layout insert a sensor card and look for the sensor name you specified earlier.

HOME ASSISTANT: NORD POOL SPOT PRICES AND HOW TO AUTOMATE DEVICES FOR CHEAPEST HOURS

All credits to Creating Smart Home

Most of this information can already be found around the internet, but since I wanted to integrate one as well for my Home Assistant instance, why not to share the same with you?

Integrating Nord Pool to the Home Assistant

First we need to get the Nord Pool prices into the system so a new integration is needed. Luckily (again) someone has already made it happen and it can be installed using HACS. If you don’t know what HACS is, it’s a Home Assistant Community Store, a place where tons of integrations and frontend elements are published and can be easily installed. Just need to remember that those are not official Home Assistant components and are maintained by individual people and therefore can break more easily than official ones.

Anyway, start by installing Nord Pool custom component. This integration does not have UI configuration so the has to be done manually to the configurations.yaml.

For example, here’s my config:

Add the following code in the sensor segment. If you already have sensors defined, omit the "sensor:" line

sensor:
  - platform: nordpool
    VAT: true
    currency: "EUR"
    price_in_cents: true
    region: "FI" // check nordpool website for your region
    precision: 3
    price_type: kWh

In above configration firstly we enable the integration and second we configure the sensor to use region Finland and currency in Euros. Some tweaking to precision and VAT is also done, but more configuration details can be found from the integration repository.

After everything is configured, restart the Home Assistant and continue to the UI part.

Making the UI

First let’s find the entity id from our integrations. In Home Assistant go to Settings->Devices & Services->Entities and search with the filter ‘nordpool‘. You should find a entity id (that is same as unique id) and write it down somewhere. Unique id is generated by the Nord Pool integration from the configuration we made in the previous chapter.

For this part I’m using Apex Charts Card that is very versatile graphical presentation card of various values. Again, this frontend card can be installed using HACS. So go to the HACS and search for Apex and install it.

After installation is succeeded, it’s time to configure two cards (one for today and one for tomorrow).

Here’s my configuration for the cards (example UI shown at the end of this chapter):

type: custom:apexcharts-card
graph_span: 24h
header:
  title: Energy price today (c/kWh)
  show: true
span:
  start: day
now:
  show: true
  label: Now
series:
  - entity: sensor.nordpool_kwh_fi_eur_3_10_024 // use your nordpool entity
    type: column
    data_generator: |
      return entity.attributes.raw_today.map((start, index) => {
        return [new Date(start["start"]).getTime(), entity.attributes.raw_today[index]["value"]];
      });
type: custom:apexcharts-card
graph_span: 1d
header:
  title: Energy price tomorrow (c/kWh)
  show: true
span:
  start: day
  offset: +1d
series:
  - entity: sensor.nordpool_kwh_fi_eur_3_10_024 // use your nordpool entity
    type: column
    data_generator: |
      return entity.attributes.raw_tomorrow.map((start, index) => {
        return [new Date(start["start"]).getTime(), entity.attributes.raw_tomorrow[index]["value"]];
      });

Again, you can use the same configurations, just remember to change the proper entity id for the cards (the one that we wrote down in previous chapter).

That’s it! Now there should be todays electrical spot prices and tomorrows spot prices available in the Home Assistant for any use!

To make it smart keep on reading the next chapters..

Finding the cheapest hours

One of the key points of having Nord pool is of course finding the cheapest hour(s) and automate devices to run during those hours.

For this I’ve created a template sensor that ensures validity of next day prices (usually published by Nord Pool at 12:00) and finds the sweet spot of requested lenght!

It’s easily modifiable by changing numberOfSequentialHours (how long period are we looking for), firstHour (first possible hour we want to start) and last hour (final hour we want to stop latest). E.g. you can also use it to find cheapest hours during the next night by setting the last hour to something like 06:00.

sensor:
  - platform: template
    sensors:
      cheapest_hours_energy_tomorrow:
        device_class: timestamp
        friendly_name: Cheapest sequential electricity hours
        value_template: >
          {%- set numberOfSequentialHours = 3 -%}
          {%- set lastHour = 23 -%}
          {%- set firstHour = 0 -%}

          {%- if state_attr('sensor.nordpool_kwh_fi_eur_3_10_024', 'tomorrow_valid') == true -%}
            {%- set ns = namespace(counter=0, list=[], cheapestHour=today_at("00:00") + timedelta( hours = (24)), cheapestPrice=999.00) -%}
            {%- for i in range(firstHour + numberOfSequentialHours, lastHour+1) -%}
              {%- set ns.counter = 0.0 -%}
              {%- for j in range(i-numberOfSequentialHours, i) -%}
                {%- set ns.counter = ns.counter + state_attr('sensor.nordpool_kwh_fi_eur_3_10_024', 'tomorrow')[j] -%}
              {%- endfor -%}
              {%- set ns.list = ns.list + [ns.counter] -%}
              {%- if ns.counter < ns.cheapestPrice -%}
                {%- set ns.cheapestPrice = ns.counter -%}
                {%- set ns.cheapestHour = today_at("00:00") + timedelta( hours = (24 + i - numberOfSequentialHours)) -%}
              {%- endif -%}
            {%- endfor -%}
            {{ ns.cheapestHour }}
            {%- set ns.cheapestPrice = ns.cheapestPrice / numberOfSequentialHours -%}
          {%- endif -%}

Finally making the automations

Now that we know the cheapest hours for the next day, only thing to do is actually do the automations for various devices.

My automation is actually in two parts:

  • Second I run the automation when the time trigger is hit
# Helper to keep the start time
input_datetime:
  device_start_time:
    name: Device Start Time
    has_time: true
    has_date: false

automation:
# Update time trigger to cheapest hours
  - id: '1663398489357'
    alias: 'Set device start time'
    description: ''
    trigger:
    - platform: time
      at: '23:10:00'
    condition:
    - condition: not
      conditions:
      - condition: state
        entity_id: sensor.cheapest_hours_energy_tomorrow
        state: unknown
    action:
    - service: input_datetime.set_datetime
      data:
        time: '{{ as_timestamp(states(''sensor.cheapest_hours_energy_tomorrow'')) | timestamp_custom(''%H:%M'') }}'
      target:
        entity_id: input_datetime.device_start_time
    mode: single

# Finally do the actions when time trigger is hit
  - id: '1663399614818'
    alias: Increase heating
    description: ''
    trigger:
    - platform: time
      at: input_datetime.device_start_time
    condition: []
    action:
    - service: climate.set_temperature
      data:
        temperature: 24
      target:
        entity_id: climate.heat_pump
    mode: single

Synology Surveillance Station Home Mode Automation with Home Assistant

I have found a guide on the www, but it was not that 100% clear and I had to google a lot of things to be clear. But I got it 100% functional and will publish an updated guide here.

This is the url for the original guide: https://www.paolotagliaferri.com/home-automation-home-assistant-docker-synology/

Some prerequisites:

  • Docker
  • Home Assistant
  • Surveillance Station
  • Unifi network or similar that can be integrated in Home assistant

First:

Find the entity identifier of your mobile phone that is used by the Ubiquiti UniFi integration

Create a group where the entity that represents you in your configuration.yaml

Next:

Then on the Synology Surveillance Station, I generated two actions in the Action Rule section to create webhooks that Home Assistant can use for switching the Home mode on or off

First I will create the rule to enable home mode

Here you see the webhook url we will use in the secrets.yaml later on

Now you have create the rule to enable the Home mode in surveillance station. Next will be the disable Home mode rule

Here you see the webhook url we will use in the secrets.yaml later on

When you have followed all steps, this will be the result

Now we are going to define 2 variables for the webhooks in the secrets.yaml file. These variables will be used in the configuration.yaml later.

When that is done, we can go back to the configurations.yaml to define the webhooks so they can be used for automation

Finally – I defined the automation in the UI (or in the configurations.yaml file) – here’s the generated configuration

Last thing to do is to check the configuration for errors and if that passes, you can restart the Home Assistant server.

Now the moment you go out of range of your wifi, Synology Surveillance station will go out of home mode and vica versa. Keep in mind that the standard delay the Ubiquiti UniFi integration uses for switching from home to not home is 300 seconds.