Set up new power meters in Space 4

This commit is contained in:
polyfloyd 2024-08-15 18:24:04 +02:00
parent d866b50448
commit 3ac81cbbeb
4 changed files with 12 additions and 10 deletions

View file

@ -2,3 +2,9 @@
group_nft_input: [] group_nft_input: []
# - "udp dport 4000 accept # FIXME, werkt op dit moment toch niet hoor ik van AK # - "udp dport 4000 accept # FIXME, werkt op dit moment toch niet hoor ik van AK
power_mqtt_targets:
- net: space
ip: 204.2.69.50
- net: unicorndept
ip: 204.2.68.219

View file

@ -52,6 +52,7 @@
- name: Restart power-mqtt - name: Restart power-mqtt
ansible.builtin.systemd: ansible.builtin.systemd:
name: power-mqtt name: "power-mqtt@{{ item.net }}:{{ item.ip }}"
state: restarted state: restarted
daemon_reload: true daemon_reload: true
with_items: "{{ power_mqtt_targets }}"

View file

@ -31,13 +31,8 @@
- name: Enable power-mqtt - name: Enable power-mqtt
ansible.builtin.systemd: ansible.builtin.systemd:
name: "power-mqtt@{{ item.net }}/{{ item.ip }}" name: "power-mqtt@{{ item.net }}:{{ item.ip }}"
state: started state: started
enabled: true enabled: true
daemon_reload: true daemon_reload: true
with_items: with_items: "{{ power_mqtt_targets }}"
- net: space
ip: 0.0.0.0
- net: unicorndept
ip: 0.0.0.0
ignore_errors: true # FIXME

View file

@ -5,12 +5,12 @@
import paho.mqtt.client as mqtt import paho.mqtt.client as mqtt
import paho.mqtt.subscribe as subscribe import paho.mqtt.subscribe as subscribe
from time import sleep from time import sleep
import os import sys
import requests import requests
mqtt_host = '{{ mqtt_internal_host }}' mqtt_host = '{{ mqtt_internal_host }}'
(net, sdm630_host) = os.argv[1].split('/') (net, sdm630_host) = sys.argv[1].split(':')
client = mqtt.Client() client = mqtt.Client()