Skip to content

Commit

Permalink
example cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrils committed Feb 9, 2023
1 parent b4a7e48 commit 62a8040
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,12 @@ mqtt:
state_topic: "solar/stats"
unit_of_measurement: "%"
value_template: "{{ value_json.battery_percentage }}"

# check output log for more fields
```

**Custom logging**

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>`
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>`

Example php code at the server:
```php
Expand Down
8 changes: 4 additions & 4 deletions example.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

def on_data_received(client: BTOneClient, data):
logging.debug("{} => {}".format(client.device.alias(), data))
if client.config['remote_logging'].getboolean('enabled'):
if config['remote_logging'].getboolean('enabled'):
data_logger.log_remote(json_data=data)
if client.config['mqtt'].getboolean('enabled'):
if config['mqtt'].getboolean('enabled'):
data_logger.log_mqtt(json_data=data)
if client.config['pvoutput'].getboolean('enabled'):
if config['pvoutput'].getboolean('enabled'):
data_logger.log_pvoutput(json_data=data)
if not client.config['device'].getboolean('enable_polling'):
if not config['device'].getboolean('enable_polling'):
client.disconnect()

logging.info(f"Starting client: {config['device']['alias']} => {config['device']['mac_addr']}")
Expand Down
2 changes: 1 addition & 1 deletion renogybt/BTOneClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def connect(self):
except Exception as e:
self.__on_error(True, e)
except KeyboardInterrupt:
self.__on_error()
self.__on_error(False, "KeyboardInterrupt")

def disconnect(self):
self.device.disconnect()
Expand Down

0 comments on commit 62a8040

Please sign in to comment.