Proxmox LXC SSH port change issue

I installed a Debian template LXC container and had issue to change the port on which SSH was listening. After changing the config and restarting the service, the port would be the right one, but after a reboot it would defaults back to 22.

I found this in the Proxmox forum and thought it deserved to be shared:

systemctl mask ssh.socket
systemctl mask sshd.socket

systemctl disable sshd
systemctl enable ssh

Now the SSH process use /etc/ssh/sshd_config file and all work after a restart for me.

Thanks to nadmin at : https://forum.proxmox.com/threads/ssh-doesnt-work-as-expected-in-lxc.54691/post-451843

Teamviewer Android - Skip the "confirm"

If you wish to run Teamviewer Host unattended on an Android smartphone without having to confirm the "screen capture" dialog everytime, you can follow these simple steps:

Start recording or casting with Host?

  1. Enable developer mode on your phone (press ten times on the Build version in the system info)
  2. Enable USB debugging in the developer menu
  3. On your computer, with ADB (part of the platform tools, you can find other tutorials online), run the following command: adb shell appops set com.teamviewer.host.market PROJECT_MEDIA allow
  4. Voilà! You can now connect to your Android Smartphone with Teamviewer Host without having to press a confirm button, truly unattended.

Migrate ZFS pool from Freenas to Proxmox

I am migrating my "NAS" and all that was installed on it to a different computer.

I used to have a Freenas with a few iocages containing Plex, Radarr/Sonarr/Jackett, Deluge ...

I want to migrate all that to Proxmox for the added flexibility and being able to have only one computer running instead of a small server and my NAS when I need it.

I just took my disks from my Freenas, shoved them in my proxmox and connected them (hotplug). Disks were detected automatically by the OS.

I ran zfs import (as root/sudo obviously) to see if the disks were detected by ZFS: zfs import result

Now to import the pool, I simply did:

zpool import -f bigpool

zpool import bigpool result

bigpool being the pool name.

And now zfs list shows all my folders and the mount points!

Now I can move on to install all my services!

Png clipart computer icons google authenticator multi factor authentication github angle two factor authentication%20%282%29

Export and view private keys of Google Authenticator for Bitwarden or backup.

Some time ago, I needed to export the private keys of my Google Authenticator in order to use them on a password manager that supports OTP generation, like Bitwarden.

You can export the QR Code and use a python tool to decode it, but I went with a different method. It requires your phone to be rooted.

I used the app JuiceSSH to open a local terminal on my phone.

Then: su

You will get a prompt to accept the Root Access.

cd /data/data/com.google.android.apps.authenticator2/databases cp databases /sdcard

Then you can copy this file on your computer and with SQlite3, you can view the content. sqlite3 databases

SELECT * FROM accounts;

All the keys will be displayed before your eyes. They key itself is on the third column. Don't leave the file on your sdcard or somewhere not safe. It's pretty sensitive!

Nice horseshoe Lovelace cards for my Victron dashboard in Home Assistant

Introduction

I've been using Home Assistant to connect all my devices in my house and my "power wall" takes an important part of the data I'd like to see and monitor regularly. I find it important to have all the information you need at a glance without having to open 15 different apps

Horseshoe cards for Victron

Requirements

Installation

  • Open HACS
  • Click on "Explore and Add repositories"
  • Search for the frontend module "Flex Horseshoe Card".
  • Click on "Install this repository in HACS", then "Install"

In your ui-lovelace.yaml file, add the following lines under the ressources key:

  - url: /hacsfiles/flex-horseshoe-card/flex-horseshoe-card.js
    type: module

Usage

I have splitted my code in various files to simplify configuration. I have a card template that defines the layout of cards for Battery and MPPT:

Layout MPPT : layout-mppt.yaml

hlines:
  - id: 0
    xpos: 50
    ypos: 43
    length: 70
    styles:
      - opacity: 0.2;
vlines:
  - id: 0
    xpos: 50
    ypos: 59
    length: 30
    styles:
      - opacity: 0.2;
