Home Assistant : Q&A, Tips & Tricks, Your Configs

Thanks for all this info, was it you who was considering giving up on Zigbee at one point, before you got this new hardware in?
Yes.

I'm wondering now if the Sonoff bridge is okay and all I need is some repeaters? I'm not trying to cover long distances - the furthest point from the bridge/coordinator is max 20 meters, a couple of brick walls in the way but no steel or reinforcing or other stuff. When compared to 2.4GHz Wi-Fi, is Zigbee typically the same in terms of range?

The Lorataps improved the network while I was using the Sonoff bridge still. But was not perfect, still had joining issues. Where I had to have the device in range of the bridge (super small range too) to join. Then I would have to over days/weeks move the device further away to where I want it. But it would then work.

Once I moved over to the zigstar, that funny went away. I could join devices on the edge immediately and it would instantly work where I want it.

Basically, I removed all sonoff zigbee devices from my zigbee network. They all suck. Their repeaters suck, their switches suck. Their temp/humidity sensors are "ok" but the Xiaomi zigbee sensors just work. Most tuya zigbee stuff just work too. I basically think, the only good stuff Sonoff make, is their basic wifi switches and their SV switches.

But you know what, that is just my experience and opinion. Others may have a different view. But basically, I can't remember when last I had to even look at my zigbee network now, it just chugs along. I literally just view the actual sensor data now in home assistant out of interest sake. And that is how it should be. A reliable zigbee network.
 
The Lorataps improved the network while I was using the Sonoff bridge still. But was not perfect, still had joining issues. Where I had to have the device in range of the bridge (super small range too) to join. Then I would have to over days/weeks move the device further away to where I want it. But it would then work.

Once I moved over to the zigstar, that funny went away. I could join devices on the edge immediately and it would instantly work where I want it.
Where did you get the zigstar? I have the same pairing issue with my Sonoff dongle
 
Thanks for all this info, was it you who was considering giving up on Zigbee at one point, before you got this new hardware in?
Also me - haven't had issues since the Loratap extenders

I have the Sonoff Zigbee 3.0 USB Dongle as the co-ordinater with Zigbee2MQTT
 
Sure. I've just started redoing my dashboards and I've separated some things into one of the new "Sections" style dashboards to give me more flexibility.

This is my progress so far on the first one.

View attachment 1755683

As you can see the Geyserwise card is wider than the original I posted which allows me to make the time span longer too.

YAML:
type: custom:apexcharts-card
experimental:
  disable_config_validation: true
graph_span: 12h
yaxis:
  - id: first
    decimals: 0
    min: 0
    max: 100
    apex_config:
      tickAmount: 6
  - id: second
    opposite: true
    show: false
    decimals: 1
    apex_config:
      tickAmount: 2
apex_config:
  chart:
    height: 350px
  grid:
    borderColor: '#3f3f3f'
header:
  show: true
  standard_format: true
  show_states: true
  colorize_states: false
series:
  - entity: water_heater.geyserwise_water_heater
    name: Current Temperature
    attribute: current_temperature
    yaxis_id: first
    stroke_width: 2
    unit: °C
  - entity: sensor.geyserwise_water_heater_collector_temperature
    name: Collector Temperature
    yaxis_id: first
    stroke_width: 2
  - entity: water_heater.geyserwise_water_heater
    name: Target Temperature
    attribute: temperature
    yaxis_id: first
    curve: stepline
    stroke_width: 3
    unit: °C
    stroke_dash: 3
    color: lightgrey
  - entity: water_heater.geyserwise_water_heater
    name: Element State
    yaxis_id: second
    transform: 'return x === ''electric'' ? 1 : 0;'
    type: area
    curve: stepline
    stroke_width: 0
    color: grey
    opacity: 0.2
  - entity: binary_sensor.geyserwise_water_heater_element
    name: Element Heating
    yaxis_id: second
    transform: 'return x === ''on'' ? 1 : 0;'
    extend_to: end
    type: area
    curve: stepline
    stroke_width: 0
    color: red
    opacity: 0.5
layout_options:
  grid_columns: full
I know this has been asked and answered dozens of times, but my googling skills are leaving much to be desired as of late.

