diff --git a/homeassistant/HA_part_2.html b/homeassistant/HA_part_2.html index 88b21a4..3583fd5 100644 --- a/homeassistant/HA_part_2.html +++ b/homeassistant/HA_part_2.html @@ -2,7 +2,7 @@ title: Part 2 description: published: 1 -date: 2024-02-09T22:00:58.996Z +date: 2024-02-09T22:06:09.721Z tags: editor: ckeditor dateCreated: 2024-02-09T21:57:47.138Z @@ -214,30 +214,24 @@ dateCreated: 2024-02-09T21:57:47.138Z

Create folder <config>/python_scripts

Create a file <config>/python_scripts/hello_world.py in the folder and give it this content:

# `data` is available as builtin and is a dictionary with the input data.

-

-

+

 

name = data.get("name", "world")

-

-

+

 

# `logger` and `time` are available as builtin without the need of explicit import.

-

-

+

 

logger.info("Hello {} at {}".format(name, time.time()))


 

Start Home Assistant to reload the script configuration.

Call your new python_script.hello_world service (with parameters) from the Services, using the YAML mode.

service: python_script.hello_world

-

-

+

 

data:

-

-

+

 

  name: "Input-Text"

Running this script show absolutely no output on the screen, but it logs with level info. You must have the Logger enabled at least for level info.

Your confiuration.yaml should include something like this.

logger:

-

-

+

 

  default: info


 


 

@@ -279,22 +273,7 @@ dateCreated: 2024-02-09T21:57:47.138Z

Now add the some graph to your dashboard.

6. Add air quality measurements to Home Assistant

For viewing the measurements in my lovelace dashboard I used a custom card called mini-graph-card, this card can be easily installed using HACS. I used the following Lovelace configuration.

-

type: 'custom:mini-graph-card' - name: Air quality inside - icon: 'mdi:server' - line_width: 2 - animate: true - hours_to_show: 24 - points_per_hour: 1.5 - entities: -  - entity: sensor.particulate_matter_1_0um_concentration -    name: 1 µm > -  - entity: sensor.particulate_matter_2_5um_concentration -    name: 2.5 µm > -  - entity: sensor.particulate_matter_10_0um_concentration -    name: 10 µm > - -

+

type: 'custom:mini-graph-card' name: Air quality inside icon: 'mdi:server' line_width: 2 animate: true hours_to_show: 24 points_per_hour: 1.5 entities:  - entity: sensor.particulate_matter_1_0um_concentration    name: 1 µm >  - entity: sensor.particulate_matter_2_5um_concentration    name: 2.5 µm >  - entity: sensor.particulate_matter_10_0um_concentration    name: 10 µm >

Adding measurements of outside air

To create additional context I also use Luftdaten integration to get outside air quality measurements nearby. This way you could automate opening windows or triggering ventilation to get better quality air from outside.

Luftdaten is making the world a better place through community driven, open environmental data. The coverage within northern Europe is impressive.

@@ -540,14 +519,11 @@ dateCreated: 2024-02-09T21:57:47.138Z

USING CLI TO MOVE THE DATA PARTITION

To see the current data disk use:

$ ha os info

-

-

+

 

...

-

-

+

 

data_disk: /dev/mmcblk1p4

-

-

+

 

...

Sh

Copy

@@ -1033,42 +1009,29 @@ dateCreated: 2024-02-09T21:57:47.138Z

https://github.com/rospogrigio/localtuya/issues/183

Adding in config manual works.

localtuya:

-

-

+

 

  - host: 192.168.1.215

-

-

+

 

    device_id: xxx

-

-

+

 

    local_key: xxx

-

-

+

 

    friendly_name: Tuya Device

-

-

+

 

    protocol_version: "3.3"

-

-

+

 

    entities:

-

- -

+

 

      - platform: sensor

-

-

+

 

        friendly_name: Plug Voltage

-

-

+

 

        id: 20

-

-

+

 

        scaling: 0.1 # Optional

-

-

+

 

        device_class: voltage # Optional

-

-

+

 

        unit_of_measurement: "V" # Optional


 


 

@@ -1230,5 +1193,331 @@ dateCreated: 2024-02-09T21:57:47.138Z


 

https://www.youtube.com/watch?v=iUgxwbfkIqU&t=2s


 

+

 

+

 

+

 

+


 