states:
  - id: 0
    entity_index: 0
    xpos: 50
    ypos: 35
    styles:
      - font-size: 3em;
      - opacity: 0.9;
  - id: 1
    entity_index: 1
    xpos: 46
    ypos: 58
    styles:
      - font-size: 2em;
      - text-anchor: end;
  - id: 2
    entity_index: 2
    xpos: 56
    ypos: 58
    styles:
      - font-size: 2em;
      - text-anchor: start;
  - id: 3 # Production today
    entity_index: 3
    xpos: 5
    ypos: 5
    styles:
      - font-size: 1.2em;
      - text-anchor: start;
  - id: 4 # Max power production
    entity_index: 4
    xpos: 95
    ypos: 5
    styles:
      - font-size: 1.2em;
      - text-anchor: end;
names:
  - id: 0
    entity_index: 0
    xpos: 50
    ypos: 95
  - id: 1
    entity_index: 1
    xpos: 46
    ypos: 68
    styles:
      - font-size: 0.9em;
      - text-anchor: end;
      - opacity: 0.7;
  - id: 2
    entity_index: 2
    xpos: 54
    ypos: 68
    styles:
      - font-size: 0.9em;
      - text-anchor: start;
      - opacity: 0.7;

MPPT Card example

type: 'custom:flex-horseshoe-card'
entities:
  - entity: sensor.pv_home_top_power
    decimals: 0
    unit: 'W'
    name: "MPPT Top"
  - entity: sensor.pv_home_top_panel_voltage
    decimals: 0
    unit: 'V'
    name: "Voltage"
  - entity: sensor.pv_home_top_panel_current
    decimals: 2
    unit: 'A'
    name: "Current"
  - entity: sensor.pv_home_top_yield_today
    decimals: 2
    unit: 'kWh'
    name: "Yield"
  - entity: sensor.pv_home_top_max_power_today
    decimals: 0
    unit: 'W'
    name: "Max Power"
show:
  horseshoe_style: 'colorstopgradient'
layout: !include layout-mppt.yaml

horseshoe_scale:
  min: 0
  max: 3600
# color stop list with 10 colors defined in the theme. With the `lineargradient` fill style, only the
# first (16:) and last (25:) colors are used. The thresholds are ignored with this setting.
color_stops:
  0: '#0277BD'
  3000: '#FBC02D'
MQTT Explorer

Bridge your Victron Energy Venus device to your MQTT server in Home Assistant

Introduction

My first blog post explained how to add your Victron Energy system into Home Assistant using the MQTT integration.

This worked well for me for a long time but I felt like it was very heavy and didn't refresh fast enough of present all the data in a precise and convenient way.

This is the reason I have decided to switch from Modbus to MQTT to connect my Victron System to my Home Assistant. We're doing it by taking advantage of the bridging fonction of MQTT and the MQTT server present in the Color Control GX (It will also work with other Venus devices, like Venux GX, Cerbo or a Raspberry Pi). I am using the Mosquitto addon provided by Hass.io, and the customization capabilities it offers. Bridging the MQTT with a different server might work but the configuration will be different.

To better see what is happening on my MQTT Server and to debug/check, I am using the software "MQTT Explorer" which provides excellent functions, realtime highlights of changed messages and works very well in my experience. You can download MQTT Explorer by clicking here

MQTT Explorer main window

Requirements

  • A working HASS.IO installation (preferred) or Home Assistant with a mosquitto broker (you will need to adjust the steps shown here)
  • A MQTT Client (MQTT Explorer for example)
  • A Victron system with a Venus device (CCGX, Cerbo, Venus GX, ...)
  • Both Home Assistant and the Victron need to be on the same network for this guide.

Enable MQTT listening on the Venus Device

WARNING: Don't do this if you don't trust the network you are on, or if your Venus is exposed to internet !

To start, you need to enable MQTT on the Venus device. This can be done in the settings, services.

Enable MQTT server

Enable bridging on Mosquitto

Custom configuration for Mosquitto Add-On

Then on Home Assistant (HassIO), make sure you have the Mosquitto broker add-on installed, or install it. Once installed, you can go to the configuration tab and add this:

customize:
  active: true
  folder: mosquitto

Restart the Mosquitto Add-on.

Configure the bridge

I am using the Add-on named Samba Share to browse the files on my computer and find the folder /share/mosquitto/

You can now create a new file named bridge-venus.conf (or any other name you want, but the .conf is important.) With the following content: (Replace the IP address by your Venus device.)

connection venus-home
address 192.168.1.XXX
topic # both 0 venus-home/

