Skip to content

Commit 62a8040

Browse files
committed
example cleanup
1 parent b4a7e48 commit 62a8040

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,12 @@ mqtt:
5656
state_topic: "solar/stats"
5757
unit_of_measurement: "%"
5858
value_template: "{{ value_json.battery_percentage }}"
59-
6059
# check output log for more fields
6160
```
6261

6362
**Custom logging**
6463

65-
You can even upload it to your own server. If you write your custom API, the json data is posted as body of the HTTP call. The optional `auth_header` is sent as http header `Authorization: Bearer <auth-header>`
64+
Should you choose to upload to your own server, the json data is posted as body of the HTTP call. The optional `auth_header` is sent as http header `Authorization: Bearer <auth-header>`
6665

6766
Example php code at the server:
6867
```php

example.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
def on_data_received(client: BTOneClient, data):
1313
logging.debug("{} => {}".format(client.device.alias(), data))
14-
if client.config['remote_logging'].getboolean('enabled'):
14+
if config['remote_logging'].getboolean('enabled'):
1515
data_logger.log_remote(json_data=data)
16-
if client.config['mqtt'].getboolean('enabled'):
16+
if config['mqtt'].getboolean('enabled'):
1717
data_logger.log_mqtt(json_data=data)
18-
if client.config['pvoutput'].getboolean('enabled'):
18+
if config['pvoutput'].getboolean('enabled'):
1919
data_logger.log_pvoutput(json_data=data)
20-
if not client.config['device'].getboolean('enable_polling'):
20+
if not config['device'].getboolean('enable_polling'):
2121
client.disconnect()
2222

2323
logging.info(f"Starting client: {config['device']['alias']} => {config['device']['mac_addr']}")

renogybt/BTOneClient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def connect(self):
5151
except Exception as e:
5252
self.__on_error(True, e)
5353
except KeyboardInterrupt:
54-
self.__on_error()
54+
self.__on_error(False, "KeyboardInterrupt")
5555

5656
def disconnect(self):
5757
self.device.disconnect()

0 commit comments

Comments
 (0)