My Smart Home
  1. U bent hier:  
  2. Startpagina
  3. All Blogs

Christmas lights WLED + HA

Details
Hits: 700

Each year, I want to improve on my Christmas lights.

A few years ago, I created some LED frames to fit in the doors and windows.

I controlled them via a D1 mini running WLED.  

I also have some sets in the house. 

I used: 5V RGB led string WS2811 and Ws2812b Led String

I used the Led string to create a 2D WLED display.   Attached them on a grid (8x25) to the wall it acts as a display.

Labels

I used labels for my different Christmas lights:

  • Kerstverlchting: overall label for all Christmas lights
  • Kerstverlichting binnen: label for all Christmas light in the house
  • Kerstverlichting Slinger: label for all light strings
  • Kerstverlichting Matrix: label for all 2D matrix 

By using labels, I was able to use some spare/unused smart plugs without having to rename them or program them specifically for this use.
Added I was able to create multiple different D1 mini WLED boxes and based on the config I can later assign them to a label depending on the use case.
 

Support scripts:

I want to randomize the colors and effect on all WLED.

  • Set random color on strings and matrix
    I created a small set of color names to select randomly
alias: Random Color Kerst
sequence:
  - data:
      color_name: >-
        {{ ['red', 'amber', 'green', 'blue', 'cyan', 'magenta','yellow','orange', 'pink', 'purple','white','BlueViolet','Chartreuse','DarkBlue','Gold','Sienna','YellowGreen'] | random | string }}
    target:
      label_id:
        - kerstverlichting_slinger
        - kerstverlichting_matrix
    action: light.turn_on
mode: single
icon: mdi:palette
  • Set random effect on strings
    I pulled all  WLED effects from https://kno.wled.ge/features/effects/ and selected just the string effects

