Skip to content

Commit

Permalink
Completion of information on docs website (#333)
Browse files Browse the repository at this point in the history
* Add introduction page

* Add getting started docs page

* Update sidebars and add configuration doc page

* Add diagram page on reference category

* Add hardware shopping table

* Add instructions for firmware install and connect to HA

* Update the last steps for getting started

* Add cases page under reference

* Update case descriptions and add request for contributions

* Move FAQ to github pages

* Remove unused configuration file

* Update FAQ and Introduction documentation

* Refactor readme and update project description

* Delete unused files and update sidebar configuration

* Add advanced part to customize firmware

* Configuration page for renaming device

* Delete unnecessary files and add first blog post

* Update link to 3D printed case in readme

* Remove the blog for now

* Enable push trigger for main branch in build-firmware.yaml
  • Loading branch information
klaasnicolaas authored Jan 11, 2024
1 parent 1fca587 commit 17e40b3
Show file tree
Hide file tree
Showing 54 changed files with 524 additions and 776 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-firmware.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
name: Build & Deploy firmware

on:
# push:
# branches:
# - main
push:
branches:
- main
# release:
# types:
# - published
Expand Down
130 changes: 14 additions & 116 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
[![GitHub Last Commit][last-commit-shield]][commits]
[![Contributors][contributors-shield]][contributors-url]

> [!Warning]
> Currently the documentation does not match the current codebase, this is due to a refactor and working towards a [v4 release](https://github.com/klaasnicolaas/home-assistant-glow/discussions/222). If you want to use the stable release (v3.1.0)? Then use this [documentation](https://github.com/klaasnicolaas/home-assistant-glow/blob/v3.1.0/Readme.md) and the following [`home_assistant_glow.yaml`](https://github.com/klaasnicolaas/home-assistant-glow/blob/eda2baa1c96b033dc2262be7ec70a49ea7d9dfaf/home_assistant_glow.yaml) file.
During my internship at [Nabu Casa][nc] in the first half of 2021, I focused on energy management in homes and how to collect all energy data and display it on a dashboard. From core release **2021.8** you can now also get started with the [energy dashboard][energy] in Home Assistant!
During my internship at [Nabu Casa][nc] in the first half of 2021, I focused on energy management for your house, how to collect all energy data and display it on a dashboard. Since Home Assistant release **2021.8** it's possible to use the [Home Assistant Energy][energy] dashboard to display your energy usage. Unfortunately, not everyone has a smart meter and/or is equipped with a P1 port. This is where the Home Assistant Glow comes in!

<p align="center">
<img width="80%" src="assets/images/home-assistant-glow.jpg">
<img width="80%" src="docs/static/img/home-assistant-glow.jpg">
</p>

<details>
Expand All @@ -32,125 +29,32 @@ Home Assistant Glow makes a *(not so)* smart meter without a P1 port easily read

### How do I know if my meter is supported?

To make sure your meter will work with the Home Assistant Glow, you have to look for the **imp/kWh** rate (see picture). Note the value, because it will be of importance at a later stage to configure the `home_assistant_glow.yaml` file.
To make sure your meter will work with the Home Assistant Glow, you have to look for the `imp/kWh` rate on your meter (see picture). Make a note of this value because you may need it later when configuring your device.

<p align="center">
<img width="60%" src="assets/images/pulse_rate.png">
<img width="60%" src="docs/static/img/pulse_rate.png">
</p>

## Get Started

On the [documentation website](https://klaasnicolaas.github.io/home-assistant-glow/docs/introduction) you will find a complete walkthrough with which hardware you need, how to install the correct firmware on your ESP (using esp web tools) and how to add it to Home Assistant.

## Hardware

First, fill your 🛒 or see if you already have the components below.

- One of these microcontrollers
- One of the micro controllers
- ESP32 (recommended) - [Banggood][esp32-bg-shop] or [AliExpress][esp32-ali-shop]
- ESP8266 - [Banggood][esp8266-bg-shop] or [AliExpress][esp8266-ali-shop]
- Wemos D1 - [Banggood][wemos-d1-bg-shop] or [AliExpress][wemos-d1-ali-shop]
- Wemos D1 mini - [Banggood][wemos-d1-bg-shop] or [AliExpress][wemos-d1-ali-shop]
- [Dupont Jumpers][dupont-jumpers-shop]
- 3D printed case (see the [case](/case) folder)
- 3D printed case (see the [case](https://klaasnicolaas.github.io/home-assistant-glow/docs/reference/cases) folder)
- Photodiode: [Banggood][photodiode-bg-shop] or [AliExpress][photodiode-ali-shop] (make sure that you do not accidentally order or receive an LDR)
- LED RGB 5mm 4 pin - kathode: [Banggood][rgbled-bg-shop] or [AliExpress][rgbled-ali-shop]

### Visual schema

Below you will find a visual schema of how everything is connected, depending on the type of board you use, the GPIO pins may be in a different place.

<p align="center">
<img width="90%" src="assets/images/schema.png">
</p>

### Diagrams

In the tables below you will find more information, about how to connect the photodiode PCB and the status LED.

#### Photodiode

How the photodiode is connected to the ESP board of your choice.

| PHOTODIODE | ESP32 | Wemos D1 / ESP8266 |
|------------|--------------|--------------------|
| A0 | NOT USING | NOT USING |
| DO | D13 (GPIO13) | D7 (GPIO13) |
| VCC | 3V3 | 3V3 |
| GND | GND | GND |

For problems with the measurements, see the [FAQ part](#faq) further down.

#### Status LED

How the status LED is connected to the ESP board of your choice. For each measured pulse, the LED will briefly flash <span style="color:red">*red*</span> and in case of no WiFi connection, the LED will continue to flash <span style="color:blue">*blue*</span>.

| LED | ESP32 | D1 mini / ESP8266 |
|--------|------------|-------------------|
| RED | D2 (GPIO2) | D4 (GPIO2) |
| GREEN | D4 (GPIO4) | D2 (GPIO4) |
| BLUE | D5 (GPIO5) | D1 (GPIO5) |
| GND | GND | GND |

### 3D printed case

You can use the [3D printed case](/case) to neatly hide everything, but it is specifically made for the ESP32S. If you use another board, you could adjust the design with the `.step` file. If you've made some changes, I'd appreciate it if you add the new case design to the repository for everyone to benefit 😉

## Get started

Once you are done connecting all the hardware, we'll get started with the configuration for ESPHome. In this repository you will find the file [home_assistant_glow.yaml][file], which you can copy into the `esphome` folder of your Home Assistant config.

### Configuration

After you go through the installation wizard of ESPHome and flash your ESP32/8266, you need to change the `pulse rate` to match with your meter ([how do I find my imp/kWh rate?](#how-do-i-know-if-my-meter-is-supported)). You can do this in 2 ways:

- Open the webserver of the Glow and change the value under `Pulse rate - imp/kWh`.
- Navigate to the device in Home Assistant and edit the number entity: `Pulse rate - imp/kWh`.

The default is **1000** and you can change it with steps of 100, between 100 and 10.000 (if your pulse rate falls outside the steps or value range, open an issue).

## FAQ

Anwers to some of the most frequently asked questions:

### Wrong soldered diode

Issue: [#34][issue_34]

A number of users have reported receiving the recommended diode board from various sources, only to find the diode has been soldered to the board the wrong way round. This can cause that your pulse LED is not measured regardless of the sensitivity you set for the diode.

<p align="center">
<img src="assets/images/correct_board.png">
</p>

The large triangular part of the diode, should be soldered to the positive side of the board not the negative. If yours is orientated as above, you should desolder the photodiode invert it and resolder so the larger triangular part of the diode is connected to positive.

### Reduce the amount of data the sensors produce

Depending on the configured `pulse rate`, the type of house/apartment and the heating system in use, the sensors that are exposed to Home Assistant may produce a lot of data. For example, with the default `pulse rate` 1000, a power consumption of 3600 W means that the sensors produce 2 HA state changes per second (which means 7200 state changes per hour). If you don't need that kind of granularity, you can use [ESPHome sensor filters](https://esphome.io/components/sensor/index.html#sensor-filters) to reduce the rate of updates written to Home Assistant. With the commented-out filters in the [home_assistant_glow.yaml][file] enabled, only 396 state changes will be produced per hour.

### My Daily Energy won't reset

Issue: [#140][issue_140]

By default, the Home Assistant Glow uses the `homeassistant` [time platform][time-platform], which synchronizes the current time via the native API from your home assistant config. If this doesn't work, you could consider using the `sntp` time platform, as in the example below:

```yaml
time:
- platform: sntp
id: sntp_time
```
### Error 4 / Out of memory
Issue: [#240][issue_240]
With this error there is a chance that the instance your ESPHome is running on may be out of memory (possibly on a Raspberry Pi with less RAM), you can solve this by limiting the number of processes at compiling time using [compile_process_limit][compile_process_limit].
```yaml
esphome:
compile_process_limit: 1
```
## Contributing

This is an active open-source project. We are always open to people who want to
use the code or contribute to it.
This is an active open-source project. We are always open to people who want to use the code or contribute to it.

We've set up a separate document for our
[contribution guidelines](CONTRIBUTING.md).
Expand All @@ -159,7 +63,7 @@ Thank you for being involved! :heart_eyes:

## Disclamer

We use aliexpress / banggood affiliate links for the components and the tools. Some Ad-blockers might block these links an thus they seem to appear broken. You will have to temporarely disable ad-blocker to open these links.
We use AliExpress / Banggood affiliate links for the components and the tools. Some Ad-blockers might block these links an thus they seem to appear broken. You will have to temporarily disable ad-blocker to open these links.

## License

Expand All @@ -186,15 +90,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

<!-- MARKDOWN LINKS & IMAGES -->
[file]: /home_assistant_glow.yaml
[esphome]: https://esphome.io
[nc]: https://www.nabucasa.com
[energy]: https://home-assistant.io/docs/energy/
[issue_34]: https://github.com/klaasnicolaas/home-assistant-glow/issues/34
[issue_140]: https://github.com/klaasnicolaas/home-assistant-glow/issues/140
[issue_240]: https://github.com/klaasnicolaas/home-assistant-glow/issues/240
[time-platform]: https://esphome.io/components/time.html#home-assistant-time-source
[compile_process_limit]: https://esphome.io/components/esphome.html?highlight=compile_process_limit
[energy]: https://www.home-assistant.io/home-energy-management

<!-- Shields -->
[maintenance-shield]: https://img.shields.io/maintenance/yes/2024.svg
Expand Down
12 changes: 0 additions & 12 deletions docs/blog/2019-05-28-first-blog-post.md

This file was deleted.

44 changes: 0 additions & 44 deletions docs/blog/2019-05-29-long-blog-post.md

This file was deleted.

20 changes: 0 additions & 20 deletions docs/blog/2021-08-01-mdx-blog-post.mdx

This file was deleted.

Binary file not shown.
25 changes: 0 additions & 25 deletions docs/blog/2021-08-26-welcome/index.md

This file was deleted.

22 changes: 5 additions & 17 deletions docs/blog/authors.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
endi:
name: Endilie Yacop Sucipto
title: Maintainer of Docusaurus
url: https://github.com/endiliey
image_url: https://github.com/endiliey.png

yangshun:
name: Yangshun Tay
title: Front End Engineer @ Facebook
url: https://github.com/yangshun
image_url: https://github.com/yangshun.png

slorber:
name: Sébastien Lorber
title: Docusaurus maintainer
url: https://sebastienlorber.com
image_url: https://github.com/slorber.png
klaas:
name: Klaas Schoute
title: Founder of Glow
url: https://github.com/klaasnicolaas
image_url: https://github.com/klaasnicolaas.png
41 changes: 41 additions & 0 deletions docs/docs/advanced/firmware_customization.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
id: firmware_customization
title: Customizing the Firmware
description: How to adopt and customize the firmware for your own needs.
---

Since the Home Assistant Glow's firmware is based on [ESPHome](https://esphome.io), making
customizations to the firmware is as easy as editing some YAML. The best way to modify the
firmware config is by installing the [ESPHome Dashboard](https://esphome.io/guides/getting_started_hassio.html)
(or using it [via cli](https://esphome.io/guides/getting_started_command_line.html)).

## Adopting the Device

Once ESPHome Dashboard is running, and your Home Assistant Glow is connected to your network,
it should prompt you to adopt it.

<p align="left">
<img src={require('@site/static/img/customization/adopt.png').default} />
</p>


Go through the adoption flow; it will do these things:

1. Create an ESPHome configuration file
2. Set an API encryption key (used by Home Assistant or other native API consumers)
3. Bake the Wi-Fi credentials into the firmware
4. Install the new firmware to the device

## Understanding the Configuration

### Components

To keep things maintainable and to make it easier to build firmware for different board types,
each large part of the configuration is broken up into its own "components". There are currently
three components, all of which are included in the base config:

- `basis.yaml`: Entities related to the basic functionality of the device
- `pulse_meter.yaml`: Entities related to the pulse meter
- `status_led.yaml`: Entities related to the status LED

You can see the source for all the components [here](https://github.com/klaasnicolaas/home-assistant-glow/tree/main/components).
32 changes: 32 additions & 0 deletions docs/docs/configuration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
id: configuration
title: Configuration
---

## Renaming the Device

By default, the name of your Home Assistant Glow in Home Assistant is `home-assistant-glow-XXXXXX`, where `XXXXXX`
is derived from the MAC address of the device. This is not very descriptive, so you can change it to something more
meaningful.

In the Home Assistant UI, navigate to your Home Assistant Glow by going to [**Settings** > **Devices & Services** > **ESPHome**][esphome-devices],
then select your Home Assistant Glow. You can also click the my badge below to go directly to your ESPHome devices overview page:

[![Open your Home Assistant instance and show an integration.](https://my.home-assistant.io/badges/integration.svg)][esphome-devices]

On the device's page, press the pencil icon in the top-right to edit the name.

<p align="left">
<img src={require('@site/static/img/configuration/rename-device.png').default} />
</p>

After you've changed the name, click on **Update** to save the changes.

:::info
Home Assistant may ask if you want to rename the entity IDs as well. If you don't already have automations,
dashboards, etc. using the entity IDs, it's probably a good idea to do that now so the entity IDs are more
readable. But if you already are using the entity IDs in other places, you can opt not to rename them, and
just change the name of the device.
:::

[esphome-devices]: https://my.home-assistant.io/redirect/integration/?domain=esphome
Loading

0 comments on commit 17e40b3

Please sign in to comment.