What card are you using for the Solar Forecasting?

I have my Solcast account integrated, but the built-in energy dashboard is leaving much to be desired.
 
I know this has been asked and answered dozens of times, but my googling skills are leaving much to be desired as of late.

What card are you using for the Solar Forecasting?

I have my Solcast account integrated, but the built-in energy dashboard is leaving much to be desired.
That's @Slip's chart: https://mybroadband.co.za/forum/thr...ips-tricks-your-configs.1059800/post-31677230

Here is my custom one:

YAML:
type: custom:apexcharts-card
view_layout:
  grid-area: solar
header:
  show: true
  standard_format: true
  show_states: true
  colorize_states: true
apex_config:
  chart:
    height: 350px
  tooltip:
    enabled: true
    shared: true
    followCursor: true
graph_span: 3d
now:
  show: true
  label: Now
span:
  start: day
  offset: "-1day"
all_series_config:
  type: area
  opacity: 0.3
  stroke_width: 1
series:
  - entity: sensor.battery_state_of_charge
    name: Battery
    float_precision: 0
    type: line
    color: "#f06292"
    opacity: 0.6
    yaxis_id: capacity
    extend_to: now
    show:
      legend_value: true
      in_header: false
    group_by:
      func: last
      duration: 5m
  - entity: sensor.pv_power
    name: Solar Power
    float_precision: 3
    color: "#ff9800"
    yaxis_id: kWh
    unit: kW
    transform: return x/1000;
    extend_to: now
    show:
      legend_value: true
      in_header: false
    group_by:
      func: avg
      duration: 5m
  - entity: sensor.solcast_pv_forecast_forecast_today
    name: Forecast Today
    extend_to: false
    color: grey
    opacity: 0.3
    stroke_width: 0
    yaxis_id: kWh
    show:
      legend_value: false
      in_header: false
    data_generator: |
      return entity.attributes.detailedForecast.map((entry) => {
            return [new Date(entry.period_start), entry.pv_estimate];
          });
  - entity: sensor.solcast_pv_forecast_forecast_tomorrow
    name: Forecast Tomorrow
    float_precision: 3
    extend_to: false
    color: grey
    opacity: 0.3
    stroke_width: 0
    yaxis_id: kWh
    show:
      legend_value: false
      in_header: false
    data_generator: |
      return entity.attributes.detailedForecast.map((entry) => {
            return [new Date(entry.period_start), entry.pv_estimate];
          });
  - entity: sensor.solcast_pv_forecast_forecast_day_3
    name: Forecast (D3)
    float_precision: 3
    extend_to: false
    color: grey
    opacity: 0.3
    stroke_width: 0
    yaxis_id: kWh
    show:
      legend_value: false
      in_header: false
    data_generator: |
      return entity.attributes.detailedForecast.map((entry) => {
            return [new Date(entry.period_start), entry.pv_estimate];
          });
  - entity: sensor.solcast_pv_forecast_forecast_today
    yaxis_id: header_only
    name: Forecast Today
    color: grey
    show:
      legend_value: true
      in_header: true
      in_chart: false
  - entity: sensor.solcast_pv_forecast_forecast_remaining_today
    yaxis_id: header_only
    name: Forecast Remaining
    color: grey
    show:
      legend_value: true
      in_header: true
      in_chart: false
  - entity: sensor.solcast_pv_forecast_forecast_tomorrow
    yaxis_id: header_only
    name: Forecast Tomorrow
    color: grey
    show:
      legend_value: true
      in_header: true
      in_chart: false
  - entity: sensor.solcast_pv_forecast_forecast_day_3
    yaxis_id: header_only
    name: Forecast (D3)
    color: grey
    show:
      legend_value: true
      in_header: true
      in_chart: false
  - entity: sensor.solcast_pv_forecast_api_last_polled
    yaxis_id: header_only
    name: Forecast (Last Update)
    color: grey
    unit: " min."
    transform: return ((Date.now()) - (new Date(x).getTime())) / 60 / 60 / 24
    show:
      legend_value: true
      in_header: true
      in_chart: false