+

water meter with image recognition on PC

+


 

+

https://pyimagesearch.com/2017/02/13/recognizing-digits-with-opencv-and-python/

+

https://www.geeksforgeeks.org/text-detection-and-extraction-using-opencv-and-ocr/

+

https://medium.com/pythoneers/text-detection-and-extraction-from-image-with-python-5c0c75a8ff14

+


 

+

https://tesseract-ocr.github.io/tessdoc/Installation.html

+

https://tesseract-ocr.github.io/tessdoc/Command-Line-Usage.html#simplest-invocation-to-ocr-an-image

+

tesseract input.txt output.txt -l eng --psm 3


 


 

+

https://medium.com/quantrium-tech/installing-and-using-tesseract-4-on-windows-10-4f7930313f82

+

need to add esseract to sstempath!!!

+

cd C:\Users\Bora_2\Downloads

+

tesseract ziffer4.jpg stdout -l eng

+

tesseract ziffer4.jpg output.txt

+

tesseract input.txt output.txt -l eng

+


 

+


 

+

https://tesseract-ocr.github.io/tessdoc/ImproveQuality.html#examples

+


 

+

https://github.com/tesseract-ocr/tesstrain

+

make training MODEL_NAME=test-model DATA_DIR=/data GROUND_TRUTH_DIR=/data/foo-ground-truth

+


 

+


 

+

install GNU make on Win10

+

https://leangaurav.medium.com/how-to-setup-install-gnu-make-on-windows-324480f1da69

+

https://gnuwin32.sourceforge.net/packages/make.htm

+

install software

+

add to PATH

+

C:\Program Files (x86)\GnuWin32\bin

+

Copy the path and jump to edit environment variables from windows search

+

Click Environment Variables.

+

Under user variables, find Path and click Edit.

+

Hit New, paste the copied path and hit Ok.

+

Hit OK on all other windows also.

+

Now open a fresh CMD/Terminal and type make and and hit Enter.

+

 

+


 

+


 

+

https://medium.com/@ahmetxgenc/how-to-use-tesseract-on-windows-fe9d2a9ba5c6

+

pip install pytesseract

+

pip install numpy

+

pip install opencv-python

+


 

+


 

+

$ tesseract –help-psm

+

Page segmentation modes:

+

0 Orientation and script detection (OSD) only.

+

1 Automatic page segmentation with OSD.

+

2 Automatic page segmentation, but no OSD, or OCR. (not implemented)

+

3 Fully automatic page segmentation, but no OSD. (Default)

+

4 Assume a single column of text of variable sizes.

+

5 Assume a single uniform block of vertically aligned text.

+

6 Assume a single uniform block of text.

+

7 Treat the image as a single text line.

+

8 Treat the image as a single word.

+

9 Treat the image as a single word in a circle.

+

10 Treat the image as a single character.

+

11 Sparse text. Find as much text as possible in no particular order.

+

12 Sparse text with OSD.

+

13 Raw line. Treat the image as a single text line,

+

bypassing hacks that are Tesseract-specific.

+


 

+

$ tesseract --help-oem

+

OCR Engine modes:

+

0 Legacy engine only.

+

1 Neural nets LSTM engine only.

+

2 Legacy + LSTM engines.

+

3 Default, based on what is available.

+


 

+


 

+


 

+

Training Tesseract on custom data

+

https://nanonets.com/blog/ocr-with-tesseract/#training-tesseract-on-custom-data

+


 

+

https://muthu.co/all-tesseract-ocr-options/

+


 

+


 

+


 

+


 

+

Edge Impulse

+

https://studio.edgeimpulse.com/studio/select-project

+

https://www.arduino.coach/edge-impulse-demonstration-of-accurate-digits-recognition-with-the-arduino-portenta.html

+


 

+

https://github.com/edgeimpulse/example-esp32-cam

+


 

+

https://www.survivingwithandroid.com/tinyml-esp32-cam-edge-image-classification-with-edge-impulse/

+


 

+

https://peter-ing.medium.com/beginners-guide-to-object-detection-with-edge-impulse-c8ea95f844a0

+


 

+

https://docs.arduino.cc/tutorials/nano-33-ble-sense/edge-impulse

+


 

+


 

+


 

+


 

+

Tensorflow Lite

+

https://wiki.seeedstudio.com/XIAO-BLE-Sense-TFLite-Getting-Started/

