Skip to content

Instantly share code, notes, and snippets.

@papakpmartin
Created February 11, 2024 23:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save papakpmartin/704020a322b411db633e03ff09fbe906 to your computer and use it in GitHub Desktop.
Save papakpmartin/704020a322b411db633e03ff09fbe906 to your computer and use it in GitHub Desktop.
Welcome to the Berry Scripting console. Check the documentation.

tasmota.read_sensors()
{"Time":"2024-02-11T23:49:43","SHTC3":{"Temperature":12.1,"Humidity":19.8,"DewPoint":-10.3},"VL53L0X":{"Distance":null},"ESP32":{"Temperature":13.4},"TempUnit":"C"}
SHTC3#Temperature
BRY: Exception> 'syntax_error' - input:1: 'SHTC3' undeclared (first use in this function)
"SHTC3#Temperature"
SHTC3#Temperature
tasmota.read_sensors("SHTC3")
{"Time":"2024-02-12T00:17:45","SHTC3":{"Temperature":12.5,"Humidity":20.1,"DewPoint":-9.8},"VL53L0X":{"Distance":null},"ESP32":{"Temperature":13.4},"TempUnit":"C"}
wire1.scan()
[41]
wire2.scan()
[25, 112]
VL53L0X#Distance
BRY: Exception> 'syntax_error' - input:1: 'VL53L0X' undeclared (first use in this function)
def rule_foo(value, trigger)
  print("value of ", trigger, " is ", value)
end

tasmota.add_rule("VL53L0X#Distance",rule_foo)
value of  VL53L0X#Distance  is  18.4
value of  VL53L0X#Distance  is  16.8
value of  VL53L0X#Distance  is  17
value of  VL53L0X#Distance  is  16.8
value of  VL53L0X#Distance  is  16.8
value of  VL53L0X#Distance  is  16.9
value of  VL53L0X#Distance  is  16.8
value of  VL53L0X#Distance  is  17
value of  VL53L0X#Distance  is  16.7
value of  VL53L0X#Distance  is  16.8
value of  VL53L0X#Distance  is  16.7
tasmota.remove_rule("VL53L0X#Distance")
Run code (or press 'Enter' twice)
Consoles
Tasmota 13.3.0(tasmota32) by Theo Arends```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment