-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #258 from stuartpittaway/wifi_mqtt_fixes
Wifi mqtt fixes/home assistant
- Loading branch information
Showing
29 changed files
with
1,698 additions
and
529 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# diyBMS v4 | ||
## Home Assistant RESTful API integration | ||
|
||
|
||
|
||
### Secrets Configuration YAML file for Home Assistant | ||
``` | ||
# Use this file to store secrets like usernames and passwords. | ||
# Learn more at https://www.home-assistant.io/docs/configuration/secrets/ | ||
diybms_api_token: XXXXXXXXXXXXXXXXXXXXXXXX | ||
``` | ||
|
||
### Example Configuration YAML file for Home Assistant | ||
``` | ||
# Example configuration.yaml entry for Home Assistant integration with DIYBMS | ||
rest: | ||
- resource: http://192.168.0.70/ha | ||
scan_interval: 10 | ||
timeout: 5 | ||
method: "GET" | ||
headers: | ||
Content-Type: application/json | ||
ApiKey: !secret diybms_api_token | ||
sensor: | ||
- unique_id: "diybms.activerules" | ||
value_template: "{{ value_json.activerules }}" | ||
name: "Active rules" | ||
state_class: "measurement" | ||
- unique_id: "diybms.chargemode" | ||
value_template: "{{ value_json.chgmode }}" | ||
name: "Charge mode" | ||
state_class: "measurement" | ||
- unique_id: "diybms.lowest_bank_voltage" | ||
value_template: "{{ value_json.lowbankv }}" | ||
name: "Lowest bank voltage" | ||
unit_of_measurement: "mV" | ||
device_class: "voltage" | ||
- unique_id: "diybms.highest_bank_voltage" | ||
value_template: "{{ value_json.highbankv }}" | ||
name: "Highest bank voltage" | ||
unit_of_measurement: "mV" | ||
device_class: "voltage" | ||
- unique_id: "diybms.lowest_cell_voltage" | ||
value_template: "{{ value_json.lowcellv }}" | ||
name: "Lowest cell voltage" | ||
unit_of_measurement: "mV" | ||
device_class: "voltage" | ||
- unique_id: "diybms.highest_cell_voltage" | ||
value_template: "{{ value_json.highcellv }}" | ||
name: "Highest cell voltage" | ||
unit_of_measurement: "mV" | ||
device_class: "voltage" | ||
- unique_id: "diybms.highest_external_temp" | ||
value_template: "{{ value_json.highextt }}" | ||
name: "Highest cell temperature" | ||
unit_of_measurement: "°C" | ||
device_class: "temperature" | ||
- unique_id: "diybms.highest_internal_temp" | ||
value_template: "{{ value_json.highintt }}" | ||
name: "Highest passive balance temperature" | ||
unit_of_measurement: "°C" | ||
device_class: "temperature" | ||
- unique_id: "diybms.current" | ||
value_template: "{% if 'c' in value_json %}{{ value_json.c }}{% else %}0{% endif %}" | ||
name: "DC Current" | ||
unit_of_measurement: "A" | ||
device_class: "current" | ||
icon: "mdi:current-dc" | ||
- unique_id: "diybms.voltage" | ||
value_template: "{% if 'v' in value_json %}{{ value_json.v }}{% else %}0{% endif %}" | ||
name: "DC voltage" | ||
unit_of_measurement: "V" | ||
device_class: "voltage" | ||
- unique_id: "diybms.power" | ||
value_template: "{% if 'pwr' in value_json %}{{ value_json.pwr }}{% else %}0{% endif %}" | ||
name: "Battery power" | ||
unit_of_measurement: "W" | ||
device_class: "power" | ||
- unique_id: "diybms.stateofcharge" | ||
value_template: "{% if 'soc' in value_json %}{{ value_json.soc }}{% else %}0{% endif %}" | ||
name: "State of charge" | ||
unit_of_measurement: "%" | ||
device_class: "battery" | ||
- unique_id: "diybms.dynamic_charge_voltage" | ||
value_template: "{% if 'dyncv' in value_json %}{{ value_json.dyncv }}{% else %}0{% endif %}" | ||
name: "Dynamic charge voltage" | ||
unit_of_measurement: "V" | ||
device_class: "voltage" | ||
- unique_id: "diybms.dynamic_charge_current" | ||
value_template: "{% if 'dyncc' in value_json %}{{ value_json.dyncc }}{% else %}0{% endif %}" | ||
name: "Dynamic charge current" | ||
unit_of_measurement: "A" | ||
device_class: "current" | ||
binary_sensor: | ||
- unique_id: "diybms.charge_allowed" | ||
value_template: "{{ value_json.chgallow }}" | ||
name: "Battery charging allowed" | ||
- unique_id: "diybms.discharge_allowed" | ||
value_template: "{{ value_json.dischgallow }}" | ||
name: "Battery discharging allowed" | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef DIYBMS_PYLONFORCE_CANBUS_H_ | ||
#define DIYBMS_PYLONFORCE_CANBUS_H_ | ||
|
||
#include "defines.h" | ||
#include "Rules.h" | ||
#include <driver/twai.h> | ||
|
||
|
||
void pylonforce_handle_rx(twai_message_t *); | ||
void pylonforce_handle_tx(); | ||
|
||
|
||
extern uint8_t TotalNumberOfCells(); | ||
extern Rules rules; | ||
extern currentmonitoring_struct currentMonitor; | ||
extern diybms_eeprom_settings mysettings; | ||
extern std::string hostname; | ||
extern ControllerState _controller_state; | ||
extern uint32_t canbus_messages_failed_sent; | ||
extern uint32_t canbus_messages_sent; | ||
extern uint32_t canbus_messages_received; | ||
extern bool wifi_isconnected; | ||
|
||
extern void send_ext_canbus_message(const uint32_t identifier, const uint8_t *buffer, const uint8_t length); | ||
|
||
#endif |
This file contains 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 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
Oops, something went wrong.