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:
echoDaveD
2025-02-12 21:26:45 +01:00
committed by GitHub
parent df2985c964
commit ef1e0a0f79
6 changed files with 72 additions and 10 deletions

View File

@@ -322,7 +322,7 @@ class MQTTClient:
if entity[namenorm]['unit_of_measurement'] == "\u00b0C":
entity[namenorm]['device_class'] = "temperature"
elif entity[namenorm]['unit_of_measurement'] == '%':
entity[namenorm]['device_class'] = "power_factor"
entity[namenorm]['state_class'] = "measurement"
elif entity[namenorm]['unit_of_measurement'] == 'kW':
entity[namenorm]['device_class'] = "power"
elif entity[namenorm]['unit_of_measurement'] == 'rpm':

View File

@@ -76,7 +76,7 @@ class MessageProcessor:
try:
msgvalue = self.determine_value(msg.packet_payload, msgname)
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)
else:
logger.debug(f"Message not Found in NASA repository: {hexmsg:<6} Type: {msg.packet_message_type} Payload: {msg.packet_payload}")

View File

@@ -259,9 +259,9 @@ class NASAPacket:
elif message_type == 3:
payload_size = len(msg_rest)
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:
raise ValueError(message=f"Mssage type unknown: {message_type}")
raise ValueError(f"Mssage type unknown: {message_type}")
payload = msg_rest[2:2 + payload_size]
if len(payload) > 255:

View File

@@ -60,6 +60,65 @@ EHS-Sentinel subscribes <hass_discovery_prefix>/status Topic and if it receive a
`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

View File

@@ -787,7 +787,7 @@ ENUM_IN_WATERPUMP_PWM_VALUE:
description: Water pump speed
remarks: "unit\xC2\_%"
signed: ''
type: ENUM
type: VAR
unit: '%'
ENUM_IN_WATER_VALVE_1_ON_OFF:
address: '0x4103'
@@ -2887,10 +2887,10 @@ NASA_OUTDOOR_CONTROL_WATTMETER_ALL_UNIT_ACCUM:
description: Outdoor unit cumulative power consumption. Sum of modules
remarks: value is Wh, so do div 1000
state_class: total_increasing
device_class: "measurement"
device_class: energy
signed: 'false'
type: LVAR
unit: kW
unit: kWh
NASA_OUTDOOR_CONTROL_WATTMETER_TOTAL_SUM:
address: '0x8415'
arithmetic: ''
@@ -5796,6 +5796,7 @@ NASA_EHSSENTINEL_COP:
arithmetic: ''
description: Current COP
remarks: Custom Measurment
state_class: measurement
signed: 'true'
type: VAR
unit: ''
@@ -5804,6 +5805,7 @@ NASA_EHSSENTINEL_HEAT_OUTPUT:
arithmetic: ''
description: Current generated Heat Output
remarks: Custom Measurment
state_class: measurement
signed: 'true'
type: VAR
unit: "kW"

View File

@@ -1,6 +1,7 @@
aiofiles>=24.1.0
future>=1.0.0
gmqtt>=0.7.0
iso8601>=2.1.0
pyserial>=3.5
pyserial-asyncio>=0.6
PyYAML>=6.0.2
serial>=0.0.97
gmqtt>=0.7.0
PyYAML>=6.0.2