-
Notifications
You must be signed in to change notification settings - Fork 3
[logging] Adjust log level, messages & enable debug [0.0.7a - Ready] #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
49352d5
[translations] remove unsupported sections
baylanger 7d183fa
[bashio::log] set log level, prevent presence & always topic update
baylanger b9433ca
remove trailing spaces
baylanger 50fbfb7
update topic if needed
baylanger d5f9f57
remove extra "
baylanger c340f66
Adjust UI's config list
baylanger 4d026f0
Fix BLE presence
baylanger 263c086
[wip] adjust logging
baylanger ef61d12
[logging] adjust msg & enable debug log
baylanger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,136 +1,136 @@ | ||
| #!/bin/ash | ||
|
|
||
| listen_to_mqtt() { | ||
| bashio::log.info "Connecting to MQTT server; subscribe topics tesla_ble/+ and homeassistant/status" | ||
| bashio::log.debug "Connecting to MQTT server; subscribe topics tesla_ble/+ and homeassistant/status" | ||
| mosquitto_sub --nodelay -E -c -i tesla_ble_mqtt -q 1 -h $MQTT_IP -p $MQTT_PORT -u "$MQTT_USER" -P "$MQTT_PWD" -t tesla_ble/+ -t homeassistant/status -F "%t %p" | \ | ||
| while read -r payload | ||
| do | ||
| topic=$(echo "$payload" | cut -d ' ' -f 1) | ||
| msg=$(echo "$payload" | cut -d ' ' -f 2-) | ||
| bashio::log.green "Received MQTT message: $topic $msg" | ||
| bashio::log.info "Received MQTT message: $topic $msg" | ||
| case $topic in | ||
| tesla_ble/config) | ||
| bashio::log.green "Configuration $msg requested" | ||
| bashio::log.info "Configuration $msg requested" | ||
| case $msg in | ||
| generate_keys) | ||
| bashio::log.green "Generating the private key" | ||
| bashio::log.info "Generating the private key" | ||
| openssl ecparam -genkey -name prime256v1 -noout > /share/tesla_ble_mqtt/private.pem | ||
| cat /share/tesla_ble_mqtt/private.pem | ||
| bashio::log.green "Generating the public key" | ||
| bashio::log.info "Generating the public key" | ||
| openssl ec -in /share/tesla_ble_mqtt/private.pem -pubout > /share/tesla_ble_mqtt/public.pem | ||
| cat /share/tesla_ble_mqtt/public.pem | ||
| bashio::log.green "KEYS GENERATED. Next: | ||
| bashio::log.info "KEYS GENERATED. Next: | ||
| 1/ Remove any previously deployed BLE keys from vehicle before deploying this one | ||
| 2/ Wake the car up with your Tesla App | ||
| 3/ Push the button 'Deploy Key'";; | ||
| deploy_key) | ||
| bashio::log.yellow "Deploying public key to vehicle" | ||
| send_key;; | ||
| *) | ||
| bashio::log.red "Invalid Configuration request. Topic: $topic Message: $msg";; | ||
| bashio::log.error "Invalid Configuration request. Topic: $topic Message: $msg";; | ||
| esac;; | ||
|
|
||
| tesla_ble/command) | ||
| bashio::log.green "Command $msg requested" | ||
| bashio::log.info "Command $msg requested" | ||
| case $msg in | ||
| wake) | ||
| bashio::log.green "Waking Car" | ||
| bashio::log.info "Waking Car" | ||
| send_command "-domain vcsec $msg";; | ||
| trunk-open) | ||
| bashio::log.green "Opening Trunk" | ||
| bashio::log.info "Opening Trunk" | ||
| send_command $msg;; | ||
| trunk-close) | ||
| bashio::log.green "Closing Trunk" | ||
| bashio::log.info "Closing Trunk" | ||
| send_command $msg;; | ||
| charging-start) | ||
| bashio::log.green "Start Charging" | ||
| bashio::log.info "Start Charging" | ||
| send_command $msg;; | ||
| charging-stop) | ||
| bashio::log.green "Stop Charging" | ||
| bashio::log.info "Stop Charging" | ||
| send_command $msg;; | ||
| charge-port-open) | ||
| bashio::log.green "Open Charge Port" | ||
| bashio::log.info "Open Charge Port" | ||
| send_command $msg;; | ||
| charge-port-close) | ||
| bashio::log.green "Close Charge Port" | ||
| bashio::log.info "Close Charge Port" | ||
| send_command $msg;; | ||
| climate-on) | ||
| bashio::log.green "Start Climate" | ||
| bashio::log.info "Start Climate" | ||
| send_command $msg;; | ||
| climate-off) | ||
| bashio::log.green "Stop Climate" | ||
| bashio::log.info "Stop Climate" | ||
| send_command $msg;; | ||
| flash-lights) | ||
| bashio::log.green "Flash Lights" | ||
| bashio::log.info "Flash Lights" | ||
| send_command $msg;; | ||
| frunk-open) | ||
| bashio::log.green "Open Frunk" | ||
| bashio::log.info "Open Frunk" | ||
| send_command $msg;; | ||
| honk) | ||
| bashio::log.green "Honk Horn" | ||
| bashio::log.info "Honk Horn" | ||
| send_command $msg;; | ||
| lock) | ||
| bashio::log.green "Lock Car" | ||
| bashio::log.info "Lock Car" | ||
| send_command $msg;; | ||
| unlock) | ||
| bashio::log.green "Unlock Car" | ||
| bashio::log.info "Unlock Car" | ||
| send_command $msg;; | ||
| windows-close) | ||
| bashio::log.green "Close Windows" | ||
| bashio::log.info "Close Windows" | ||
| send_command $msg;; | ||
| windows-vent) | ||
| bashio::log.green "Vent Windows" | ||
| bashio::log.info "Vent Windows" | ||
| send_command $msg;; | ||
| *) | ||
| bashio::log.red "Invalid Command Request. Topic: $topic Message: $msg";; | ||
| bashio::log.error "Invalid Command Request. Topic: $topic Message: $msg";; | ||
| esac;; | ||
|
|
||
| tesla_ble/charging-set-amps) | ||
| bashio::log.green "Set Charging Amps to $msg requested" | ||
| bashio::log.info "Set Charging Amps to $msg requested" | ||
| # https://github.com/iainbullock/tesla_ble_mqtt_docker/issues/4 | ||
| if [ $msg -gt 4 ]; then | ||
| bashio::log.green "Set amps" | ||
| bashio::log.info "Set amps" | ||
| send_command "charging-set-amps $msg" | ||
| else | ||
| bashio::log.green "First Amp set" | ||
| bashio::log.info "First Amp set" | ||
| send_command "charging-set-amps $msg" | ||
| sleep 1 | ||
| bashio::log.green "Second Amp set" | ||
| bashio::log.info "Second Amp set" | ||
| send_command "charging-set-amps $msg" | ||
| fi | ||
| ;; | ||
|
|
||
| tesla_ble/climate-set-temp) | ||
| bashio::log.green "Set Climate Temp to $msg requested" | ||
| bashio::log.info "Set Climate Temp to $msg requested" | ||
| send_command "climate-set-temp $msg";; | ||
|
|
||
| tesla_ble/seat-heater) | ||
| bashio::log.green "Set Seat Heater to $msg requested" | ||
| bashio::log.info "Set Seat Heater to $msg requested" | ||
| send_command "seat-heater $msg";; | ||
|
|
||
| tesla_ble/auto-seat-and-climate) | ||
| bashio::log.green "Start Auto Seat and Climate" | ||
| bashio::log.info "Start Auto Seat and Climate" | ||
| send_command "auto-seat-and-climate LR on";; | ||
|
|
||
| tesla_ble/charging-set-limit) | ||
| bashio::log.green "Set Charging limit to $msg requested" | ||
| bashio::log.info "Set Charging limit to $msg requested" | ||
| send_command "charging-set-limit $msg";; | ||
|
|
||
| tesla_ble/heated_seat_left) | ||
| bashio::log.green "Set Seat heater to front-left $msg requested" | ||
| bashio::log.info "Set Seat heater to front-left $msg requested" | ||
| send_command "seat-heater front-left $msg";; | ||
|
|
||
| tesla_ble/heated_seat_right) | ||
| bashio::log.green "Set Seat heater to front-right $msg requested" | ||
| bashio::log.info "Set Seat heater to front-right $msg requested" | ||
| send_command "seat-heater front-right $msg";; | ||
|
|
||
| homeassistant/status) | ||
| # https://github.com/iainbullock/tesla_ble_mqtt_docker/discussions/6 | ||
| bashio::log.green "Home Assistant is stopping or starting, re-running auto-discovery setup" | ||
| bashio::log.info "Home Assistant is stopping or starting, re-running auto-discovery setup" | ||
| setup_auto_discovery;; | ||
|
|
||
| *) | ||
| bashio::log.red "Invalid MQTT topic. Topic: $topic Message: $msg";; | ||
| bashio::log.error "Invalid MQTT topic. Topic: $topic Message: $msg";; | ||
| esac | ||
| done | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may pass an explicit parameter to enable BLE presence scan later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand your comment properly, that is added in #25 using configuration setting
BLE_PRESENCE_ENABLE(true|false).