yaxis:
  - id: capacity
    show: true
    opposite: true
    decimals: 0
    max: 100
    min: 0
    apex_config:
      tickAmount: 5
  - id: kWh
    show: true
    min: 0
    apex_config:
      tickAmount: 5
  - id: header_only
    show: false
 
That's @Slip's chart: https://mybroadband.co.za/forum/thr...ips-tricks-your-configs.1059800/post-31677230

Here is my custom one:

YAML:
type: custom:apexcharts-card
view_layout:
  grid-area: solar
header:
  show: true
  standard_format: true
  show_states: true
  colorize_states: true
apex_config:
  chart:
    height: 350px
  tooltip:
    enabled: true
    shared: true
    followCursor: true
graph_span: 3d
now:
  show: true
  label: Now
span:
  start: day
  offset: "-1day"
all_series_config:
  type: area
  opacity: 0.3
  stroke_width: 1
series:
  - entity: sensor.battery_state_of_charge
    name: Battery
    float_precision: 0
    type: line
    color: "#f06292"
    opacity: 0.6
    yaxis_id: capacity
    extend_to: now
    show:
      legend_value: true
      in_header: false
    group_by:
      func: last
      duration: 5m
  - entity: sensor.pv_power
    name: Solar Power
    float_precision: 3
    color: "#ff9800"
    yaxis_id: kWh
    unit: kW
    transform: return x/1000;
    extend_to: now
    show:
      legend_value: true
      in_header: false
    group_by:
      func: avg
      duration: 5m
  - entity: sensor.solcast_pv_forecast_forecast_today
    name: Forecast Today
    extend_to: false
    color: grey
    opacity: 0.3
    stroke_width: 0
    yaxis_id: kWh
    show:
      legend_value: false
      in_header: false
    data_generator: |
      return entity.attributes.detailedForecast.map((entry) => {
            return [new Date(entry.period_start), entry.pv_estimate];
          });
  - entity: sensor.solcast_pv_forecast_forecast_tomorrow
    name: Forecast Tomorrow
    float_precision: 3
    extend_to: false
    color: grey
    opacity: 0.3
    stroke_width: 0
    yaxis_id: kWh
    show:
      legend_value: false
      in_header: false
    data_generator: |
      return entity.attributes.detailedForecast.map((entry) => {
            return [new Date(entry.period_start), entry.pv_estimate];
          });
  - entity: sensor.solcast_pv_forecast_forecast_day_3
    name: Forecast (D3)
    float_precision: 3
    extend_to: false
    color: grey
    opacity: 0.3
    stroke_width: 0
    yaxis_id: kWh
    show:
      legend_value: false
      in_header: false
    data_generator: |
      return entity.attributes.detailedForecast.map((entry) => {
            return [new Date(entry.period_start), entry.pv_estimate];
          });
  - entity: sensor.solcast_pv_forecast_forecast_today
    yaxis_id: header_only
    name: Forecast Today
    color: grey
    show:
      legend_value: true
      in_header: true
      in_chart: false
  - entity: sensor.solcast_pv_forecast_forecast_remaining_today
    yaxis_id: header_only
    name: Forecast Remaining
    color: grey
    show:
      legend_value: true
      in_header: true
      in_chart: false
  - entity: sensor.solcast_pv_forecast_forecast_tomorrow
    yaxis_id: header_only
    name: Forecast Tomorrow
    color: grey
    show:
      legend_value: true
      in_header: true
      in_chart: false
  - entity: sensor.solcast_pv_forecast_forecast_day_3
    yaxis_id: header_only
    name: Forecast (D3)
    color: grey
    show:
      legend_value: true
      in_header: true
      in_chart: false
  - entity: sensor.solcast_pv_forecast_api_last_polled
    yaxis_id: header_only
    name: Forecast (Last Update)
    color: grey
    unit: " min."
    transform: return ((Date.now()) - (new Date(x).getTime())) / 60 / 60 / 24
    show:
      legend_value: true
      in_header: true
      in_chart: false
yaxis:
  - id: capacity
    show: true
    opposite: true
    decimals: 0
    max: 100
    min: 0
    apex_config:
      tickAmount: 5
  - id: kWh
    show: true
    min: 0
    apex_config:
      tickAmount: 5
  - id: header_only
    show: false