+


 

+

https://developer.android.com/codelabs/digit-classifier-tflite#0

+


 

+

https://www.edgeimpulse.com/blog/get-plugged-in-to-the-future-of-smart-energy-meters

+


 

+

https://www.youtube.com/watch?v=pWp3PhYI-OU

+


 

+

https://github.com/leriomaggio/deep-learning-keras-tensorflow

+


 

+


 

+


 

+


 

+


 

+


 

+


 

+


 

+


 

+


 

+


 

+


 

+


 

+


 

+

Alarm system

+

https://scotthelme.co.uk/creating-a-house-alarm-system-with-home-assistant/

+

https://leonardosmarthomemakers.com/how-to-create-a-diy-alarm-system-with-home-assistant/

+

https://smarthomescene.com/guides/alarmo-make-your-own-alarm-system-in-home-assistant/

+


 

+


 

+


 

+


 

+


 

+


 

+

MICRO PYTHON ON ESP32 (HUZZAH32)

+

https://wolfpaulus.com/micro-python-esp32/

+

https://learn.adafruit.com/adafruit-esp32-feather-v2/micropython-setup

+

http://kentarotanaka.com/huzzah32-esp32-micropython-setup/

+


 

+


 

+


 

+


 

+


 

+


 

+

install HACS

+

https://peyanski.com/how-to-install-home-assistant-community-store-hacs/

+

install addon Terminal & SSH

+

enter follwing code into WEB UI: wget -q -O - https://install.hacs.xyz | bash -

+

Restart Server

+

search for integration hacs

+

select all 4 check boxes

+

enter github credentials

+

You can further enable AppDaemon and NetDaemon apps discovery & tracking. In simple words these are more option to customize your Home Assistant.

+

 

+


 

+


 

+


 

+


 

+

Camera

+

M5Stack Timer Camera X

+

Arduino

+

https://docs.m5stack.com/en/quick_start/timer_cam/arduino

+

https://randomnerdtutorials.com/esp32-cam-video-streaming-web-server-camera-home-assistant/

+

https://community.home-assistant.io/t/m5stack-unit-cam-with-esphome/474378

+


 

+


 

+


 

+


 

+

https://www.fambach.net/esp32-cam-modul/

+

Kamera Fernsteuern: http://<ip>/control?var=<Variablenname>&val=<Wert>

+

http://192.168.178.42/control?var=framesize&val=3

+

http://192.168.178.42:81/stream

+

commands work with web_cam example! → web_cam_M5Stack_Timer-CAM_working

+


 

+

https://randomnerdtutorials.com/esp32-cam-ov2640-camera-settings/

+


 

+


 

+


 

+


 

+

entity_id: camera.cam1

+

filename: /config/www/snapshot.jpg

+


 

+


 

+
+


 

+

alias: take periodic pictures
description: ""
trigger:
- platform: time_pattern
minutes: /1
condition: []
action:
- service: camera.snapshot
data:
filename: >-
/config/Timelapse/Plants_{{ "%04d"|format(now().year) }}_{{
"%02d"|format(now().month) }}_{{ "%02d"|format(now().day)
}}_{{ "%02d"|format(now().hour) }}_{{ "%02d"|format(now().minute) }}_{{ "%02d"|format(now().second) }}.jpeg
target:
entity_id: camera.esp32cam_1
mode: single

+


 

+


 

+

Micropython

+

https://lemariva.com/blog/2020/06/micropython-m5camera-timelapse-over-mqtt

+

https://github.com/lemariva/uPyCam/tree/timelapse-camera

+

https://github.com/lemariva/micropython-camera-driver

+


 

+

due to missing PSRAM, the micropython code does not work...

+


 

+


 

+


 

+


 

+


 

+


 

+

Android controller for ESP32

+

https://www.youtube.com/watch?v=wrtNFFGXi5I&t=363s

+

https://drive.google.com/file/d/17kUsL4qcdAIRIxtfcCf5VnePcwTSmhqX/view

+

https://play.google.com/store/apps/details?id=com.electro_tex.bluetoothcar

+


 

+

https://www.youtube.com/watch?v=Pqs-3GgWW3s

+


 

+


 

+


 

+


 

+


 

+


 

+


 

+

Python on Win10

+

Install via Microsoft store

+



 

