Skip to content

Commit

Permalink
v1.0.15: option to set loglevel
Browse files Browse the repository at this point in the history
  • Loading branch information
jesseklm committed Aug 7, 2024
1 parent 52a7b58 commit 30e2b3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ Tested: SH10RT
services:
sungrowmodbus2mqtt:
container_name: sungrowmodbus2mqtt
image: ghcr.io/jesseklm/sungrowmodbus2mqtt:v1.0.14
image: ghcr.io/jesseklm/sungrowmodbus2mqtt:v1.0.15
restart: unless-stopped
volumes:
- ./config.sh10rt.yaml:/config/config.yaml:ro
```
- `wget -O config.sh10rt.yaml https://raw.githubusercontent.com/jesseklm/sungrowmodbus2mqtt/v1.0.14/config.sh10rt.example.yaml`
- `wget -O config.sh10rt.yaml https://raw.githubusercontent.com/jesseklm/sungrowmodbus2mqtt/v1.0.15/config.sh10rt.example.yaml`
- adjust your config yaml
- `docker compose up -d`
9 changes: 8 additions & 1 deletion sungrowmodbus2mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@
from modbus_handler import ModbusHandler
from mqtt_handler import MqttHandler

__version__ = '1.0.14'
__version__ = '1.0.15'


class SungrowModbus2Mqtt:
def __init__(self):
config = get_first_config()
if 'logging' in config:
logging_level_name = config['logging'].upper()
logging_level = logging.getLevelNamesMapping().get(logging_level_name, logging.NOTSET)
if logging_level != logging.NOTSET:
logging.getLogger().setLevel(logging_level)
else:
logging.warning(f'unknown logging level: {logging_level}.')
self.mqtt_handler = MqttHandler(config)
self.modbus_handler = ModbusHandler(config)
signal.signal(signal.SIGINT, self.exit_handler)
Expand Down

0 comments on commit 30e2b3f

Please sign in to comment.