Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
blakadder authored Feb 19, 2021
2 parents 887eaf6 + ba54eee commit f6a64cb
Show file tree
Hide file tree
Showing 108 changed files with 2,450 additions and 909 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
command: |
python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip && pip install -r requirements.txt
pip install --upgrade pip && pip install --upgrade -r requirements.txt
- save_cache:
paths:
Expand Down
4 changes: 2 additions & 2 deletions docs/ADC.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ ESP8266 has a single ADC pin available. It may be used to read voltage at ADC pi

By default Tasmota uses the ADC pin to read voltage. The signal comes from an analog [peripheral](), or sometimes from the device itself (see [Shelly 2.5](/devices/Shelly-2.5)).

After wiring a peripheral to A0 pin you have to configure it in **Configure Module**:
After wiring a peripheral to GPIO17 (A0) pin you have to configure it in **Configure Module**:

![ADC configuration](https://i.postimg.cc/qqYmYG3v/ADC.png)
![ADC configuration](_media/A0.png)

#|Option|WebUI display|MQTT mesage
-|-|-|-
Expand Down
3 changes: 1 addition & 2 deletions docs/AS3935.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ In the **_Configuration -> Configure Module_** page assign:
You will need to wire up all of the associated pins for the different boards.<br>
- Always connect CS and MISO to GND.<br>
- If "SI" is present, you need to connect to VCC.<br>
See some wiring on the Board pictures below. [I2C wiring](#breakout-boards-and-wiring-for-i2c-use:)
See some wiring on the Board pictures below. [I2C wiring](#breakout-boards-and-wiring-for-i2c-use)

![Module Settings](https://user-images.githubusercontent.com/48546979/79037994-1bedab80-7bd6-11ea-88db-0d88dcb05628.png)

Expand Down Expand Up @@ -85,7 +85,6 @@ and in MQTT topic when an Event occurs:
Normally you don't need the calibrate function. If you buy the AS3935, the module has a sticker on it with the calibrated cap.
Use `AS3935Settunecaps` for setting up this value.<br>
if the calibration fails, it is possible that you have a board with the wrong caps on it! (some CJMCU-Boards)
[CJMCU Board](#-breakout-boards-issues:)


## Mqtt Events:
Expand Down
4 changes: 2 additions & 2 deletions docs/AWS-IoT.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ You will need to install/compile the following:

### 2. Enable AWS IoT in Tasmota

Using your favorite IDE, create `user_config_override.h` and add the required compilation directives as documented at the top of this article.
Add the required compilation directives to `user_config_override.h` as documented at the top of this article.

Note: TLS handshake takes ~1.2s on ESP8266 @80MHz. You may choose to switch to 160MHz if the power supply of your device supports it. If you do so, handshake time should be ~0.7s.

Expand All @@ -84,7 +84,7 @@ Compile the firmware and ensure it completes successfully.
### 3. Flash your device

Flash your device the normal way; either through serial or OTA. If you use OTA, first flash a `sonoff-minimal` firmware, then your target firmware.
Flash your device the normal way; either through serial or OTA.

### 4. Configure AWS IoT Policy (to be done once)

Expand Down
2 changes: 2 additions & 0 deletions docs/Alexa.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ In **Configuration - Configure Other** page in the webUI select emulation type.
!!! warning
Alexa Hue integration requires a physical Alexa device. The app alone is not enough.

!!! info "Check your router settings. You have to enable **IGMP**"

#### Belkin WeMo Emulation
Use Belkin WeMo for devices with a single relay or Hue Bridge for devices with one or more relays or for lights. Tasmota devices will be discovered by the Alexa app.

Expand Down
3 changes: 2 additions & 1 deletion docs/BH1750.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ Sensor sends a `tele/%topic%/SENSOR` JSON reponse:

Command|Parameters
:---|:---
Sensor10<a class="cmnd" id="sensor10"></a>|`0..2` = choose sensor resolution (`0` = high _(default)_, `1` = high2, `2` = low)<br>`31..254` = set measurement time _(default = `69`)_
Bh1750Resolution<x><a class="cmnd" id="bh1750resolution"></a>|resolution mode. x = sensor number (1..2)<br>`0..2` = choose sensor resolution (`0` = high _(default)_, `1` = high2, `2` = low)
Bh1750MTime<x><a class="cmnd" id="bh1750mtime"></a>|Measurement Time value. x = sensor number (1..2)<br>`31..254` = set measurement time _(default = `69`)_


## Breakout Boards
Expand Down
59 changes: 57 additions & 2 deletions docs/Berry-Scripting.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,47 @@ The Tasmota integration is far from complete and the following will be added lat
- LVGL integration
- (much more...)

## Loading code from filesystem

You can upload Berry code in the filesytem and load them at runtime. Just be careful to use the `*.be` extensions.

To load a Berry file, use the `load(filename)` function. It takes a filename and must end by `.be` or `.bec`.

Note: you don't need to prefix with `/`. A leading `/` will be added automatically if it is not present.

When loading a Berry script, the compiled bytecode is automatically saved to the filesystem, with the extension `.bec` (this is similar to Python's `.py`/`.pyc` mechanism). The `save(filename,closure)` function is used internally to save the bytecode.

Currently the precompiled is not loaded unless you explicitly use `load("filename.bec")` extension, this may change in the future.

Here is the Berry code in the `load()` function:

```python
# simple wrapper to load a file
# prefixes '/' if needed, and simpler to use than `compile()`
def load(f)
try
# check that the file ends with '.be' of '.bec'
var fl = string.split(f,'.')
if (size(fl) <= 1 || (fl[-1] != 'be' && fl[-1] != 'bec'))
raise "file extension is not '.be' or '.bec'"
end
var native = f[size(f)-1] == 'c'
# add prefix if needed
if f[0] != '/' f = '/' + f end
# load - works the same for .be and .bec
var c = compile(f,'file')
# save the compiled bytecode
if !native
save(f+'c', c)
end
# call the compiled code
c()
except .. as e
log(string.format(\"BRY: could not load file '%s' - %s\",f,e))
end
end
```

## Examples

### Interactive mode
Expand Down Expand Up @@ -84,13 +125,26 @@ Example:
12:56:05.706 RSL: stat/tasmota_B90B50/RESULT = {"Br":"3"}
```

#### `load(filename:string) -> int`

Loads a Berry script from the filesystem, and returns an error code; `0` means no error. Filename does not need to start with `/`, but needs to end with `.be` (Berry source code) or `.bec` (precompiled bytecode).

When loading a source file, the precompiled bytecode is saved to filesystem using the `.bec` extension.


#### `save(filename:string, f:closuer) -> nil`

Internally used function to save bytecode. It's a wrapper to the Berry's internal API `be_savecode()`. There is no check made on the filename.

Note: there is generally no need to use this function, it is used internally by `load()`.

### `module tasmota`


Tasmota specific functions are now in the `tasmota` module.
Tasmota automatically imports all modules; i.e. the following commands are done at startup:

```
```python
import string
import json
import gc
Expand Down Expand Up @@ -170,4 +224,5 @@ br tasmota.timereached(t)

20:36:36.806 CMD: br tasmota.timereached(t)
20:36:36.813 RSL: stat/tasmota_67B1E9/RESULT = {"Br":"true"}
```
```

Loading

0 comments on commit f6a64cb

Please sign in to comment.