+

https://docs.python.org/3/library/venv.html

+

create new venv:

+

python -m venv “D:\Home Assistant\Micropython\myenv”

+


 

+

activate in command prompt to install packages:

+

D:\”Home Assistant”\Python\myenv\Scripts\activate.bat

+

pip install ...

+

deactivate

+


 

+

to see the new venv in VSCode:

+

Python: Select Interpreter → D:\Home Assistant\Micropython\myenv\Scripts\python.exe

+

then, restart VSCode

+


 

+


 

+


 

+


 

+


 

+


 

+

using password manager

+

KepassXC

+

https://keepassxc.org/download/

+


 

+


 

+


 

+

Use Yubico: https://www.yubico.com/de/works-with-yubikey/catalog/keepassxc/

+

Database > Database Security > Add Additional protection… > Add Challenge-Response → choose Yubikey from the drop-down menu

+


 

+

browser plugin:

+

https://keepassxc.org/docs/KeePassXC_GettingStarted.html#_setup_browser_integration

+


 

+


 

+


 

+

keepass for Android

+

KeePass2Android or KeePassDX

+


 

+


 

+


 

+


 

+

Syncthing

+

Download: https://docs.syncthing.net/users/contrib.html#contributions

+

Getting started: https://docs.syncthing.net/intro/getting-started.html#getting-started

+

Default Folder: C:\Users\Bora_2\Sync

+


 

+

Device Identification – BoraNB: 3YHOKRG-D57OAYW-QW7Z23T-MQPGWLJ-ZGR4UCV-DUB-LX1: KOVYWX3-M6CXGFE-M4UQSQQ

+

VOHODHG-KXFA7RQ-5NQ6LM3-3HLMSXC-6XMN4BH-XCIA7GC-LBZGX2G-N4APPQJ

+


 

+

Starting Syncthing Automatically: https://docs.syncthing.net/users/autostart.html

+

Windows:

+

create shortcut in following folder

+

folder: %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup

+

Alternatively, in newer versions of Windows, open shell:startup from the Run command (Win+R).

+

path: "D:\Home Assistant\syncthing-windows-amd64-v1.22.2\syncthing.exe" --no-console --no-browser

+

open: http://localhost:8384

+

Linux

+

https://docs.syncthing.net/users/autostart.html#linux

+

 

+


 

+


 

+


 

+


 

+


 

+

Soil sensor

+

https://learn.adafruit.com/adafruit-stemma-soil-sensor-i2c-capacitive-moisture-sensor

+


 

+

3D models for assembling Adafruit soil sensor:

+

https://learn.adafruit.com/soil-node

+

https://learn.adafruit.com/pyportal-pet-planter-with-adafruit-io

+


 

+


 

+


 

+


 

+


 

+


 

+

use wildcard for mqtt topics in automations

+

https://community.home-assistant.io/t/mqtt-topic-wildcard/389382

+

topic: "stat/+/RESULT"

+


 

+

https://community.home-assistant.io/t/automation-based-on-mqtt-message-with-wildcard-and-value-condition/311518/6

+

As you have already discovered, this is not an acceptable way to use a wildcard (#) in an MQTT topic:

+


 

+

topic: "#/batt"

+

The # wildcard can appear at the end of a topic, like this:

+


 

+

topic: "home/sensors/#"

+

or alone:

+


 

+

topic: "#"

+

You didn’t mention the format of the battery topic but maybe the + wildcard can be useful. It is designed to allow for any sub-topic like this:

+


 

+

topic: "home/OpenMQTTGateway/BttoMQTT/+/batt"

+


 

+


 

+


 

+

https://community.home-assistant.io/t/try-to-send-the-mqtt-payload-as-a-message-to-notify-mobile-app-in-ios/169197/6

+


 

+

data_template:

+

message: “{{ trigger.payload }}”

+

title: From mqtt_notifier

+

service: persistent_notification.create

+


 

+


 

+


 

+

Tutorial to fix 401: Unauthorised Error with Grafana for mobile devices

+

https://community.home-assistant.io/t/tutorial-to-fix-401-unauthorised-error-with-grafana-for-mobile-devices/242622/9

+


 

+

it works!

+

port forward router:
443 to 8123 tcp
and
80 to 3000 tcp
and grafana setings:

+
plugins: []
+


 

+


 

+


 
 

+