Skip to content

Commit

Permalink
Merge pull request #106 from Lyr3x/dev
Browse files Browse the repository at this point in the history
Bugfixes
  • Loading branch information
Lyr3x authored Jan 18, 2022
2 parents 5ff29a7 + e50afb6 commit 2f21c14
Show file tree
Hide file tree
Showing 21 changed files with 456 additions and 119 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI
on:
push:
paths:
- "components/**"
- "ci/**"
workflow_dispatch:

jobs:
validate:
strategy:
matrix:
esp: ["esp32", "esp8266"]
name: Validate ${{ matrix.esp }} config
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@master
with:
python-version: "3.x"
- name: Install ESPHome
run: |
python -m pip install --upgrade pip
pip install -U esphome
pip install -U pillow
- name: Validate ${{ matrix.esp }} default Config
run: esphome config ci/${{ matrix.esp }}.yaml

- name: Validate ${{ matrix.esp }} manual Config
run: esphome config ci/${{ matrix.esp }}_manual.yaml
build:
strategy:
matrix:
esp: ["esp32", "esp8266"]
name: Build ${{ matrix.esp }} firmware
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@master
with:
python-version: "3.x"
- name: Install ESPHome
run: |
python -m pip install --upgrade pip
pip install -U esphome
pip install -U pillow
- name: Build ${{ matrix.esp }} default config
run: esphome compile ci/${{ matrix.esp }}.yaml

- name: Build ${{ matrix.esp }} manual config
run: esphome compile ci/${{ matrix.esp }}_manual.yaml
22 changes: 0 additions & 22 deletions .github/workflows/main.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Release

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Create release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ github.ref }}
prerelease: false
title: ${{ github.ref }}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 1.5.0

- Manual ROI configuration fixed
- Sensor initialization fixed
- Fix setup priorities to ensure proper boot up
- Code formatting
- Cleanup

## 1.4.1

- Timing budget test by @Lyr3x in #60
Expand Down
42 changes: 27 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# RooDe

