Add Home Assisstant smart meter stuff
This commit is contained in:
parent
5db8566946
commit
0750d118b5
2 changed files with 319 additions and 0 deletions
296
pg-serverroom-monitor/configuration.yaml
Normal file
296
pg-serverroom-monitor/configuration.yaml
Normal file
|
@ -0,0 +1,296 @@
|
|||
# Loads default set of integrations. Do not remove.
|
||||
default_config:
|
||||
|
||||
# Load frontend themes from the themes folder
|
||||
frontend:
|
||||
themes: !include_dir_merge_named themes
|
||||
|
||||
automation: !include automations.yaml
|
||||
script: !include scripts.yaml
|
||||
scene: !include scenes.yaml
|
||||
|
||||
sensor:
|
||||
- platform: serial
|
||||
serial_port: /dev/ttyUSB_CH340
|
||||
baudrate: 9600
|
||||
|
||||
template:
|
||||
sensor:
|
||||
- name: Temperature
|
||||
unit_of_measurement: "°C"
|
||||
state: "{{ states('sensor.serial_sensor').split()[2] | float(default=0) }}"
|
||||
unique_id: temperature_sensor
|
||||
- name: Humidity
|
||||
unit_of_measurement: "%"
|
||||
state: "{{ states('sensor.serial_sensor').split()[1] | float(default=0) }}"
|
||||
unique_id: humidity_sensor
|
||||
|
||||
modbus:
|
||||
- name: "SDM230 Smart Meter"
|
||||
type: serial
|
||||
baudrate: 9600
|
||||
bytesize: 8
|
||||
method: rtu
|
||||
parity: N
|
||||
port: /dev/ttyUSB_FT232
|
||||
stopbits: 1
|
||||
sensors:
|
||||
- name: Voltage
|
||||
unit_of_measurement: Volts
|
||||
slave: 2
|
||||
address: 0
|
||||
input_type: input
|
||||
data_type: float32
|
||||
precision: 2
|
||||
unique_id: "SDM230_Voltage"
|
||||
- name: Current
|
||||
unit_of_measurement: Amps
|
||||
slave: 2
|
||||
address: 6
|
||||
input_type: input
|
||||
data_type: float32
|
||||
precision: 2
|
||||
unique_id: "SDM230_Current"
|
||||
- name: Active_Power
|
||||
unit_of_measurement: Watts
|
||||
slave: 2
|
||||
address: 12
|
||||
input_type: input
|
||||
data_type: float32
|
||||
precision: 2
|
||||
unique_id: "SDM230_ActivePower"
|
||||
- name: Apparent_Power
|
||||
unit_of_measurement: Watts
|
||||
slave: 2
|
||||
address: 18
|
||||
input_type: input
|
||||
data_type: float32
|
||||
precision: 2
|
||||
unique_id: "SDM230_ApparentPower"
|
||||
- name: Reactive_Power
|
||||
unit_of_measurement: Watts
|
||||
slave: 2
|
||||
address: 24
|
||||
input_type: input
|
||||
data_type: float32
|
||||
precision: 2
|
||||
unique_id: "SDM230_ReactivePower"
|
||||
- name: Power_Factor
|
||||
slave: 2
|
||||
address: 30
|
||||
input_type: input
|
||||
data_type: float32
|
||||
precision: 2
|
||||
unique_id: "SDM230_PowerFactor"
|
||||
- name: Frequency
|
||||
unit_of_measurement: Hz
|
||||
slave: 2
|
||||
address: 70
|
||||
input_type: input
|
||||
data_type: float32
|
||||
precision: 2
|
||||
unique_id: "SDM230_Frequency"
|
||||
- name: Import_Active_Energy
|
||||
unit_of_measurement: kWh
|
||||
slave: 2
|
||||
address: 72
|
||||
input_type: input
|
||||
data_type: float32
|
||||
precision: 2
|
||||
unique_id: "SDM230_ImportActiveEnergy"
|
||||
- name: Export_Active_Energy
|
||||
unit_of_measurement: kWh
|
||||
slave: 2
|
||||
address: 74
|
||||
input_type: input
|
||||
data_type: float32
|
||||
precision: 2
|
||||
unique_id: "SDM230_ExportActiveEnergy"
|
||||
- name: Import_Reactive_Energy
|
||||
unit_of_measurement: kVARh
|
||||
slave: 2
|
||||
address: 76
|
||||
input_type: input
|
||||
data_type: float32
|
||||
precision: 2
|
||||
unique_id: "SDM230_ImportReactiveEnergy"
|
||||
- name: Export_Reactive_Energy
|
||||
unit_of_measurement: kVARh
|
||||
slave: 2
|
||||
address: 78
|
||||
input_type: input
|
||||
data_type: float32
|
||||
precision: 2
|
||||
unique_id: "SDM230_ExportReactiveEnergy"
|
||||
- name: Total_Active_Energy
|
||||
unit_of_measurement: kWh
|
||||
slave: 2
|
||||
address: 342
|
||||
input_type: input
|
||||
data_type: float32
|
||||
precision: 2
|
||||
state_class: total_increasing
|
||||
unique_id: "SDM230_TotalActiveEnergy"
|
||||
- name: Total_Reactive_Energy
|
||||
unit_of_measurement: kVARh
|
||||
slave: 2
|
||||
address: 344
|
||||
input_type: input
|
||||
data_type: float32
|
||||
precision: 2
|
||||
unique_id: "SDM230_TotalReactiveEnergy"
|
||||
|
||||
http:
|
||||
# For extra security set this to only accept connections on localhost if NGINX is on the same machine
|
||||
# Uncommenting this will mean that you can only reach Home Assistant using the proxy, not directly via IP from other clients.
|
||||
# server_host: 127.0.0.1
|
||||
use_x_forwarded_for: true
|
||||
# You must set the trusted proxy IP address so that Home Assistant will properly accept connections
|
||||
# Set this to your NGINX machine IP, or localhost if hosted on the same machine.
|
||||
trusted_proxies: 192.168.10.41
|
||||
|
||||
# Modpoll for CJ meter
|
||||
|
||||
#./modpoll/x86_64-linux-gnu/modpoll -h
|
||||
#modpoll 3.10 - FieldTalk(tm) Modbus(R) Master Simulator
|
||||
#Copyright (c) 2002-2021 proconX Pty Ltd
|
||||
#Visit https://www.modbusdriver.com for Modbus libraries and tools.
|
||||
#
|
||||
#Usage: modpoll [OPTIONS] SERIALPORT|HOST [WRITEVALUES...]
|
||||
#Arguments:
|
||||
#SERIALPORT Serial port when using Modbus ASCII or Modbus RTU protocol
|
||||
# COM1, COM2 ... on Windows
|
||||
# /dev/ttyS0, /dev/ttyS1 ... on Linux
|
||||
#HOST Host name or dotted IP address when using MDBUS/TCP protocol
|
||||
#WRITEVALUES List of values to be written. If none specified (default) modpoll reads data.
|
||||
#General options:
|
||||
#-m ascii Modbus ASCII protocol
|
||||
#-m rtu Modbus RTU protocol (default if SERIALPORT contains a /)
|
||||
#-m tcp MODBUS/TCP protocol (default otherwise)
|
||||
#-m udp MODBUS UDP
|
||||
#-m enc Encapsulated Modbus RTU over TCP
|
||||
#-a # Slave address (1-247 for serial, 0-255 for TCP, 1 is default)
|
||||
#-r # Start reference (1-65536, 100 is default)
|
||||
#-c # Number of values to read (1-125, 1 is default), optional for writing (use -c 1 to force FC5 or FC6)
|
||||
#-t 0 Discrete output (coil) data type
|
||||
#-t 1 Discrete input data type
|
||||
#-t 3 16-bit input register data type
|
||||
#-t 3:hex 16-bit input register data type with hex display
|
||||
#-t 3:int 32-bit integer data type in input register table
|
||||
#-t 3:mod 32-bit module 10000 data type in input register table
|
||||
#-t 3:float 32-bit float data type in input register table
|
||||
#-t 4 16-bit output (holding) register data type (default)
|
||||
#-t 4:hex 16-bit output (holding) register data type with hex display
|
||||
#-t 4:int 32-bit integer data type in output (holding) register table
|
||||
#-t 4:mod 32-bit module 10000 type in output (holding) register table
|
||||
#-t 4:float 32-bit float data type in output (holding) register table
|
||||
#-i Slave operates on big-endian 32-bit integers
|
||||
#-f Slave operates on big-endian 32-bit floats
|
||||
#-e Use Daniel/Enron single register 32-bit mode (implies -i and -f)
|
||||
#-0 First reference is 0 (PDU addressing) instead 1
|
||||
#-1 Poll only once only, otherwise every poll rate interval
|
||||
#-l # Poll rate in ms, (1000 is default)
|
||||
#-o # Time-out in seconds (0.01 - 10.0, 1.0 s is default)
|
||||
#Options for MODBUS/TCP, UDP and RTU over TCP:
|
||||
#-p # IP protocol port number (502 is default)
|
||||
#Options for Modbus ASCII and Modbus RTU:
|
||||
#-b # Baudrate (e.g. 9600, 19200, ...) (19200 is default)
|
||||
#-d # Databits (7 or 8 for ASCII protocol, 8 for RTU)
|
||||
#-s # Stopbits (1 or 2, 1 is default)
|
||||
#-p none No parity
|
||||
#-p even Even parity (default)
|
||||
#-p odd Odd parity
|
||||
#-4 # RS-485 mode, RTS on while transmitting and another # ms after
|
||||
|
||||
# ./modpoll -c 80 -b 9600 -a 1 -1 -p none -t 3 /dev/ttyUSB0
|
||||
# modpoll 3.10 - FieldTalk(tm) Modbus(R) Master Simulator
|
||||
# Copyright (c) 2002-2021 proconX Pty Ltd
|
||||
# Visit https://www.modbusdriver.com for Modbus libraries and tools.
|
||||
#
|
||||
#Protocol configuration: Modbus RTU, FC4
|
||||
#Slave configuration...: address = 1, start reference = 1, count = 80
|
||||
#Communication.........: /dev/ttyUSB0, 9600, 8, 1, none, t/o 1.00 s, poll rate 1000 ms
|
||||
#Data type.............: 16-bit register, input register table
|
||||
|
||||
#-- Polling slave...
|
||||
#[1]: 8888
|
||||
#[2]: 256
|
||||
#[3]: 0
|
||||
#[4]: 1
|
||||
#[5]: 16
|
||||
#[6]: -30846
|
||||
#[7]: 5000
|
||||
#[8]: 3000
|
||||
#[9]: -31868
|
||||
#[10]: 3000
|
||||
#[11]: 6000
|
||||
#[12]: 257
|
||||
#[13]: 257
|
||||
#[14]: 257
|
||||
#[15]: 0
|
||||
#[16]: 0
|
||||
#[17]: 0
|
||||
#[18]: 0
|
||||
#[19]: 0
|
||||
#[20]: 0
|
||||
#[21]: 500
|
||||
#[22]: 30
|
||||
#[23]: -30844
|
||||
#[24]: 6000
|
||||
#[25]: 6000
|
||||
#[26]: 257
|
||||
#[27]: 0
|
||||
#[28]: 0
|
||||
#[29]: 0
|
||||
#[30]: 0
|
||||
#[31]: 0
|
||||
#[32]: 0
|
||||
#[33]: 0
|
||||
#[34]: 0
|
||||
#[35]: 0
|
||||
#[36]: 769
|
||||
#[37]: 1135
|
||||
#[38]: 2288
|
||||
#[39]: 0
|
||||
#[40]: 0
|
||||
#[41]: 2288
|
||||
#[42]: 0
|
||||
#[43]: 2288
|
||||
#[44]: 5216
|
||||
#[45]: 0
|
||||
#[46]: 0
|
||||
#[47]: 865
|
||||
#[48]: 0
|
||||
#[49]: 0
|
||||
#[50]: 865
|
||||
#[51]: 587
|
||||
#[52]: 0
|
||||
#[53]: 0
|
||||
#[54]: 587
|
||||
#[55]: 827
|
||||
#[56]: 999
|
||||
#[57]: 999
|
||||
#[58]: 827
|
||||
#[59]: 1046
|
||||
#[60]: 0
|
||||
#[61]: 0
|
||||
#[62]: 1046
|
||||
#[63]: 4995
|
||||
#[64]: 14
|
||||
#[65]: -25104
|
||||
#[66]: 0
|
||||
#[67]: 0
|
||||
#[68]: 9
|
||||
#[69]: -13187
|
||||
#[70]: 0
|
||||
#[71]: 0
|
||||
#[72]: 19305
|
||||
#[73]: -4744
|
||||
#[74]: 0
|
||||
#[75]: 0
|
||||
#[76]: 19228
|
||||
#[77]: -11734
|
||||
#[78]: 0
|
||||
#[79]: 0
|
||||
#[80]: 0
|
||||
|
23
pg-serverroom-monitor/dht/dht.ino
Normal file
23
pg-serverroom-monitor/dht/dht.ino
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include "DHT.h"
|
||||
|
||||
DHT dht;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(9600);
|
||||
dht.setup(3); // data pin 3
|
||||
float humidity = dht.getHumidity();
|
||||
float temperature = dht.getTemperature();
|
||||
Serial.print(dht.getStatusString());
|
||||
Serial.print("\t");
|
||||
Serial.print(humidity, 1);
|
||||
Serial.print("\t");
|
||||
Serial.print(temperature, 1);
|
||||
Serial.print("\n");
|
||||
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in a new issue