Skip to content

Commit

Permalink
v1.08-fas
Browse files Browse the repository at this point in the history
* New Feature: Supports now Climate Autoconfiguration for Home Assistant (optional)
* New Feature: Switch Off (middle-button), then Longpress Down-Button, Beca switches to AP-Mode with default Password
* Automatic Wifi Fallback now optional
* Bugfix state cooling (wrong setting in EPROM, was not configurable)
* Temperature Precision 0.5/1.0
* some upstream fixes from klausahrenberg 1.03
  • Loading branch information
fashberg committed Apr 6, 2020
1 parent 72c1028 commit 792481b
Show file tree
Hide file tree
Showing 14 changed files with 256 additions and 56 deletions.
9 changes: 9 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## Version 1.08-fas
* New Feature: Supports now Climate Autoconfiguration for Home Assistant (optional)
* New Feature: Switch Off (middle-button), then Longpress Down-Button, Beca switches to AP-Mode with default Password
* Automatic Wifi Fallback now optional
* Bugfix state cooling (wrong setting in EPROM, was not configurable)
* Temperature Precision 0.5/1.0
* some upstream fixes from klausahrenberg 1.03
* by Folke Ashberg <folke@ashberg.de>

## Version 1.07-fas
* Device goes to AP-Mode if Wifi is not available/fails and switches back after 5 Minutes
* enabled WLAN auto-reconnect
Expand Down
18 changes: 18 additions & 0 deletions Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Steps are in general:
* Leave 'Support Mozilla WebThings' checked (recommended). If this is checked, the thermostat will always run the web interface.
You don't need to use Webthings itself.
* If you don't want to use MQTT, press 'Save Configuration' and wait for reboot of device.
![homeassistant](docs/Setup_Network.png)

## 3. Configure MQTT (optional)
* Stay at page 'Network configuration'
Expand Down Expand Up @@ -64,3 +65,20 @@ Normally you don't need to change options here.
| Europe/Berlin | 99 | 0,3,0,2,120 | 0,10,0,3,60 |
| Europe/London | 99 | 0,3,0,2,60 | 0,10,0,3,0 |
| America/New_York | 99 | 2,3,0,2,-240 | 1,11,0,2,-300

## 5. Troubleshooting

### Logging
If anything wents wrong set MQTT-Logging to "trace" and monitor with MQTT-Client:
```
mosquitto_sub -h <mqttserver> -v -t "<MQTT-TOPIC>/tele/log/#"
```

### Network Recovery
If you cannot access your device, try to switch to Access-Point mode:
* Power off the device by Pressing the button in the middle.
* Then press the "down" button (most right) for about 8 seconds.
* The Screen starts to blink and shows a WiFi-Icon.
* The thermostat is now an Access Point named `Thermostat-Beca_xxxxxx`. Default password is `12345678`
* Now you can fix network settings.
* Saving settings or pressing power button switches back to Station mode
80 changes: 61 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# ThermostatBecaWifi

Fork of https://github.com/klausahrenberg/WThermostatBeca with some new features

Replaces original Tuya firmware on Beca thermostat with ESP8266 wifi module. The firmware is tested with following devices:
* BHT-002-GBLW, BHT-6000 (floor heating)
* BHT-002-GALW (Water/Gas heating)
Expand All @@ -10,14 +13,22 @@ Also selled by Moes or Qiumi.
![homeassistant](docs/bac-002-wifi.jpg)

## Features
* Enables thermostat to communicate via MQTT and/or Mozilla Webthings
* No Cloud dependencies!
* Enables thermostat to communicate via MQTT and/or Mozilla WebThings
* Autodiscovery for Home Assistant via MQTT _(fas)_
* Autodiscovery for WebThings via mDNS
* Configuration of connection, device parameters and schedules via web interface
* Provides NTP, time zone handling and Daylight-Saving-Calculation to set the clock of thermostat
* Provides NTP, time zone handling and Daylight-Saving-Calculation _(fas)_ to set the clock of thermostat
* Provides Fallback to Access Point mode if requested using panel-buttons _(fas)_
* Reading and setting of all parameters via MQTT
* Reading and setting of main parameters via Webthings
* Reading and setting of main parameters via WebThings
* Only BHT-002-GxLW: actualFloorTemperature (external temperature sensor)
* Only BAC-002-ALW: fanSpeed:auto|low|medium|high; systemMode:cooling|heating|ventilation
* Reading and setting of time schedules via MQTT
* Reading and setting of Schedules via Web-GUI _(fas)_
* Logging to MQTT _(fas)_

_(fas)_: Only available in -fas version

## Hardware
The Hardware itself has two Microcontrollers:
Expand Down Expand Up @@ -62,11 +73,15 @@ To setup the device model, network options and other parameters, follow instrcut
Configuration.md
After initial setup, the device configuration is still available via `http://<device_ip>/`


Main Screen:
![homeassistant](docs/Setup_Main.png)
Network Screen:
![homeassistant](docs/Setup_Network.png)
Schedule Screen:
![homeassistant](docs/Setup_Schedules.png)