Perfect, thank you. This was exactly what I was looking for.
 
I really need to do more with my home assistant, it's just default right now
 
I really need to do more with my home assistant, it's just default right now

I'm in the some boat, its very default and very plain.

Starting to expand it and add a few things to it these holydays though... will just have to gauge the wife-acceptance-factor for some of the changes.
 
I'm in the some boat, its very default and very plain.

Starting to expand it and add a few things to it these holydays though... will just have to gauge the wife-acceptance-factor for some of the changes.
This is also my hope ;-)
 
Just want to show something, which I think is absolutely insane.

There is this website, pollencount.co.za - that shows the pollen levels for SA, updated once a week with a new report. I thought this is amazing and I wanted to get it into Home Assistant.

Emailed them some months ago, crickets.

So, I thought, ok lets ask Claude to write me a script that will scrape the website, get the latest report, then get the values and output it into a cli table. Boom done it works.
Then asked to convert the output to json. Works too.

So THEN, I asked it, can you convert the script to a Home Assistant 2024.11 to show up as sensors. It took this as, HA 2024.1.1 but it wrote a whole custom component for me. Finally asked, can you give me a sample dashbard template, it provided 7 different options to use. I was like, damn this is epic. Took me a few minutes only.

Screenshot 2024-12-09 at 11.18.00.png


Screenshot 2024-12-09 at 11.09.12.png
 
Just want to show something, which I think is absolutely insane.

There is this website, pollencount.co.za - that shows the pollen levels for SA, updated once a week with a new report. I thought this is amazing and I wanted to get it into Home Assistant.

Emailed them some months ago, crickets.

So, I thought, ok lets ask Claude to write me a script that will scrape the website, get the latest report, then get the values and output it into a cli table. Boom done it works.
Then asked to convert the output to json. Works too.

So THEN, I asked it, can you convert the script to a Home Assistant 2024.11 to show up as sensors. It took this as, HA 2024.1.1 but it wrote a whole custom component for me. Finally asked, can you give me a sample dashbard template, it provided 7 different options to use. I was like, damn this is epic. Took me a few minutes only.

View attachment 1779842


View attachment 1779841
Thats pretty amazing and I might steal this idea.
 
Thats pretty amazing and I might steal this idea.
Please do share the interesting stuff you come up with.

I thought about this after reading
First I tried to optimize my own automations first, but I dropped that idea when the changed code seemed...to change the actual function of my automations. At least, it was a big miss for me, on something that I know works right now.

However writing the custom component from scratch definitely blew my mind, for the mere fact that it actually just worked. I am 100% sure its not the best written component, but I will change it as I notice things along the way. This definitely saved me a bunch of effort writing something.
 
Please do share the interesting stuff you come up with.

I thought about this after reading
First I tried to optimize my own automations first, but I dropped that idea when the changed code seemed...to change the actual function of my automations. At least, it was a big miss for me, on something that I know works right now.

However writing the custom component from scratch definitely blew my mind, for the mere fact that it actually just worked. I am 100% sure its not the best written component, but I will change it as I notice things along the way. This definitely saved me a bunch of effort writing something.
This is something I want to look into - one day in the distant future. I'm pretty sure Home-Assistant has developed far enough that most of my automations can be reduced considerably. (I have 200 odd at the moment)
 
This is something I want to look into - one day in the distant future. I'm pretty sure Home-Assistant has developed far enough that most of my automations can be reduced considerably. (I have 200 odd at the moment)
Yeah I agree, it is also on my radar for the future. Sorta doing a cleanup at the same time as well. Perhaps if I spend some time to engineer the prompt correctly it can be done. I tried to search for prompts others have come up already with, which is how I stumbled on that reddit. However in my search I couldn't find any examples except for people saying, rather learn yaml forget genai.

edit:
The ideas I have for this is:
  • Improve readability and maintainability
  • Eliminate code duplication
  • Enhance code modularity
  • Update legacy code to modern standards

There are other improvements genai can do, that is not really important to me or not even applicable to home assistant automations:
  • Performance improvement
  • Time complexity
  • Error handling (debatable)
  • Test coverage (HA itself has that, automations bleh)
 
Top
Sign up to the MyBroadband newsletter