alias: Random Effect kerst
sequence:
  - data:
      effect: >-
        {{ ['Solid','Blink','Breathe','Wipe','Wipe Random','Random
        Colors','Sweep','Dynamic','Colorloop','Rainbow','Scan','Scan
        Dual','Fade','Theater','Theater
        Rainbow','Running','Saw','Twinkle','Dissolve','Dissolve
        Rnd','Sparkle','Sparkle Dark','Sparkle+','Strobe','Strobe
        Rainbow','Strobe Mega','Blink Rainbow','Android','Chase','Chase
        Random','Chase Rainbow','Chase Flash','Chase Flash Rnd','Rainbow
        Runner','Colorful','Traffic Light','Sweep Random','Chase
        2','Aurora','Stream','Scanner','Lighthouse','Fireworks','Rain','Tetrix','Fire
        Flicker','Gradient','Loading','Fairy','Two Dots','Fairytwinkle','Running
        Dual','Chase 3','Tri Wipe','Tri Fade','Lightning','ICU','Multi
        Comet','Scanner Dual','Stream 2','Oscillate','Pride
        2015','Juggle','Palette','Fire 2012','Colorwaves','Bpm','Fill
        Noise','Noise 1','Noise 2','Noise 3','Noise
        4','Colortwinkles','Lake','Meteor','Meteor
        Smooth','Railway','Ripple','Twinklefox','Twinklecat','Halloween
        Eyes','Solid Pattern','Solid Pattern Tri','Spots','Spots
        Fade','Glitter','Candle','Fireworks Starburst','Fireworks 1D','Bouncing
        Balls','Sinelon','Sinelon Dual','Sinelon
        Rainbow','Popcorn','Drip','Plasma','Percent','Ripple
        Rainbow','Heartbeat','Pacifica','Candle Multi','Solid
        Glitter','Sunrise','Phased','Twinkleup','Noise Pal','Sine','Phased
        Noise','Flow','Chunchun','Dancing Shadows','Washing
        Machine','Blends','TV Simulator','Dynamic
        Smooth','Pixels','Pixelwave','Juggles','Matripix','Gravimeter','Plasmoid','Puddles','Midnoise','Noisemeter','Freqwave','Freqmatrix','Waterfall','Freqpixels','Noisefire','Puddlepeak','Noisemove','Perlin
        Move','Ripple Peak','Freqmap','Gravcenter','Gravcentric','Gravfreq','DJ
        Light','Blurz','Flow Stripe','Wavesins','Rocktaves'] | random | string
        }}
    target:
      label_id: kerstverlichting_slinger
    action: light.turn_on
mode: single
icon: mdi:lighthouse

  • Set random effect on matrix
    I pulled all WLED effects from https://kno.wled.ge/features/effects/ and selected just the Matrix effects

alias: Random Matrix Effect kerst
sequence:
  - data:
      effect: >-
        {{ ['Fireworks','Rain','Ripple','Halloween Eyes','Fireworks 1D','Ripple
        Rainbow','Spaceships','Crazy Bees','Ghost Rider','Blobs','Scrolling
        Text','Drift Rose','Distortion Waves','Soap','Octopus','Waving
        Cell','GEQ','Noise2D','Firenoise','Squared
        Swirl','DNA','Matrix','Metaballs','Funky
        Plank','Pulser','Drift','Waverly','Sun Radiation','Colored
        Bursts','Julia','Game Of Life','Tartan','Polar
        Lights','Swirl','Lissajous','Frizzles','Plasma
        Ball','Hiphotic','Sindots','DNA Spiral','Black Hole','Akemi'] | random |
        string }}
    target:
      label_id: kerstverlichting_matrix
    action: light.turn_on
mode: single
icon: mdi:lighthouse
description: ""

Automations:

When do we want the light to go on and off? 
In the house, only when we are home. 

Outside between 6:20 - 1:00

alias: Alle Kerstverlichting aan
description: ""
triggers:
  - at: "06:20:00"
    trigger: time
conditions: []
actions:
  - data: {}
    action: switch.turn_on
    target:
      label_id: kerstverlichting
  - data: {}
    action: light.turn_on
    target:
      label_id: kerstverlichting
  - action: input_boolean.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: input_boolean.kerstverlichting_binnen_aan_uit
mode: single

 

Random Color and effects.  Change every 6 min

alias: Kerst Random Kleur en Effect
description: ""
triggers:
  - minutes: /6
    trigger: time_pattern
actions:
  - data: {}
    action: script.random_matrix_effect_kerst
  - data: {}
    action: script.random_color_kerst
  - delay:
      hours: 0
      minutes: 3
      seconds: 0
      milliseconds: 0
  - data: {}
    action: script.random_effect_wled
mode: single

 

Every 9 min, a random message on the matrix

Put the random message in the input_text field

alias: Kest Matrix Random text
description: ""
triggers:
  - trigger: time_pattern
    minutes: /9
conditions: []
actions:
  - action: input_text.set_value
    metadata: {}
    data:
      value: >-
        {{ ['Vrolijk Kerstfeest','Gelukkig nieuwjaar','Joyeux Noël','Bonne
        année','Prettige Kerstdagen','Feliz Navidad','Merry Christmas','Happy
        New Year','Frohe Weihnachten','Ein gutes neues Jahr','Het beste voor
        2025'] | random | string }}
    target:
      entity_id: input_text.kerst_matrix
mode: single

 

To publish to the Matrix WLED, I created a Rest command that uses "Text" as input and POTS to the WLED with FX 122 (Scrolling Text)

kerstmatrix:
  url: http://x.x.x.x/json/state
  method: POST
  payload: '{"seg": [{"fx":122,"col":[[8,255,0],[0,0,0],[0,0,0]],"n": "{{text}}"}]}'
  content_type: "application/json; charset=utf-8"

 

I have an automation that runs on change of Input_text.kerst_matrix and pushed that to the Matrix WLED.  

alias: Kerst Text op Matrix
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_text.kerst_matrix
conditions: []
actions:
  - data:
      text: "{{ states('input_text.kerst_matrix') }}"
    alias: Wled = Kerst Matrix
    action: rest_command.kerstmatrix
mode: single

 

Using the "input_text.kerst_matrix" change as trigger, allows me to also publish text directly from HA Lovelace. 

 

Write comment (0 Comments)

Smart Heating DIY

Details
Hits: 1592

With my oldest having to study for their exams, I had to provide some heaters in their rooms.   Now these days you can buys smart heaters but I wanted to do that myself.

I purchased a simple, cheap Infrared Panel heater and connected via a shelly Plug (1).   As I have temperature and humidity sensors (2) in every room of the house, I used Dual Smart Thermostat (3) combined with ECO Heating Ultimate (5) blueprint to create a heating plan. 

Now the room will be kept on 15C at all times, when Tuur or Gust is home (HA state) the temp will go up to 17C.   

I also created a "comfort temp switch" (3) that changes the thermostat to 21C and holds that for 2h.  This to keep them warm when studying.   

imageimage

 

Easy way to take control of a the heating not having to worry about heater being on the whole day

Write comment (0 Comments)

Power consumption in house. Use Labels

Details
Hits: 2611

I recently changed my home power connection from 3x230V (32A) to 3x230V+n (25A).  This had more impact than I originally anticipated on.

First of all, I have to change some of my breakers from 32A to 25A.  

Secondly, I had to rebalance the different phases in my breaker board.

As I need to make some changes, I would also update my breaker box to the newest AREI rules, stating that all internal devices needs to be protected by a 30mA differential breaker.

As I had almost all my devices monitored by a shelly device. I was able to see the power consumption per device.

Now, to rebalance the load, I needed to know what device belongs to what breaker.  On top, I wanted to know what breakers belong to what phase so we can balance evenly.

To solve this, I used Labels.

I created 2 type of  labels:

- 'Automaat X' (one for each breaker)

- 'Lijn Y' (one for each phase)

I attached these labels to the Shelly sensors in bulk by using homeassistant.add_label_to_entity service

Once combined I created a sensor for each "Automaat X" and "Lijn Y".

    - name: "Huidig verbruik in huis - Lijn 3"
      unique_id: 8d374087-28ea-479d-9da1-4803fe14b2e5
      device_class: power
      state_class: measurement
      state: "{{ expand(label_entities('Lijn 3')) | selectattr('attributes.device_class','defined') | selectattr('attributes.device_class','==','power')| selectattr('attributes.state_class','defined') | selectattr('attributes.state_class','==','measurement') | selectattr('state', '!=', 'unavailable')  | map(attribute='state') | map('float')  | list  | sum | round(0)}}"
      unit_of_measurement: "W"
    - name: "Huidig verbruik in huis - Automaat A"
      unique_id: 7a43a116-4e5a-4901-99f6-ded8063ba4c6
      device_class: power
      state_class: measurement
      state: "{{ expand(label_entities('Automaat A')) | selectattr('attributes.device_class','defined') | selectattr('attributes.device_class','==','power')| selectattr('attributes.state_class','defined') | selectattr('attributes.state_class','==','measurement') | selectattr('state', '!=', 'unavailable')  | map(attribute='state') | map('float')  | list  | sum | round(0)}}"
      unit_of_measurement: "W"
This would give me the the Power consumption per breaker and phase.
 
I left this running for a few weeks so I could see average an peak usage.   By changing the label assignment on "Lijn Y" I could simulate the re-distributed power consumption per phase and plan my the change on my breaker box.
 
Last week, I rebalanced all the loads and I make a visual representation of the current per breaker
 
I used a mushroom card to display the breaker name and info and calculated the current based on the power use.
      - type: custom:mushroom-template-card
        secondary: 'J - 20A - Buiten'
        primary: >-
          {{ ((states('sensor.huidig_verbruik_in_huis_automaat_j') | float() /
          230 )| round (2))   }} A
        icon: mdi:fuse
 
Next steps:
- Eliminate duplicate measurements:  I have some shelly devices behind other shelly devices.  This results in duplicate measurement of power.  I will create a label "Primary Use" to assign to the sensors to only count the usage of the primary device.
- As I have different breaker boxes, I have some breakers that have an aggregated use or are breakers in the source and destination box.  I need to change the labels to match the sources to calculate correct (Breaker H and I for example)
- Add color coding to the breakers.  Example 20A breaker, set green to 18A, orange 19A and red 20A.  
- Add solar installation and calculate "Rem Automaat" current
 
update 2024-05-30:
I added the label "Primary Use" and changed my templates:
    - name: "Huidig verbruik in huis - Lijn 3"
      unique_id: 8d374087-28ea-479d-9da1-4803fe14b2e5
      device_class: power
      state_class: measurement
      state: "{{ expand(label_entities('Lijn 3')) | select('in',expand(label_entities('Primary Use'))) | selectattr('attributes.device_class','defined') | selectattr('attributes.device_class','==','power')| selectattr('attributes.state_class','defined') | selectattr('attributes.state_class','==','measurement') | selectattr('state', '!=', 'unavailable')  | map(attribute='state') | map('float')  | list  | sum | round(0)}}"
      unit_of_measurement: "W"
    - name: "Huidig verbruik in huis - Automaat A"
      unique_id: 7a43a116-4e5a-4901-99f6-ded8063ba4c6
      device_class: power
      state_class: measurement
      state: "{{ expand(label_entities('Automaat A')) | select('in',expand(label_entities('Primary Use'))) | selectattr('attributes.device_class','defined') | selectattr('attributes.device_class','==','power')| selectattr('attributes.state_class','defined') | selectattr('attributes.state_class','==','measurement') | selectattr('state', '!=', 'unavailable')  | map(attribute='state') | map('float')  | list  | sum | round(0)}}"
      unit_of_measurement: "W"
I also assigned the labels of the duplicate breakers to match the source breakers total.
Write comment (0 Comments)

Power consumption in house. Shelly - Solax and P1

Details
Hits: 2699
 
I have 85+ Shelly devices in my house controlling lights, switches; measure power consumption.  I have them all integrated in Home Assistant together with Sofax for my solar panels and P1 monitoring my power meter.
 
In a quest to find all non monitored usage in the house, I created a template sensor to add up all Shelly Power values.  
- trigger:
    - platform: time_pattern
      seconds: "/15"
  sensor:
    ###### Verbruik van alle Shelly devices #####
    - name: "Verbruik in huis - Shelly"
      unique_id: d8b9285a-7723-447d-85b5-cfe4bfba396d
      device_class: power
      state_class: measurement
      state: "{{ expand(integration_entities('shelly')) | selectattr('attributes.device_class','defined') | selectattr('attributes.device_class','==','power')| selectattr('attributes.state_class','defined') | selectattr('attributes.state_class','==','measurement') | selectattr('state', '!=', 'unavailable')  | map(attribute='state') | map('float')  | list  | sum | round(0)}}"
      unit_of_measurement: "W"
The nice way of this is, regardless of the amount of Shelly devices I have, it just adds up the vales of the power consumption reported at that time. 
expand(integration_entities('shelly')):  Only select the Shelly devices
selectattr('attributes.device_class','==','power'): I just need the Power to be reported
selectattr('state', '!=', 'unavailable'): Ingore all unavailable sensors. 
 
I also created a second sensor that calculates the non monitored usage in house.  Based on the measured usage by my Solar invertor (Sofax modbus) and my measurement with Shelly.
 
    ###### intern verbruik niet gementen, verschil tussen Sofar en Shelly #####
    - name: "Verbruik in huis - Niet gemeten"
      unique_id: 61c6f07c-2d64-4fab-8a10-c31f641f9a12
      unit_of_measurement: W
      device_class: power
      state_class: measurement
      state: "{{(states('sensor.verbruik_in_huis_solax') | float(2) - states('sensor.verbruik_in_huis_shelly') | float(2)) | round(0) }}"
 
These results are combined in my dashboard.
 
I now just need to find out where the 114W is used in the house...
 
Write comment (0 Comments)

How to grab all data from my Shelly devices via HTTP/API

Details
Hits: 5082

I recently decided to change ShellyForHASS for Shelly integration. Not an easy process.

When all my device where rediscovered. I notice some inconsistencies. Some where added with their original Shelly name others with their display name and one even with FQN. To investigate, I had to check each Shelly.

Now to make my life a bit easier. I was looking for a way to get all my settings for my Shelly devices in a single file, that I can search and sort. I made this quick and dirty, Powershell script that did the trick.(All my Shelly devices are in a separate VLAN 192.168.152.0/24)

#########################################################################

cls

$ShellyJsonStatus = "c:\temp\shellyStatus"+(Get-Date).tostring("yyyy-MM-dd-hh-mm-ss")+".json"
$ShellyJsonShelly = "c:\temp\shellyShelly"+(Get-Date).tostring("yyyy-MM-dd-hh-mm-ss")+".json"
$ShellyJsonSettings = "c:\temp\shellySettings"+(Get-Date).tostring("yyyy-MM-dd-hh-mm-ss")+".json"

$ShellyStatus = @()
$ShellyShelly = @()
$ShellySettings = @()

$i=10
for(;$i -le 253;$i++)
{
    $webData1 = @()
    $webData2 = @()
    $webData3 = @()
    $ipBase = "192.168.152." + $i
    Write-Host $ipBase
    if (Test-Connection -ComputerName $ipBase -Count 1 -Quiet) {
        $uriBase = "http://"+$ipBase

        $webData1Uri = $uriBase + "/status"
        $webData1 = Invoke-RestMethod -Uri $webData1Uri
        $webData2Uri = $uriBase + "/shelly"
        $webData2 = Invoke-RestMethod -Uri $webData2Uri
        $webData3Uri = $uriBase + "/settings"
        $webData3 = Invoke-RestMethod -Uri $webData3Uri
        Write-Host $uriBase
        $ShellyStatus = @($ShellyStatus; $webData1)
        $ShellyShelly = @($ShellyShelly; $webData2)
        $ShellySettings = @($ShellySettings; $webData3)
    }
}
$ShellyStatus | ConvertTo-Json | Out-File $ShellyJsonStatus
$ShellyShelly | ConvertTo-Json | Out-File $ShellyJsonShelly
$ShellySettings | ConvertTo-Json | Out-File $ShellyJsonSettings
#drop in https://data.page/json/csv to get good CSV

#########################################################################

Putting that all in excel gave me some interesting insights and saved a ton of time.

Write comment (1 Comment)
  1. How it started

Pagina 1 van 2

  • 1
  • 2

Main Menu

  • Home
  • All Blogs

Login Form

  • Wachtwoord vergeten?
  • Gebruikersnaam vergeten?