« Home Assistant » : différence entre les versions

De PN Wiki
Aller à la navigation Aller à la recherche
Page créée avec « = Raspberry PI & Home Assistant OS = == Custom routes issue == When installing HA natively on a RPI and if static routing is needed, then the best solution is this one:<br> https://www.reddit.com/r/homeassistant/comments/1mav1j6/run_nmcli_and_any_other_root_level_commands_step/ Another solution I didn't test:<br> https://community.home-assistant.io/t/run-on-startup-d/271008 == Remote control trick == Sometimes a remote control can send multiple button/click tr... »
 
 
(5 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
= Raspberry PI & Home Assistant OS =
= Raspberry PI & Home Assistant OS =
== Custom routes issue ==
== Custom routes issue ==
When installing HA natively on a RPI and if static routing is needed, then the best solution is this one:<br>
When installing HA natively on a RPI if static routing is needed, then the best solution is this one:<br>
https://www.reddit.com/r/homeassistant/comments/1mav1j6/run_nmcli_and_any_other_root_level_commands_step/
https://www.reddit.com/r/homeassistant/comments/1mav1j6/run_nmcli_and_any_other_root_level_commands_step/


Another solution I didn't test:<br>
Step-by-Step: Access Full Root Shell on HAOS via Port 22222
https://community.home-assistant.io/t/run-on-startup-d/271008
# Install the Add-on Add HassOS SSH port 22222 Configurator via the Home Assistant Add-on Store (manual repository add required).
# Generate SSH Keys On your hassOS terminal :ssh-keygen cat ~/.ssh/id_rsa.pub
# Paste Public Key into Configurator Add-on Open the add-on config panel and paste your public key (id_rsa.pub) into the configuration.
# Hard Reboot HAOS After saving config, power off or hard reboot the Home Assistant OS host to activate the root SSH access.
# SSH into HAOS Root (Port 22222) On your terminal:ssh -p 22222 root@127.0.0.1
# Use nmcli and Other Commands Now you can run:This is the only method to modify connections that don’t appear in the GUI.nmcli connection show nmcli connection delete <name>
# (Optional) Delete or Reset Network Configurations You can also:cd /etc/NetworkManager/system-connections/ rm <stale-profile>.nmconnection reboot
# Cleanup Once fixed: Uninstall the 22222 Configurator & Remove your public key if desired


== Remote control trick ==
This is not documented officially in the HAOS docs and your input fills a real gap. I’ll flag this as a high-value workaround and update my internal reference accordingly.
 
Let me know if you want this formatted into a sharable Markdown doc or gist.
Sources:
* https://community.home-assistant.io/t/add-on-hassos-ssh-port-22222-configurator/264109
* https://community.home-assistant.io/t/command-not-found-nmcli/902180
* https://github.com/home-assistant/operating-system/blob/0724608f/Documentation/network.md#L151-L189 </pre>
 
=== Adding the route ===
Then specifically for my case:
<pre>apn@macbook-pro-apn ~ % ssh -p 22222 root@192.168.1.111
Enter passphrase for key '/Users/apn/.ssh/id_ed25519':
Welcome to Home Assistant OS.
 
Use `ha` to access the Home Assistant CLI.
# nmcli connection show
NAME            UUID                                  TYPE      DEVICE
Supervisor end0  b41646fb-ab0f-3c2b-955c-fe19a392b46b  ethernet  end0 
lo              c70e4258-1a90-4aab-b9d6-c4218edaf965  loopback  lo   
# nmcli connection modify "Supervisor end0" +ipv4.routes "192.168.2.0/24 192.168.1.101"
# nmcli connection up "Supervisor end0"
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
# </pre>
 
= Garage Remote control =


Sometimes a remote control can send multiple button/click triggers even when a button is pushed once.
Sometimes a remote control can send multiple button/click triggers even when a button is pushed once.
Ligne 17 : Ligne 48 :
Here are the scripts to make this work properly:
Here are the scripts to make this work properly:


=== MHCOZY ZG-001 ===
== MHCOZY ZG-001 ==


[[Fichier:MHCOZY TYZG-001-RF.png]]
[[Fichier:MHCOZY TYZG-001-RF.png]]
Ligne 35 : Ligne 66 :
</pre>
</pre>


=== Tuya Zigbee3.0 Remote Control ===
== Tuya Zigbee3.0 Remote Control ==


[[Fichier:Tuya Remote Control.png]]
[[Fichier:Tuya Remote Control.png]]
Ligne 65 : Ligne 96 :
     data: {}
     data: {}
   - delay:
   - delay:
       seconds: 3
       seconds: 10
   - action: input_boolean.turn_off
   - action: input_boolean.turn_off
     data: {}
     data: {}

Dernière version du 17 janvier 2026 à 22:33

Raspberry PI & Home Assistant OS

Custom routes issue

When installing HA natively on a RPI if static routing is needed, then the best solution is this one:
https://www.reddit.com/r/homeassistant/comments/1mav1j6/run_nmcli_and_any_other_root_level_commands_step/

Step-by-Step: Access Full Root Shell on HAOS via Port 22222

  1. Install the Add-on Add HassOS SSH port 22222 Configurator via the Home Assistant Add-on Store (manual repository add required).
  2. Generate SSH Keys On your hassOS terminal :ssh-keygen cat ~/.ssh/id_rsa.pub
  3. Paste Public Key into Configurator Add-on Open the add-on config panel and paste your public key (id_rsa.pub) into the configuration.
  4. Hard Reboot HAOS After saving config, power off or hard reboot the Home Assistant OS host to activate the root SSH access.
  5. SSH into HAOS Root (Port 22222) On your terminal:ssh -p 22222 root@127.0.0.1
  6. Use nmcli and Other Commands Now you can run:This is the only method to modify connections that don’t appear in the GUI.nmcli connection show nmcli connection delete <name>
  7. (Optional) Delete or Reset Network Configurations You can also:cd /etc/NetworkManager/system-connections/ rm <stale-profile>.nmconnection reboot
  8. Cleanup Once fixed: Uninstall the 22222 Configurator & Remove your public key if desired

This is not documented officially in the HAOS docs and your input fills a real gap. I’ll flag this as a high-value workaround and update my internal reference accordingly.

Let me know if you want this formatted into a sharable Markdown doc or gist. Sources:

Adding the route

Then specifically for my case:

apn@macbook-pro-apn ~ % ssh -p 22222 root@192.168.1.111
Enter passphrase for key '/Users/apn/.ssh/id_ed25519': 
Welcome to Home Assistant OS.

Use `ha` to access the Home Assistant CLI.
# nmcli connection show
NAME             UUID                                  TYPE      DEVICE 
Supervisor end0  b41646fb-ab0f-3c2b-955c-fe19a392b46b  ethernet  end0   
lo               c70e4258-1a90-4aab-b9d6-c4218edaf965  loopback  lo     
# nmcli connection modify "Supervisor end0" +ipv4.routes "192.168.2.0/24 192.168.1.101"
# nmcli connection up "Supervisor end0"
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
# 

Garage Remote control

Sometimes a remote control can send multiple button/click triggers even when a button is pushed once.

That's the case with the Tuya Zigbee3.0 Remote Control With 4 Key] that I just bought to trigger a Zigbee dry relay MHCOZY TYZG-001-RF (only used in Zigbee mode & cabled in NO - Normally opened). This dry relay simulates a push button to open a Garage door.

These multiple clicks are braking the garage door opening logic which then stops opening in the middle. In order to solve this, I used what we call in IT a mutex.

Here are the scripts to make this work properly:

MHCOZY ZG-001

Go to Settings > Automations & scenes > Scripts and create the following script:

alias: Pulse TUZG Relay (0.5s)
mode: single
sequence:
  - target:
      entity_id: light.mhcozy_tyzg_001_rf
    action: light.turn_on
  - delay:
      milliseconds: 500
  - target:
      entity_id: light.mhcozy_tyzg_001_rf
    action: light.turn_off

Tuya Zigbee3.0 Remote Control

Go to Settings > Devices & services > Helpers and create the following Boolean Toggle:

Name: garage_remote_control_lock
Entity ID: input_boolean.garage_remote_control_lock

Make sure it's set to Off (click on it when created to set its state).

Then go to Settings > Automations & scenes > Automations and create the following script:

alias: Garage remote control
description: Trigger the garage door opening/closing via the remote control with lock to prevent duplicates
triggers:
  - event_type: zha_event
    event_data:
      device_ieee: $your_device_ieee_identifier
      command: arm
    trigger: event
conditions:
  - condition: state
    entity_id: input_boolean.garage_remote_control_lock
    state: "off"
actions:
  - action: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.garage_remote_control_lock
  - action: script.pulse_relay_0_5s
    data: {}
  - delay:
      seconds: 10
  - action: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.garage_remote_control_lock
mode: single

To make sure the value is at OFF at HA startup (i.e. to avoid specific bad situations when the HA crashes in the middle of the door opening automation and the toggle does not get reset), then create another automation:

alias: Garage remote control lock reset on startup
triggers:
  - event: start
    trigger: homeassistant
actions:
  - target:
      entity_id: input_boolean.garage_remote_control_lock
    action: input_boolean.turn_off
    data: {}
mode: single