[![Build](https://github.com/Lyr3x/Roode/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/Lyr3x/Roode/blob/master/.github/workflows/main.yml)

People counter working with any smart home system which supports ESPHome and therefore Home Assistant. All necessary entities are created automatically.
[![GitHub release](https://img.shields.io/github/v/tag/Lyr3x/Roode?style=flat-square)](https://GitHub.com/Lyr3x/Roode/releases/)
[![Build](https://img.shields.io/github/workflow/status/Lyr3x/Roode/CI?style=flat-square)](https://github.com/Lyr3x/Roode/blob/master/.github/workflows/ci.yml)
[![Maintenance](https://img.shields.io/maintenance/yes/2023?style=flat-square)](https://GitHub.com/Lyr3x/Roode/graphs/commit-activity)

[![Roode community](https://img.shields.io/discord/879407995837087804.svg?label=Discord&logo=Discord&colorB=7289da&style=for-the-badge)](https://discord.gg/hU9SvSXMHs)

People counter working with any smart home system which supports ESPHome/MQTT like Home Assistant. All necessary entities are created automatically.

- [Hardware Recommendation](#hardware-recommendation)
- [Wiring](#wiring)
- [ESP32](#esp32)
Expand All @@ -27,6 +29,7 @@ People counter working with any smart home system which supports ESPHome and the
- **Pololu** <-- Recommended
- GY-53
- Black PCB chinese sensor
- Pimoroni
- 1A Power Supply **Do not use an USB port of your computer!**
- Encolsure (see .stl files) - will be updated soon!
Pins:
Expand Down Expand Up @@ -71,21 +74,24 @@ Ps=0 (when connected to GND): In the IIC mode, the user can operate the chip by
Roode is provided as an external_component which means it is easy to setup in any ESPHome sensor configuration file.

Other than base ESPHome configuration the only config that's needed for Roode is

```yaml
external_components:
- source: github://Lyr3x/Roode
- source: github://Lyr3x/Roode@master
refresh: always

vl53l1x:
roode:
```
This uses the recommended default configuration.
However, we offer a lot of flexibility. Here's the full configuration spelled out.
However, we offer a lot of flexibility. Here's the full configuration spelled out.
```yml
external_components:
- source: github://Lyr3x/Roode
refresh: always
ref: master

# VL53L1X sensor configuration is separate from Roode people counting algorithm
vl53l1x:
Expand Down Expand Up @@ -124,35 +130,35 @@ roode:
# The current default is
roi: { height: 16, width: 6 }
# We have an experiential automatic mode that can be enabled with
roi: auto
# roi: auto
# or only automatic for one dimension
roi: { height: 16, width: auto }
# roi: { height: 16, width: auto }

# The detection thresholds for determining whether a measurement should count as a person crossing.
# A reading must be greater than the minimum and less than the maximum to count as a crossing.
# These can be given as absolute distances or as percentages.
# Percentages are based on the automatically determined idle or resting distance.
# Percentages are based on the automatically determined idle or resting distance.
detection_thresholds:
min: 0% # default minimum is any distance
min: 0% # default minimum is any distance
max: 85% # default maximum is 85%
# an example of absolute units
min: 50mm
max: 234cm
# min: 50mm
# max: 234cm

# The people counting algorithm works by splitting the sensor's capability reading area into two zones.
# This allows for detecting whether a crossing is an entry or exit based on which zones was crossed first.
zones:
# Flip the entry/exit zones. If Roode seems to be counting backwards, set this to true.
invert: false

# Entry/Exit zones can set overrides for individual ROI & detection thresholds here.
# Entry/Exit zones can set overrides for individual ROI & detection thresholds here.
# If omitted, they use the options configured above.
entry:
# Entry zone will automatically configure ROI, regardless of ROI above.
# Entry zone will automatically configure ROI, regardless of ROI above.
roi: auto
exit:
roi:
# Exit zone will have a height of 8 and a width of number set above or default or auto
# Exit zone will have a height of 8 and a width of number set above or default or auto
height: 8
# Additionally, zones can manually set their center point.
# Usually though, this is left for Roode to automatically determine.
Expand All @@ -165,17 +171,23 @@ roode:
max: 70%
```
Also feel free to check out running examples for:
- [Wemos D1 mini with ESP32](peopleCounter32.yaml)
- [Wemos D1 mini with ESP8266](peopleCounter8266.yaml)
### Sensors
#### People Counter
The most important one is the people counter.
```yaml
number:
- platform: roode
people_counter:
name: People Count
```
Regardless of how close we can get, people counting will never be perfect.
This allows the current people count to be adjusted easily via Home Assistant.
Expand Down
64 changes: 64 additions & 0 deletions ci/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
substitutions:
devicename: ci
friendly_name: $devicename

external_components:
refresh: always
source: ../components

esphome:
name: $devicename

button:
- platform: restart
name: $friendly_name Restart
entity_category: config
- platform: template
name: $friendly_name Recalibrate
on_press:
- lambda: id(roode_platform)->recalibration();
entity_category: config

number:
- platform: roode
people_counter:
name: $friendly_name people counter

binary_sensor:
- platform: roode
presence_sensor:
name: $friendly_name presence

sensor:
- platform: roode
id: roode_sensors
distance_entry:
name: $friendly_name distance zone 0
distance_exit:
name: $friendly_name distance zone 1
max_threshold_entry:
name: $friendly_name max zone 0
max_threshold_exit:
name: $friendly_name max zone 1
min_threshold_entry:
name: $friendly_name min zone 0
min_threshold_exit:
name: $friendly_name min zone 1
roi_height_entry:
name: $friendly_name ROI height zone 0
roi_width_entry:
name: $friendly_name ROI width zone 0
roi_height_exit:
name: $friendly_name ROI height zone 1
roi_width_exit:
name: $friendly_name ROI width zone 1
sensor_status:
name: Sensor Status

text_sensor:
- platform: roode
version:
name: $friendly_name version
- platform: roode
entry_exit_event:
name: $friendly_name last direction
17 changes: 17 additions & 0 deletions ci/esp32.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<<: !include common.yaml

esp32:
board: wemos_d1_mini32
framework:
type: arduino

i2c:
sda: 21
scl: 22

# VL53L1X sensor configuration is separate from Roode people counting algorithm
vl53l1x:
calibration:

roode:
id: roode_platform
21 changes: 21 additions & 0 deletions ci/esp32_manual.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<<: !include esp32.yaml

vl53l1x:
calibration:
ranging: short

roode:
id: roode_platform
sampling: 1
roi: { height: 16, width: 6 }
detection_thresholds:
max: 85%
zones:
entry:
roi: { height: 15, width: 6 }
detection_thresholds:
max: 80%
exit:
roi: { height: 14, width: 6 }
detection_thresholds:
max: 75%
16 changes: 16 additions & 0 deletions ci/esp8266.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<<: !include common.yaml
esphome:
name: $devicename
platform: ESP8266
board: d1_mini

i2c:
sda: 4
scl: 5

# VL53L1X sensor configuration is separate from Roode people counting algorithm
vl53l1x:
calibration:

roode:
id: roode_platform
21 changes: 21 additions & 0 deletions ci/esp8266_manual.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<<: !include esp8266.yaml

vl53l1x:
calibration:
ranging: short

roode:
id: roode_platform
sampling: 1
roi: { height: 16, width: 6 }
detection_thresholds:
max: 85%
zones:
entry:
roi: { height: 15, width: 6 }
detection_thresholds:
max: 80%
exit:
roi: { height: 14, width: 6 }
detection_thresholds:
max: 75%
Loading

0 comments on commit 2f21c14

Please sign in to comment.