Feature/v0.0.2 (#4)
* device_class: measurement for NASA_EHSSENTINEL_COP and NASA_EHSSENTINEL_HEAT_OUTPUT * state_class: measurement for NASA_EHSSENTINEL_COP and NASA_EHSSENTINEL_HEAT_OUTPUT * ENUM_IN_WATERPUMP_PWM_VALUE as var not enum Unit % as = measurement * NASA_OUTDOOR_CONTROL_WATTMETER_ALL_UNIT_ACCUM state_class: total_increasing * NASA_OUTDOOR_CONTROL_WATTMETER_ALL_UNIT_ACCUM device_class and unit * NASA_OUTDOOR_CONTROL_WATTMETER_ALL_UNIT_ACCUM device_class energy * fixing ValueError and better logging for determine_value try catch * update reqierments and rreadme for venv
This commit is contained in:
@@ -322,7 +322,7 @@ class MQTTClient:
|
|||||||
if entity[namenorm]['unit_of_measurement'] == "\u00b0C":
|
if entity[namenorm]['unit_of_measurement'] == "\u00b0C":
|
||||||
entity[namenorm]['device_class'] = "temperature"
|
entity[namenorm]['device_class'] = "temperature"
|
||||||
elif entity[namenorm]['unit_of_measurement'] == '%':
|
elif entity[namenorm]['unit_of_measurement'] == '%':
|
||||||
entity[namenorm]['device_class'] = "power_factor"
|
entity[namenorm]['state_class'] = "measurement"
|
||||||
elif entity[namenorm]['unit_of_measurement'] == 'kW':
|
elif entity[namenorm]['unit_of_measurement'] == 'kW':
|
||||||
entity[namenorm]['device_class'] = "power"
|
entity[namenorm]['device_class'] = "power"
|
||||||
elif entity[namenorm]['unit_of_measurement'] == 'rpm':
|
elif entity[namenorm]['unit_of_measurement'] == 'rpm':
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class MessageProcessor:
|
|||||||
try:
|
try:
|
||||||
msgvalue = self.determine_value(msg.packet_payload, msgname)
|
msgvalue = self.determine_value(msg.packet_payload, msgname)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise MessageWarningException(argument=msg['payload'], message=f"Value of {hexmsg:<6} couldn't be determinate, skip Message {e}")
|
raise MessageWarningException(argument=msg.packet_payload, message=f"Value of {hexmsg} couldn't be determinate, skip Message {e}")
|
||||||
self.protocolMessage(msg, msgname, msgvalue)
|
self.protocolMessage(msg, msgname, msgvalue)
|
||||||
else:
|
else:
|
||||||
logger.debug(f"Message not Found in NASA repository: {hexmsg:<6} Type: {msg.packet_message_type} Payload: {msg.packet_payload}")
|
logger.debug(f"Message not Found in NASA repository: {hexmsg:<6} Type: {msg.packet_message_type} Payload: {msg.packet_payload}")
|
||||||
|
|||||||
@@ -259,9 +259,9 @@ class NASAPacket:
|
|||||||
elif message_type == 3:
|
elif message_type == 3:
|
||||||
payload_size = len(msg_rest)
|
payload_size = len(msg_rest)
|
||||||
if capacity != 1:
|
if capacity != 1:
|
||||||
raise ValueError(message="Message with structure type must have capacity of 1.")
|
raise ValueError("Message with structure type must have capacity of 1.")
|
||||||
else:
|
else:
|
||||||
raise ValueError(message=f"Mssage type unknown: {message_type}")
|
raise ValueError(f"Mssage type unknown: {message_type}")
|
||||||
|
|
||||||
payload = msg_rest[2:2 + payload_size]
|
payload = msg_rest[2:2 + payload_size]
|
||||||
if len(payload) > 255:
|
if len(payload) > 255:
|
||||||
|
|||||||
59
README.md
59
README.md
@@ -60,6 +60,65 @@ EHS-Sentinel subscribes <hass_discovery_prefix>/status Topic and if it receive a
|
|||||||
`journalctl | grep ehsSentinel`
|
`journalctl | grep ehsSentinel`
|
||||||
|
|
||||||
|
|
||||||
|
## Venv Installation (recommendet)
|
||||||
|
|
||||||
|
In general, it is recommended to work with a virtual environment (venvs) in python to be independent of other projects.
|
||||||
|
Some Distributions like debian 12 dont allow to use system wide pip package installation, so you have to use venv.
|
||||||
|
|
||||||
|
1. Just clone the repository
|
||||||
|
`git clone https://github.com/echoDaveD/EHS-Sentinel`
|
||||||
|
|
||||||
|
2. Install python venv
|
||||||
|
`apt install python3.11-venv` <- modify your python verison here
|
||||||
|
|
||||||
|
3. Create Python venv
|
||||||
|
`python3 -m venv EHS-Sentinel`
|
||||||
|
|
||||||
|
4. change diractory
|
||||||
|
`cd EHS-Sentinel`
|
||||||
|
|
||||||
|
5. activate venv
|
||||||
|
`source bin/activate`
|
||||||
|
|
||||||
|
6. Install the requierments
|
||||||
|
`pip install -r requirements.txt`
|
||||||
|
|
||||||
|
7. Copy the `data/config.yml` and provide your Configuration
|
||||||
|
|
||||||
|
8. get path of venv python executable
|
||||||
|
`which python3` <- copy the output
|
||||||
|
|
||||||
|
9. Change to ehs-sentinel.service file as followed:
|
||||||
|
|
||||||
|
`ExecStart = <path to python3> <Path of the script you want to run>` <- provide here to path to your folder where startEHSSentinel.py is
|
||||||
|
|
||||||
|
sample: `ExecStart = /root/EHS-Sentinel/bin/python3 /root/EHS-Sentinel/startEHSSentinel.py --configfile /root/EHS-Sentinel/config.yml`
|
||||||
|
|
||||||
|
10. Change your `config.yml` to absolut paths:
|
||||||
|
`nasaRepositoryFile: /root/EHS-Sentinel/data/NasaRepository.yml`
|
||||||
|
|
||||||
|
11. Deactivate venv
|
||||||
|
`dactivate`
|
||||||
|
|
||||||
|
12. Copy the service File to your systemd folder:
|
||||||
|
`cp ehs-sentinel.service /etc/systemd/system`
|
||||||
|
|
||||||
|
13. Enable the new service
|
||||||
|
`systemctl enable ehs-sentinel`
|
||||||
|
|
||||||
|
14. Reload deamon
|
||||||
|
`systemctl daemon-reload`
|
||||||
|
|
||||||
|
15. Start the Service
|
||||||
|
`systemctl start ehs-sentinel`
|
||||||
|
|
||||||
|
16. check if anything is fine
|
||||||
|
`systemctl status ehs-sentinel`
|
||||||
|
|
||||||
|
17. If your want to check the journal logs
|
||||||
|
`journalctl | grep ehsSentinel`
|
||||||
|
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -787,7 +787,7 @@ ENUM_IN_WATERPUMP_PWM_VALUE:
|
|||||||
description: Water pump speed
|
description: Water pump speed
|
||||||
remarks: "unit\xC2\_%"
|
remarks: "unit\xC2\_%"
|
||||||
signed: ''
|
signed: ''
|
||||||
type: ENUM
|
type: VAR
|
||||||
unit: '%'
|
unit: '%'
|
||||||
ENUM_IN_WATER_VALVE_1_ON_OFF:
|
ENUM_IN_WATER_VALVE_1_ON_OFF:
|
||||||
address: '0x4103'
|
address: '0x4103'
|
||||||
@@ -2887,10 +2887,10 @@ NASA_OUTDOOR_CONTROL_WATTMETER_ALL_UNIT_ACCUM:
|
|||||||
description: Outdoor unit cumulative power consumption. Sum of modules
|
description: Outdoor unit cumulative power consumption. Sum of modules
|
||||||
remarks: value is Wh, so do div 1000
|
remarks: value is Wh, so do div 1000
|
||||||
state_class: total_increasing
|
state_class: total_increasing
|
||||||
device_class: "measurement"
|
device_class: energy
|
||||||
signed: 'false'
|
signed: 'false'
|
||||||
type: LVAR
|
type: LVAR
|
||||||
unit: kW
|
unit: kWh
|
||||||
NASA_OUTDOOR_CONTROL_WATTMETER_TOTAL_SUM:
|
NASA_OUTDOOR_CONTROL_WATTMETER_TOTAL_SUM:
|
||||||
address: '0x8415'
|
address: '0x8415'
|
||||||
arithmetic: ''
|
arithmetic: ''
|
||||||
@@ -5796,6 +5796,7 @@ NASA_EHSSENTINEL_COP:
|
|||||||
arithmetic: ''
|
arithmetic: ''
|
||||||
description: Current COP
|
description: Current COP
|
||||||
remarks: Custom Measurment
|
remarks: Custom Measurment
|
||||||
|
state_class: measurement
|
||||||
signed: 'true'
|
signed: 'true'
|
||||||
type: VAR
|
type: VAR
|
||||||
unit: ''
|
unit: ''
|
||||||
@@ -5804,6 +5805,7 @@ NASA_EHSSENTINEL_HEAT_OUTPUT:
|
|||||||
arithmetic: ''
|
arithmetic: ''
|
||||||
description: Current generated Heat Output
|
description: Current generated Heat Output
|
||||||
remarks: Custom Measurment
|
remarks: Custom Measurment
|
||||||
|
state_class: measurement
|
||||||
signed: 'true'
|
signed: 'true'
|
||||||
type: VAR
|
type: VAR
|
||||||
unit: "kW"
|
unit: "kW"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
aiofiles>=24.1.0
|
aiofiles>=24.1.0
|
||||||
|
future>=1.0.0
|
||||||
|
gmqtt>=0.7.0
|
||||||
|
iso8601>=2.1.0
|
||||||
pyserial>=3.5
|
pyserial>=3.5
|
||||||
pyserial-asyncio>=0.6
|
pyserial-asyncio>=0.6
|
||||||
PyYAML>=6.0.2
|
PyYAML>=6.0.2
|
||||||
serial>=0.0.97
|
|
||||||
gmqtt>=0.7.0
|
|
||||||
Reference in New Issue
Block a user