## Integration in Webthings
Since version 0.96 this firmware supports Mozilla Webthings directly. With webthings you can control the thermostat via the Gateway - inside and also outside of your home network. No clunky VPN, dynDNS solutions needed to access your home devices. I recommend to run the gateway in parallel to an MQTT server and for example Node-Red. Via MQTT you can control the thermostat completely and logic can be done by Node-Red. Webthings is used for outside control of main parameters.
## Integration in WebThings
Since version 0.96 this firmware supports Mozilla WebThings directly. With webthings you can control the thermostat via the Gateway - inside and also outside of your home network. No clunky VPN, dynDNS solutions needed to access your home devices. I recommend to run the gateway in parallel to an MQTT server and for example Node-Red. Via MQTT you can control the thermostat completely and logic can be done by Node-Red. WebThings is used for outside control of main parameters.
Add the device to the gateway via '+' icon. After that you have the new nice and shiny icon in the dashboard:
![webthing_icon](docs/Webthing_Icon.png)
The icon shows the actual temperature and heating state.
Expand All @@ -75,7 +90,16 @@ There is also a detailed view available:

## Integration in Home Assisant
![homeassistant](docs/homeassistant.png)
Here is an example for your configuration.yaml file:
ThermostatBecaWifi supports optional HASS-Autodiscovery since Version 1.08-fas (currently only for heating devices).
You have to enable it at Thermostate (settings network) and of course it must be enabled in your HASS configuration.yaml file:
```yaml
mqtt:
broker: <ip of broker>
discovery: true
discovery_prefix: homeassistant
```

For manual Configuration here is an example for your configuration.yaml file:
```yaml
climate:
- platform: mqtt
Expand Down Expand Up @@ -183,31 +207,49 @@ Also you can change single values by sending the value to `<your_topic>/cmnd/thi
Examples:
```
# set device on
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/properties/deviceOn -m "true"
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/properties/deviceOn -m "true"
# set device to heating
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/properties/mode -m "heat"
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/properties/mode -m "heat"
# set target temperature
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/properties/targetTemperature -m "23.5"
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/properties/targetTemperature -m "23.5"
# set target temperature (json)
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/properties -m '{"targetTemperature":23.00}'
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/properties -m '{"targetTemperature":23.00}'
# set target temperature and mode (json)
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/properties -m '{"targetTemperature":22.00,"mode":heat}'
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/properties -m '{"targetTemperature":22.00,"mode":heat}'
# set device to auto (target temperature controlled by MCU-Scheduler)
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/properties/mode -m "auto"
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/properties/mode -m "auto"
# just request properties
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/properties -n
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/properties -n
# request properties and show answer directly
mosquitto_rr -h mqtt -t home/test/cmnd/things/thermostat/properties -n -e home/test/stat/things/thermostat/properties
{"idx":"test","ip":"10.10.200.69","firmware":"1.04b","temperature":0.00,"targetTemperature":22.00,"deviceOn":true,"schedulesMode":"off","ecoMode":false,"locked":false,"systemMode":"heat","fanMode":"auto","mode":"heat"}
mosquitto_rr -h mqtt -t home/test/cmnd/things/thermostat/properties -n -e home/test/stat/things/thermostat/properties
# Change Schedules (here: weekday schedules)
mosquitto_pub -h mqtt -t home/test/cmnd/things/thermostat/schedules -m \
'{"w1h":"06:00","w1t":20.00,"w2h":"08:00","w2t":15.00,"w3h":"11:30","w3t":15.00,"w4h":"13:30","w4t":15.00,"w5h":"17:00","w5t":23.00,"w6h":"23:00","w6t":15.00}'
# disable MQTT logging
mosquitto_pub -h mqtt -t home/test/cmnd/things/logging/properties/logLevel -m "silent"
mosquitto_pub -h mqtt -t home/test/cmnd/things/logging/properties/logLevel -m "silent"
# set to level trace (available: silent|fatal|error|warning|notice|trace|verbose)
mosquitto_pub -h mqtt -t home/test/cmnd/things/logging/properties/logLevel -m "trace"
mosquitto_pub -h mqtt -t home/test/cmnd/things/logging/properties/logLevel -m "trace"
# show logs
mosquitto_sub -h mqtt -v -t "home/test/tele/log/#"
```

### Don't like or it doesn't work?
Flash the original firmware (see installation). Write me a message with your exact model and which parameter was not correct. Maybe your MQTT-server received some unknown messages - this would be also helpful for me. Again: I have tested this only with model BHT-002-GBLW. If you have another device, don't expect that this is working directly.

### Build this firmware from source
For build from sources you can use the Arduino-IDE, Sloeber or other. All sources needed are inside the folder 'WThermostat' and my other library: https://github.com/klausahrenberg/WAdapter. Additionally you will need some other libraries: DNSServer, EEPROM (for esp8266), ESP8266HTTPClient, ESP8266mDNS, ESP8266WebServer, ESP8266WiFi, Hash, NTPClient, Time - It's all available via board and library manager inside of ArduinoIDE
For build from sources i suggest <a href="https://code.visualstudio.com/">Visual Studio Code</a> and <a href="https://platformio.org/">Platform.IO</a>.
All sources needed are inside the folder 'WThermostat', also you need the WAdapter library from https://github.com/fashberg/WAdapter.
Additionally you will need some other libraries: DNSServer, EEPROM (for esp8266), ESP8266HTTPClient, ESP8266mDNS, ESP8266WebServer, ESP8266WiFi, Hash, NTPClient, Time.

0 comments on commit 792481b

Please sign in to comment.