Merge pull request 'edge-host: E3onCAN — read the E380 meter directly' (#101) from e380-direct into master
Reviewed-on: gitea_admin/homelab#101
This commit was merged in pull request #101.
This commit is contained in:
@@ -41,6 +41,14 @@ edge_open3e_devices:
|
||||
vx3: { tx: "0x6a1", dpList: "vx3" }
|
||||
vcmu: { tx: "0x68c" }
|
||||
|
||||
# --- E3onCAN: passive E380 energy-meter listener (no bus writes, so it
|
||||
# coexists with the single open3e instance). The meter broadcasts at
|
||||
# ~5 Hz; the gap throttles MQTT to one update per DID per interval.
|
||||
edge_e3oncan_repo: https://github.com/MyHomeMyData/E3onCAN.git
|
||||
edge_e3oncan_version: 461dcbdf97e8d72d2edb9929c63b39382af6c3a1 # V0.5.2
|
||||
edge_e3oncan_gap_seconds: 10
|
||||
edge_e3oncan_mqtt_format: "{device}_{didNumber:04d}_{didName}"
|
||||
|
||||
# --- Secrets: define these in inventory/group_vars/edge_host/vault.yml
|
||||
# (ansible-vault). See README.md for the kubectl one-liners that read the
|
||||
# current values out of the cluster during migration.
|
||||
|
||||
@@ -17,3 +17,9 @@
|
||||
name: open3e
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
|
||||
- name: Restart e3oncan
|
||||
ansible.builtin.systemd:
|
||||
name: e3oncan
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
|
||||
@@ -152,3 +152,34 @@
|
||||
enabled: true
|
||||
state: started
|
||||
daemon_reload: true
|
||||
|
||||
# --- E3onCAN: direct E380 meter reads (passive; per-review decision not
|
||||
# to trust the VX3's relayed meter values). Same broker user as open3e;
|
||||
# topics land under the same open3e/ prefix as e380_<did>_<name>.
|
||||
- name: Check out E3onCAN (pinned)
|
||||
ansible.builtin.git:
|
||||
repo: "{{ edge_e3oncan_repo }}"
|
||||
dest: "{{ edge_base_dir }}/e3oncan/src"
|
||||
version: "{{ edge_e3oncan_version }}"
|
||||
notify: Restart e3oncan
|
||||
|
||||
- name: Create E3onCAN venv with requirements
|
||||
ansible.builtin.pip:
|
||||
requirements: "{{ edge_base_dir }}/e3oncan/src/requirements.txt"
|
||||
virtualenv: "{{ edge_base_dir }}/e3oncan/venv"
|
||||
virtualenv_command: python -m venv
|
||||
notify: Restart e3oncan
|
||||
|
||||
- name: Deploy e3oncan systemd unit
|
||||
ansible.builtin.template:
|
||||
src: e3oncan.service.j2
|
||||
dest: /etc/systemd/system/e3oncan.service
|
||||
mode: "0644"
|
||||
notify: Restart e3oncan
|
||||
|
||||
- name: Enable e3oncan
|
||||
ansible.builtin.systemd:
|
||||
name: e3oncan
|
||||
enabled: true
|
||||
state: started
|
||||
daemon_reload: true
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# Managed by ansible (roles/edge-host).
|
||||
# PASSIVE listener for the E380 energy meter's CANopen broadcasts — no
|
||||
# writes on the bus, so it may run alongside the (single) open3e
|
||||
# instance. Reads the meter directly instead of trusting the VX3's
|
||||
# relayed values.
|
||||
[Unit]
|
||||
Description=E3onCAN E380 energy-meter CAN listener (read-only)
|
||||
BindsTo=sys-subsystem-net-devices-{{ edge_can_interface }}.device
|
||||
After=sys-subsystem-net-devices-{{ edge_can_interface }}.device network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
User=open3e
|
||||
EnvironmentFile={{ edge_base_dir }}/open3e/open3e.env
|
||||
WorkingDirectory={{ edge_base_dir }}/e3oncan
|
||||
# Journald-friendly (python block-buffers pipes; lost on restarts).
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
ExecStart={{ edge_base_dir }}/e3oncan/venv/bin/python {{ edge_base_dir }}/e3oncan/src/E3onCANcollect.py \
|
||||
-c {{ edge_can_interface }} \
|
||||
-dev e380 \
|
||||
-g {{ edge_e3oncan_gap_seconds }} \
|
||||
-m {{ edge_mqtt_host }}:{{ edge_mqtt_port }}:{{ edge_open3e_mqtt_topic }} \
|
||||
-muser {{ edge_open3e_mqtt_user }} \
|
||||
-mpass ${OPEN3E_MQTT_PASSWORD} \
|
||||
-mfstr "{{ edge_e3oncan_mqtt_format }}" \
|
||||
-j
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,4 +1,7 @@
|
||||
# Managed by ansible (roles/edge-host). Read by open3e.service.
|
||||
# Full user:password pair as one variable so the unit can pass it as a
|
||||
# single -muser argument without exposing it in the unit file.
|
||||
# Managed by ansible (roles/edge-host). Read by open3e.service and
|
||||
# e3oncan.service.
|
||||
# Full user:password pair as one variable so the open3e unit can pass it
|
||||
# as a single -muser argument without exposing it in the unit file;
|
||||
# e3oncan takes user and password separately (-muser/-mpass).
|
||||
OPEN3E_MUSER={{ edge_open3e_mqtt_user }}:{{ edge_open3e_mqtt_password }}
|
||||
OPEN3E_MQTT_PASSWORD={{ edge_open3e_mqtt_password }}
|
||||
|
||||
Reference in New Issue
Block a user