Save the file and restart the "Mosquitto Broker" add-on and check in the logs that it started correctly. If it starts correctly, you should see a line like that:

Connecting bridge venus-home (192.168.1.XXX:1883)

This defines the bridge in MQTT. It tells to bridge all the remote server to the folder named victron-home. Here is the example on my system (you need another step before getting all the information, you should only see a few folders under /venus-home at first.) InkedMQTT Explorer 1vpeD5MrM2 LI

Wake up the MQTT script on Venus

Once that is done, you need to set up an automation on Home Assistant that will write in a topic on MQTT to request the data from the Venus device. This is to prevent devices from using too much processing power and sending useless data on the Victron Servers.

With MQTT Explorer, find your installation id, you will see it under the path /venus-home/system/0/Serial. Copy the value of the field and create the following automation, don't forget to replace the YOUR SYSTEM ID:

alias: Refresh MQTT Victron
description: 'Request the data on the MQTT server'
trigger:
  - platform: time_pattern
    seconds: '30'
action:
  - service: mqtt.publish
    data:
      topic: venus-home/R/YOUR SYSTEM ID/system/0/Serial
mode: single

It works

Now in MQTT Explorer, you can see all the data appear and refresh before your eyes: ZTImYkoKEF

Please feel free to share with me what you built with that!

Chrome uHO6C3vFFr

Add your Victron system in Home Assistant

If you would like to add your Victron System into Home Assistant to get graphs, stats and be able to do some automations related to your system, this is the right place!

Requirements

In order to be able to get your data in Home Assistant, you need a Venus device:

  • Color Control GX, also known as CCGX, which is what I'm using for this blogpost.
  • Venux GX
  • Cerbo
  • Raspberry PI running Venus OS (you can find guides online)

You also need a functionning Home Assistant installation. It's preferred that both be in the same network and can communicate directly without going through routers or firewalls.

Enabling Modbus/TCP

You need to enable the Modbus/TCP service in Venus:

  • Go to the menu
  • Settings
  • Services
  • Modbus/TCP -> Enable

Enable Modbus/TCP

Get the IP address of your Venus device.

Find the IP address of your Victron System:

  • Go to the menu
  • Settings
  • Ethernet / or Wifi
  • The IP Address wil be shown.

Configure the Modbus integration in Home assistant

I recommend separating the configuration of Modbus entities in a separate file to keep the configuration clear. You need to enable and configure the Modbus integration in the root level of your configuration.yaml

modbus:
  - name: house
    host: 192.168.1.118 
    type: tcp
    port: 502
  • The name attribute here is important as it will be used as the hub name in the next step.
  • Obviously, use the proper IP Address in the host field for your setup.

Then you can add your sensors. In my configuration, I have a folder containing various yaml files to keep my sensors organized:

sensor: !include_dir_merge_list /config/sensors/

In my /config/sensors/ folder, I then have my config files. Here is an example you can use to add your Modbus Victron devices.

04-victron.yaml :

# -- HOME SYSTEM
# Modbus device (slave) IDs: /!\ Only for my system
# BMV 245
# MPPT Top 239
# Grid meter 30
# MPPT Top Panels 247
# MPPT Flat panels 238
# Multiplus 246
# Main System 100

