Compare commits
7 Commits
0.0.0
...
2025.05.20
Author | SHA1 | Date | |
---|---|---|---|
e02ced287b | |||
7445bd02a2 | |||
3aee2ea61b | |||
6e6a3b211c | |||
f217963770 | |||
e488bb655b | |||
8e8404ade9 |
@ -8,11 +8,6 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
container:
|
|
||||||
image: git.nicelycomposed.codes/koshyk-io/flutter-gitea-action-image-builder:latest
|
|
||||||
credentials:
|
|
||||||
username: ${{ secrets.IMAGE_REGISTRY_USER }}
|
|
||||||
password: ${{ secrets.IMAGE_REGISTRY_PASSWORD }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source code
|
- name: Checkout source code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -29,19 +24,19 @@ jobs:
|
|||||||
working-directory: ${{ gitea.workspace }}
|
working-directory: ${{ gitea.workspace }}
|
||||||
run: |
|
run: |
|
||||||
yarn build
|
yarn build
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
- name: Login to Registry
|
- name: Login to Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: git.nicelycomposed.codes
|
registry: git.nicelycomposed.codes
|
||||||
username: ${{ secrets.IMAGE_REGISTRY_USER }}
|
username: ${{ secrets.IMAGE_REGISTRY_USER }}
|
||||||
password: ${{ secrets.IMAGE_REGISTRY_PASSWORD }}
|
password: ${{ secrets.IMAGE_REGISTRY_PASSWORD }}
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
- name: Build docker image
|
- name: Build docker image
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
git.nicelycomposed.codes/yehor/www-yevi-org:${{ gitea.ref_name }}
|
git.nicelycomposed.codes/yevi.org/www-yevi-org:${{ gitea.ref_name }}
|
||||||
git.nicelycomposed.codes/yehor/www-yevi-org:latest
|
git.nicelycomposed.codes/yevi.org/www-yevi-org:latest
|
||||||
|
15
README.md
@ -24,18 +24,3 @@ $ yarn build
|
|||||||
|
|
||||||
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
||||||
|
|
||||||
### Deployment
|
|
||||||
|
|
||||||
Using SSH:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ USE_SSH=true yarn deploy
|
|
||||||
```
|
|
||||||
|
|
||||||
Not using SSH:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ GIT_USER=<Your GitHub username> yarn deploy
|
|
||||||
```
|
|
||||||
|
|
||||||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
slug: making-a-wifi-enabled-smart-air-humidifier
|
slug: making-a-wifi-enabled-smart-air-humidifier
|
||||||
title: "DIY Smart Appliance: Making a WiFi-enabled smart air humidifier from a regular one"
|
title: "DIY Smart Appliance: Making a WiFi-enabled smart air humidifier from a regular one"
|
||||||
tags: [smart home, DIY, ESP8266, ESPHome, humidifier, Wemos D1 mini, WiFi]
|
tags: [smart home, DIY, ESP8266, ESPHome, humidifier, Wemos D1 mini, WiFi]
|
||||||
|
image: /img/blog/2018/06/001.jpg
|
||||||
---
|
---
|
||||||
|
|
||||||
So there was a simple air humidifier… Actually, this post is a good example of how to make your regular boring home appliance a little smarter. The main part of my humidifier will be the Wemos (or Lolin) D1 mini board based on the ESP8266 WiFi chip.
|
So there was a simple air humidifier… Actually, this post is a good example of how to make your regular boring home appliance a little smarter. The main part of my humidifier will be the Wemos (or Lolin) D1 mini board based on the ESP8266 WiFi chip.
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
---
|
||||||
|
slug: smart-doorbell-with-xiaomi-aqara-button-and-google-home
|
||||||
|
title: "Smart doorbell with Xiaomi Aqara button and Google Home"
|
||||||
|
tags: [smart home, Aqara, Xaomi, Home Assistant]
|
||||||
|
image: /img/blog/2019/02/doorbell.jpeg
|
||||||
|
---
|
||||||
|
|
||||||
|
So I have several Xiaomi Aqara buttons. Today I want to explain how to use this button as a smart doorbell that will play sound to your Google Home device through Home Assistant.
|
||||||
|
|
||||||
|
<!-- truncate -->
|
||||||
|
|
||||||
|
All my Aqara ZigBee devices are connected to Home Assistant via [ConBee II](https://phoscon.de/en/conbee2) and [deCONZ](https://www.home-assistant.io/integrations/deconz).
|
||||||
|
|
||||||
|
First of all, let’s create a script that will be executed when the button is pressed. In your `scripts.yaml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
doorbell:
|
||||||
|
alias: Doorbell
|
||||||
|
sequence:
|
||||||
|
- data:
|
||||||
|
entity_id: media_player.googlehome4615 #Your Google Home device
|
||||||
|
service: media_player.turn_on
|
||||||
|
- delay: 00:00:03 #To make sure we are connected to Google Home
|
||||||
|
- data:
|
||||||
|
entity_id: media_player.googlehome4615 #Your Google Home device
|
||||||
|
media_content_id: https://your.homeassistant.domain:8123/local/doorbell.mp3
|
||||||
|
media_content_type: music
|
||||||
|
service: media_player.play_media
|
||||||
|
- delay: 00:00:05 #The same as doorbell.mp3 file ledgth
|
||||||
|
- data:
|
||||||
|
entity_id: media_player.googlehome4615
|
||||||
|
service: media_player.turn_off
|
||||||
|
```
|
||||||
|
|
||||||
|
To make `doorbell.mp3` available by that URL you need to place it to `/config/www` in your Home Assistant.
|
||||||
|
|
||||||
|
Now we need to create a handler of the Aqara button in `automations.yaml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- id: doorbell_notify
|
||||||
|
alias: Doorbell notify
|
||||||
|
trigger:
|
||||||
|
- entity_id: script.doorbell
|
||||||
|
from: 'off'
|
||||||
|
platform: state
|
||||||
|
to: 'on'
|
||||||
|
condition: []
|
||||||
|
action:
|
||||||
|
- data:
|
||||||
|
message: "Someone near your front door"
|
||||||
|
service: notify.push
|
||||||
|
```
|
After Width: | Height: | Size: 10 KiB |
@ -0,0 +1,137 @@
|
|||||||
|
---
|
||||||
|
slug: home-assistant-presence-detection-with-google-wifi
|
||||||
|
title: "Home Assistant presence detection with Google WiFi"
|
||||||
|
tags: [smart home, Google WiFi, Home Assistant, home automation]
|
||||||
|
image: /img/blog/2019/02/presence.jpeg
|
||||||
|
---
|
||||||
|
|
||||||
|
Previously my presence detection in Home Assistant works through Asus router and `asuswrt` component. And it was bad. Very bad. Recently I switched to Google WiFi and realized that the only way to implement presence detection with this router is IFTTT (Update: No). I thought it would be the slowest presence detection in the world but I was wrong.
|
||||||
|
|
||||||
|
<!-- truncate -->
|
||||||
|
:::info
|
||||||
|
|
||||||
|
While you still can do this through IFTTT you need to know that there is much easier way not depending on your router model and any 3rd party services – [Nmap Tracker](https://www.home-assistant.io/integrations/nmap_tracker). You just enable this component and configure your devices IP addresses.
|
||||||
|
I configured static IP addresses for devices I wanted to track using [DHCP IP Reservation](https://support.google.com/wifi/answer/6274660?hl=en) on Google WiFi router.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
If you still want to use IFTTT, you are welcome to continue reading.
|
||||||
|
|
||||||
|
## Home Assistant IFTTT webhook
|
||||||
|
|
||||||
|
First of all, we need to create a webhook for IFTTT in our Home Assistant instance through Integrations. Go to “Configuration” -> “Integrations” in the Home Assistant web UI. Find “IFTTT” in the “Set up a new integration” section and click “CONFIGURE”. You will be provided with a webhook URL to use in IFTTT applets. It should look similar to this:
|
||||||
|
|
||||||
|
```
|
||||||
|
https://ha.mydomain.com:8123/api/webhook/e7cd74856399e8934b8f5beffeeeaee4c351cdc8373647585ec040c7b69c2b999
|
||||||
|
```
|
||||||
|
|
||||||
|
Save this URL somewhere because you will not be able to see it again in your Home Assistant UI.
|
||||||
|
|
||||||
|
## Home Assistant Entities
|
||||||
|
|
||||||
|
For presence detection, I’m using `binary_sensors` with `device_class: presence`. Also, the state of those sensors depends on the corresponding `input_boolean`. It is made to be able to switch someone’s presence on and off manually by adding `input_boolean` to UI and switching its state. Don’t set the initial state for input_boolean. It will make it possible to save and restore its state on HA reboots. Also, I set these sensors to have different pictures depending on their presence.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
input_boolean:
|
||||||
|
is_yegor_home:
|
||||||
|
name: “Yegor’s presence”
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: template
|
||||||
|
sensors:
|
||||||
|
presence_yegor:
|
||||||
|
friendly_name: "Yegor"
|
||||||
|
value_template: "{{ is_state('input_boolean.is_yegor_home', 'on') }}"
|
||||||
|
device_class: presence
|
||||||
|
entity_picture_template: "/local/yegor_picture_bw.jpg"
|
||||||
|
```
|
||||||
|
|
||||||
|
## IFTTT applets
|
||||||
|
|
||||||
|
Next. There is an official Google WiFi service in IFTTT and it can create IF’s like “If some device connected/disconnected”. That’s exactly what we need.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Open [IFTTT website](https://ifttt.com/) and log in with your account. Go to “My Applets” and click “New Applet” in the upper right corner.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Then hit “+this”, search for “Google WiFi” and click it. You will be asked to authorize IFTTT in your google account. After that you will be able to select one of the triggers Google WiFi can send to IFTTT:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Let’s start with “Device connects”. Click it and select the device name you want to track in the next step.
|
||||||
|
|
||||||
|
Next, you will be asked to create an action by clicking “+that”. For action, you need to find the “Webhooks” service and choose the only action it provides – “Make a web request”.
|
||||||
|
|
||||||
|
Now we need to fill all the fields for web request:
|
||||||
|
|
||||||
|
URL: `[The url of our Home Assistant webhook we created recently]`
|
||||||
|
|
||||||
|
Method: `POST`
|
||||||
|
|
||||||
|
Content Type: `application/json`
|
||||||
|
|
||||||
|
Body: `{ "action": "call_service", "service": "input_boolean.turn_on", "entity_id": "input_boolean.is_yegor_home"}`
|
||||||
|
|
||||||
|
## Handling IFTTT requests
|
||||||
|
|
||||||
|
The last thing we need is to create a handler in Home Assistant for web requests from IFTTT. It will be new automation:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- id: 'ifttt_webhook'
|
||||||
|
alias: IFTTT Webhook
|
||||||
|
trigger:
|
||||||
|
platform: event
|
||||||
|
event_type: ifttt_webhook_received
|
||||||
|
event_data:
|
||||||
|
action: call_service
|
||||||
|
action:
|
||||||
|
service_template: '{{ trigger.event.data.service }}'
|
||||||
|
data_template:
|
||||||
|
entity_id: '{{ trigger.event.data.entity_id }}'
|
||||||
|
```
|
||||||
|
|
||||||
|
This automation will handle any requests from IFTTT that will have `action: call_service` in their body with `service` and `entity_id` in it.
|
||||||
|
|
||||||
|
For disconnecting from Google WiFi we need to create another applet in IFTTT. It will be the same except for two things:
|
||||||
|
|
||||||
|
1. We should select “Device disconnects” from Google WiFi services when creating “+this” for applet.
|
||||||
|
1. We need to replace input_boolean.turn_on with input_boolean.turn_off in web request’s “Body” field when creating “+that” to make it looks like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
{ "action": "call_service", "service": "input_boolean.turn_off", "entity_id": "input_boolean.is_yegor_home"}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Automation based on presence
|
||||||
|
|
||||||
|
Assuming we’ve set up presence detection for everyone living in our home, we now need one variable to know if there is nobody home now. It would be helpful when creating automation that should be triggered when there is nobody home or when someone is back home. So we will add all our presence sensors in a group in `groups.yaml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
presence:
|
||||||
|
entities:
|
||||||
|
- binary_sensor.presence_someone
|
||||||
|
- binary_sensor.presence_yegor
|
||||||
|
- binary_sensor.presence_someone_else
|
||||||
|
```
|
||||||
|
|
||||||
|
Now we can rely on that group’s state to check if there is nobody home. I’ve added a delay of 10 minutes to make sure this automation will not be triggered when I simply reboot my device or there was a short connection lost to a router.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- id: 'nobody_home'
|
||||||
|
alias: 'Nobody home'
|
||||||
|
trigger:
|
||||||
|
- entity_id: group.presence
|
||||||
|
for:
|
||||||
|
minutes: 10
|
||||||
|
from: 'on'
|
||||||
|
platform: state
|
||||||
|
to: 'off'
|
||||||
|
condition: []
|
||||||
|
action:
|
||||||
|
- data:
|
||||||
|
message: “Looks like there is nobody home now”
|
||||||
|
service: notify.push
|
||||||
|
```
|
||||||
|
|
||||||
|
That is all for now. Thanks for reading.
|
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 34 KiB |
@ -0,0 +1,211 @@
|
|||||||
|
---
|
||||||
|
slug: using-variables-as-configuration-for-home-assistant-automation
|
||||||
|
title: "Using variables as configuration for Home Assistant automation"
|
||||||
|
tags: [smart home, Home Assistant, home automation]
|
||||||
|
image: /img/blog/2020/11/variables.jpeg
|
||||||
|
---
|
||||||
|
|
||||||
|
Home Assistant 0.115 got the ability to use variables in automation and scripts. You can declare variables even using templates and use them across the script or automation.
|
||||||
|
Here is an example from the release notes:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
automation:
|
||||||
|
trigger:
|
||||||
|
platform: sun
|
||||||
|
event: sunset
|
||||||
|
offset: -00:30
|
||||||
|
variables:
|
||||||
|
notification_service: notify.paulus_iphone
|
||||||
|
action:
|
||||||
|
- service: "{{ notification_service }}"
|
||||||
|
data:
|
||||||
|
message: Beautiful sunset!
|
||||||
|
```
|
||||||
|
<!-- truncate -->
|
||||||
|
It is very useful and fun feature but at first I didn’t realize how powerful it is. Today I want to show you an example how you can use variables as some sort of configuration for automation to avoid creating a lot of `if`s and automation to handle identical tasks.
|
||||||
|
|
||||||
|
I have a lot of ZigBee wall switches. Previously I had a separate automation to handle each of them. Every automation was handling:
|
||||||
|
|
||||||
|
- First button press – toggle the lights with max brightness
|
||||||
|
- Second button press – toggle the lights with low brightness
|
||||||
|
- First button long press – increase the brightnress
|
||||||
|
- Second button long press – decrease the brightness
|
||||||
|
|
||||||
|
After implementing `variables` for automation I decided to store the mapping of device id, event (represents the button pressed and the type of press: long or short), corresponding brightness and light `entity_id` in `variables` like this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
variables:
|
||||||
|
device_map:
|
||||||
|
00:15:8d:00:02:cb:1a:9b:
|
||||||
|
light_entity_id: light.kitchen
|
||||||
|
brightness_buttons:
|
||||||
|
1001: -30
|
||||||
|
1002: 50
|
||||||
|
2001: 30
|
||||||
|
2002: 100
|
||||||
|
00:15:8d:00:02:c9:39:62:
|
||||||
|
light_entity_id: light.hallway
|
||||||
|
brightness_buttons:
|
||||||
|
1001: -30
|
||||||
|
1002: 55
|
||||||
|
2001: 30
|
||||||
|
2002: 100
|
||||||
|
00:15:8d:00:02:e9:fe:9e:
|
||||||
|
light_entity_id: light.living_room
|
||||||
|
brightness_buttons:
|
||||||
|
1001: 30
|
||||||
|
1002: 100
|
||||||
|
2001: -30
|
||||||
|
2002: 60
|
||||||
|
00:15:8d:00:02:cb:64:b4:
|
||||||
|
light_entity_id: light.hallway
|
||||||
|
brightness_buttons:
|
||||||
|
1001: 30
|
||||||
|
1002: 100
|
||||||
|
2001: -30
|
||||||
|
2002: 60
|
||||||
|
00:15:8d:00:02:c9:37:7d:
|
||||||
|
light_entity_id: light.bedroom
|
||||||
|
brightness_buttons:
|
||||||
|
1001: 30
|
||||||
|
1002: 100
|
||||||
|
2001: -30
|
||||||
|
2002: 24
|
||||||
|
00:15:8d:00:02:58:61:74:
|
||||||
|
light_entity_id: light.bathroom
|
||||||
|
brightness_buttons:
|
||||||
|
1001: 30
|
||||||
|
1002: 100
|
||||||
|
2001: -30
|
||||||
|
2002: 40
|
||||||
|
```
|
||||||
|
|
||||||
|
So now I can take the brightness value from my `device_map` by device id and event. Also, I can take `entity_id` of the light each wall switch should control.
|
||||||
|
|
||||||
|
Also when I’m toggling the light I need to use `brightness_pct` service data to set the brightness, but when changing the brightness I need to use `brightness_step_pct`. So I added another variable to set the brightness service data name:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
variables:
|
||||||
|
brightness_attr: '{% if (trigger.event.data[''event''] == 2001) or (trigger.event.data[''event'']== 1001) %}brightness_step_pct{% else %}brightness_pct{% endif %}'
|
||||||
|
```
|
||||||
|
|
||||||
|
So when the button held the event is `2001` or `1001` (first and second button) and I need `brightness_step_pct`. I’m getting `brightness_pct` in another case.
|
||||||
|
|
||||||
|
Now we can use all these variables in `action`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
action:
|
||||||
|
- data:
|
||||||
|
'{{brightness_attr}}': '{{ device_map[trigger.event.data[''unique_id'']].brightness_buttons[trigger.event.data[''event'']]}}'
|
||||||
|
entity_id: '{{ device_map[trigger.event.data[''unique_id'']].light_entity_id}}'
|
||||||
|
service: light.{% if (trigger.event.data['event'] == 2001) or (trigger.event.data['event']== 1001) %}turn_on{% else %}toggle{% endif %}
|
||||||
|
```
|
||||||
|
|
||||||
|
Here we are using the most of variables – we are getting the right brightness value by the `unique_id` of our device and by the `event` that is representing the button and the type of press:
|
||||||
|
|
||||||
|
```
|
||||||
|
{{ device_map[trigger.event.data[''unique_id'']].brightness_buttons[trigger.event.data[''event'']]}}
|
||||||
|
```
|
||||||
|
|
||||||
|
Also, we are getting light `entity_id` by `unique_id` of the switch:
|
||||||
|
|
||||||
|
```
|
||||||
|
{{ device_map[trigger.event.data[''unique_id'']].light_entity_id}}
|
||||||
|
```
|
||||||
|
|
||||||
|
And the full automation:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- id: wall_switch_handler
|
||||||
|
alias: Wall switch handler
|
||||||
|
trigger:
|
||||||
|
- event_data:
|
||||||
|
event: 1001
|
||||||
|
event_type: deconz_event
|
||||||
|
platform: event
|
||||||
|
- event_data:
|
||||||
|
event: 1002
|
||||||
|
event_type: deconz_event
|
||||||
|
platform: event
|
||||||
|
- event_data:
|
||||||
|
event: 2001
|
||||||
|
event_type: deconz_event
|
||||||
|
platform: event
|
||||||
|
- event_data:
|
||||||
|
event: 2002
|
||||||
|
event_type: deconz_event
|
||||||
|
platform: event
|
||||||
|
condition:
|
||||||
|
- condition: template
|
||||||
|
value_template: '{{''wall_switch'' in trigger.event.data[''id'']}}'
|
||||||
|
action:
|
||||||
|
- data:
|
||||||
|
'{{brightness_attr}}': '{{ device_map[trigger.event.data[''unique_id'']].brightness_buttons[trigger.event.data[''event'']]}}'
|
||||||
|
entity_id: '{{ device_map[trigger.event.data[''unique_id'']].light_entity_id}}'
|
||||||
|
service: light.{% if (trigger.event.data['event'] == 2001) or (trigger.event.data['event']
|
||||||
|
== 1001) %}turn_on{% else %}toggle{% endif %}
|
||||||
|
variables:
|
||||||
|
brightness_attr: '{% if (trigger.event.data[''event''] == 2001) or (trigger.event.data[''event'']
|
||||||
|
== 1001) %}brightness_step_pct{% else %}brightness_pct{% endif %}'
|
||||||
|
device_map:
|
||||||
|
00:15:8d:00:02:cb:1a:9b:
|
||||||
|
light_entity_id: light.kitchen
|
||||||
|
brightness_buttons:
|
||||||
|
1001: -30
|
||||||
|
1002: 50
|
||||||
|
2001: 30
|
||||||
|
2002: 100
|
||||||
|
00:15:8d:00:02:c9:39:62:
|
||||||
|
light_entity_id: light.hallway
|
||||||
|
brightness_buttons:
|
||||||
|
1001: -30
|
||||||
|
1002: 55
|
||||||
|
2001: 30
|
||||||
|
2002: 100
|
||||||
|
00:15:8d:00:02:e9:fe:9e:
|
||||||
|
light_entity_id: light.living_room
|
||||||
|
brightness_buttons:
|
||||||
|
1001: 30
|
||||||
|
1002: 100
|
||||||
|
2001: -30
|
||||||
|
2002: 60
|
||||||
|
00:15:8d:00:02:cb:64:b4:
|
||||||
|
light_entity_id: light.hallway
|
||||||
|
brightness_buttons:
|
||||||
|
1001: 30
|
||||||
|
1002: 100
|
||||||
|
2001: -30
|
||||||
|
2002: 60
|
||||||
|
00:15:8d:00:02:c9:37:7d:
|
||||||
|
light_entity_id: light.bedroom
|
||||||
|
brightness_buttons:
|
||||||
|
1001: 30
|
||||||
|
1002: 100
|
||||||
|
2001: -30
|
||||||
|
2002: 24
|
||||||
|
00:15:8d:00:02:58:61:74:
|
||||||
|
light_entity_id: light.bathroom
|
||||||
|
brightness_buttons:
|
||||||
|
1001: 30
|
||||||
|
1002: 100
|
||||||
|
2001: -30
|
||||||
|
2002: 40
|
||||||
|
initial_state: true
|
||||||
|
mode: parallel
|
||||||
|
max: 10
|
||||||
|
```
|
||||||
|
|
||||||
|
I have not only wall switches so I’m using template condition here to make sure the switch is the wall switch:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
condition:
|
||||||
|
- condition: template
|
||||||
|
value_template: '{{''wall_switch'' in trigger.event.data[''id'']}}'
|
||||||
|
```
|
||||||
|
|
||||||
|
Also, this automation should be able to run in parallel to make it possible to handle several switch clicks at the same time in different rooms by different persons:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
mode: parallel
|
||||||
|
max: 10
|
||||||
|
```
|
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 149 KiB |
@ -0,0 +1,43 @@
|
|||||||
|
---
|
||||||
|
slug: bed-presence-detection-with-aqara-window-and-door-sensor-and-a-cheap-car-part
|
||||||
|
title: "Bed presence detection with Aqara window and door sensor and a cheap car part"
|
||||||
|
tags: [smart home, Home Assistant, home automation, DIY, Aqara, Xiaomi]
|
||||||
|
image: /img/blog/2020/12/bed.jpeg
|
||||||
|
---
|
||||||
|
Bed presence detection could be very useful in home automation to control the lights and appliances you don’t need at night, but want to be ready in the morning. And today we will build a bed presence sensor out of a very universal device for DIY IoT. It is an Aqara ZigBee window and door sensor. Why it is so universal? Let’s take a closer look at its internals.
|
||||||
|
|
||||||
|
<!-- truncate -->
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
See that little glass tube? That’s a [reed switch](https://en.wikipedia.org/wiki/Reed_switch). It operates under a magnetic field generated by the magnet inside the second part of the sensor. So, in general, it just closes the contact between two points of the electrical circuit. We can unsolder it and replace it with something else. A switch, for example. Or with a car seat pressure sensor, like this one:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
It could be found on Amazon or our favorite Chinese store just for 5$. It has two wires that could be closed or opened according to pressure presence. So all we need is to solder this sensor to the Aqara sensor’s board instead of the reed switch.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
I’ve removed the button cup from the top of the sensor to leave a hole for wires. Just remember to pair your sensor with whatever you are using as a ZigBee hub before doing this.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
All we need to do now is to put our new sensor under the mattress. I have a bed with wood slats that is narrower than the pressure sensor so I decided to put the sensor on a cardboard sheet
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
I made two sensors to separately detect the bed presence of me and my wife. You need to experiment with the sensor position to get the most accurate results. Also, you need to remember that the “open” state of the sensor means “the bed is not occupied” and “closed” means that “the bed is occupied”.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The third sensor on the screenshot is a Home Assistant [template binary sensor](https://www.home-assistant.io/integrations/binary_sensor.template/) that represents unconditional bed occupation. In other words, it is `on` when someone is in bed, and `off` otherwise:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
binary_sensor:
|
||||||
|
- platform: template
|
||||||
|
sensors:
|
||||||
|
bed_occupancy:
|
||||||
|
friendly_name: "Bed occupancy"
|
||||||
|
device_class: occupancy
|
||||||
|
value_template: "{{is_state('binary_sensor.bed_occupancy_door_side', 'off') or is_state('binary_sensor.bed_occupancy_window_side', 'off')}}"
|
||||||
|
```
|
After Width: | Height: | Size: 164 KiB |
After Width: | Height: | Size: 148 KiB |
After Width: | Height: | Size: 123 KiB |
After Width: | Height: | Size: 128 KiB |
After Width: | Height: | Size: 6.1 KiB |
@ -0,0 +1,45 @@
|
|||||||
|
---
|
||||||
|
slug: send-and-receive-sms-in-home-assistant-with-gsm-modem
|
||||||
|
title: "Send and receive SMS in Home Assistant with GSM modem"
|
||||||
|
tags: [smart home, Home Assistant, home automation, SMS, GSM]
|
||||||
|
image: /img/blog/2021/01/modem.jpg
|
||||||
|
---
|
||||||
|
Yes, it is possible and you don’t need to build anything from sources. Sending SMS from your home could be useful, for example, to send emergency alerts. But what about receiving and parsing SMS messages? Well, I used it to integrate my car security system with my Home Assistant. Now my Home Assistant could start the engine of my car automatically to warm it up before driving to work.
|
||||||
|
|
||||||
|
<!-- truncate -->
|
||||||
|
|
||||||
|
First of all, we need to set up notification service via GSM modem following the official [documentation](https://www.home-assistant.io/integrations/sms). This will allow us to send SMS messages by calling the notify service, for example in automation action:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
action:
|
||||||
|
- service: notify.sms
|
||||||
|
data:
|
||||||
|
message: Hi!
|
||||||
|
```
|
||||||
|
|
||||||
|
But also this integration allows reading SMS messages sent to the modem phone number by listening to the `sms.incoming_sms` event.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
trigger:
|
||||||
|
- platform: event
|
||||||
|
event_type: sms.incoming_sms
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
In automation `action`, we can now parse the message by searching keywords in it:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
action:
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: >-
|
||||||
|
{{'engine is off' in trigger.event.data['text']}}
|
||||||
|
sequence:
|
||||||
|
- ...
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Here we are checking for the `engine is off` text in incoming SMS to perform some action. For example, to set the value of some `input_boolean`.
|
After Width: | Height: | Size: 11 KiB |
@ -36,6 +36,14 @@ const config = {
|
|||||||
locales: ['en'],
|
locales: ['en'],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
scripts: [
|
||||||
|
{
|
||||||
|
src: 'https://plausible.nicelycomposed.codes/js/script.outbound-links.js',
|
||||||
|
defer: 'true',
|
||||||
|
'data-domain': 'yevi.org',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
presets: [
|
presets: [
|
||||||
[
|
[
|
||||||
'classic',
|
'classic',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yevi-org",
|
"name": "yevi-org",
|
||||||
"version": "0.0.2",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"docusaurus": "docusaurus",
|
"docusaurus": "docusaurus",
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
--ifm-color-primary-lightest: #6d266d;
|
--ifm-color-primary-lightest: #6d266d;
|
||||||
--ifm-code-font-size: 95%;
|
--ifm-code-font-size: 95%;
|
||||||
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
|
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
|
||||||
|
--ifm-footer-link-hover-color: #b07ab0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For readability concerns, you should choose a lighter palette in dark mode. */
|
/* For readability concerns, you should choose a lighter palette in dark mode. */
|
||||||
@ -27,5 +28,4 @@
|
|||||||
--ifm-color-primary-lighter: #c196c1;
|
--ifm-color-primary-lighter: #c196c1;
|
||||||
--ifm-color-primary-lightest: #d1b2d1;
|
--ifm-color-primary-lightest: #d1b2d1;
|
||||||
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
|
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
|
||||||
}
|
}
|
||||||
|
|
BIN
static/img/blog/2018/06/001.jpg
Normal file
After Width: | Height: | Size: 117 KiB |
BIN
static/img/blog/2019/02/doorbell.jpeg
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
static/img/blog/2019/02/presence.jpeg
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
static/img/blog/2020/11/variables.jpeg
Normal file
After Width: | Height: | Size: 88 KiB |
BIN
static/img/blog/2020/12/bed.jpeg
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
static/img/blog/2021/01/modem.jpg
Normal file
After Width: | Height: | Size: 28 KiB |