- platform: modbus
  scan_interval: 5
  registers:
    # SYSTEM
    - name: "Victron Home AC Consumption"
      hub: house
      data_type: uint
      unit_of_measurement: "W"
      slave: 100
      register: 817
      scale: 1

    - name: "Victron Home Grid"
      hub: house
      data_type: int
      unit_of_measurement: "W"
      slave: 100
      register: 820
      scale: 1

    - name: "Victron Home Battery voltage"
      hub: house
      data_type: uint
      unit_of_measurement: "V"
      slave: 100
      register: 840
      scale: 0.1
    - name: "Victron Home Battery Current"
      hub: house
      data_type: int
      unit_of_measurement: "A"
      slave: 100
      register: 841
      scale: 0.1
    - name: "Victron Home Battery Power"
      hub: house
      data_type: int
      unit_of_measurement: "W"
      slave: 100
      register: 842
      scale: 1
    - name: "Victron Home PV Power"
      hub: house
      data_type: uint
      unit_of_measurement: "W"
      slave: 100
      register: 850
      scale: 1


      # BMV
    - name: "Victron Home Battery SOC"
      hub: house
      data_type: uint
      unit_of_measurement: "%"
      slave: 245
      register: 266
      scale: 0.1
    - name: "Victron Home Time to go"
      hub: house
      data_type: uint
      unit_of_measurement: "seconds"
      slave: 245
      register: 303
      scale: 100

      # MPPT Top Array
    - name: "Victron Top PV Voltage"
      hub: house
      data_type: uint
      unit_of_measurement: "V"
      slave: 247
      register: 776
      scale: 0.01
    - name: "Victron Top PV Current"
      hub: house
      data_type: int
      unit_of_measurement: "A"
      slave: 247
      register: 777
      scale: 0.1
    - name: "Victron Top PV Power"
      hub: house
      data_type: uint
      unit_of_measurement: "W"
      slave: 247
      register: 789
      scale: 0.1
    - name: "Victron Top MPP Operation mode"
      hub: house
      data_type: uint
      slave: 247
      register: 791
      scale: 1
    - name: "Victron Top Yield today"
      hub: house
      data_type: uint
      unit_of_measurement: "W"
      slave: 247
      register: 784
      scale: 0.1
      precision: 3
    - name: "Victron Top Max power today"
      hub: house
      data_type: uint
      unit_of_measurement: "W"
      slave: 247
      register: 785
      scale: 1
    - name: "Victron Top Yield yesterday"
      hub: house
      data_type: uint
      unit_of_measurement: "W"
      slave: 247
      register: 786
      scale: 0.1
      precision: 3
    - name: "Victron Top Max power yesterday"
      hub: house
      data_type: uint
      unit_of_measurement: "W"
      slave: 247
      register: 787
      scale: 1

      # MPPT Flat roof Array
    - name: "Victron Flat PV Voltage"
      hub: house
      data_type: uint
      unit_of_measurement: "V"
      slave: 238
      register: 776
      scale: 0.01
    - name: "Victron Flat PV Current"
      hub: house
      data_type: int
      unit_of_measurement: "A"
      slave: 238
      register: 777
      scale: 0.1
    - name: "Victron Flat PV Power"
      hub: house
      data_type: uint
      unit_of_measurement: "W"
      slave: 238
      register: 789
      scale: 0.1
    - name: "Victron Flat MPP Operation mode"
      hub: house
      data_type: uint
      unit_of_measurement: "W"
      slave: 238
      register: 791
      scale: 1
    - name: "Victron Flat Yield today"
      hub: house
      data_type: uint
      unit_of_measurement: "W"
      slave: 238
      register: 784
      scale: 0.1
      precision: 3
    - name: "Victron Flat Max power today"
      hub: house
      data_type: uint
      unit_of_measurement: "W"
      slave: 238
      register: 785
      scale: 1
    - name: "Victron Flat Yield yesterday"
      hub: house
      data_type: uint
      unit_of_measurement: "W"
      slave: 238
      register: 786
      scale: 0.1
      precision: 3
    - name: "Victron Flat Max power yesterday"
      hub: house
      data_type: uint
      unit_of_measurement: "W"
      slave: 238
      register: 787
      scale: 1

Here is the explanation of the settings:

  • name: The name the sensor will appear under in Home Assistant
  • hub: The name of the "Modbus hub" configured previously.
  • data_type: Can be unsigned integer (uint) or integer (int), depends on the register.
  • unit_of_measurement: is pretty self explanatory.
  • slave: Is the device ID of the device you will be querying. You can find all the device ID of your system in the Modbus menu.
  • register: The Register ID for the value you are requesting. An Excel file is available on the Website of Victron Energy with all the IDs.
  • scale: Refers to the scale of the value. Invert the value found in the Excel file. Ex: the file mentions 10, it needs to be 1/10 = 0.1.
  • precision: Mostly important for float values.

Once You have configured your system as you like it, you can make fancy dashboards in Home assistant or even Grafana:

chrome Z6j3OhHbkHchrome gT6iosoukYchrome uHO6C3vFFr

A very interesting feature is the ability to switch on/off loads when the batteries are full or/amd get a notification. I might create a new blog post in the future about these features.

Hope you will enjoy even more data in your Home assistant!

More ressources: