-
Notifications
You must be signed in to change notification settings - Fork 0
Home
"Wireless System for energy saving applied to domotics" is a project that includes hardware/software modules. The system has hardware modules (ESP32) which we call berries, these have the ability to control switches and sense variables such as brightness in order to save electricity.
Each berry is controlled from the mobile application, but also the ESP32 works autonomously using its interal RTC.
The project has 3 main modules which will be explained below. The whole project is developed with Zerynth ❤️
This module is in charge of receive/send data using BLE and Wifi. For BLE it uses the Current Time GATT Service 'cause it allow us to do the communication using Strings.
connection = BerryConnection()
def myBluetoothHandler(msg):
# Your code here
connection.onNewBLEMessage(myBluetoothHandler)
connection.onWifiConnected(_yourHandler)
connection.sendMessage("deviceUUID", "Hello world")
...
This module receives a string and outputs a deviceId, instruction and timestamp.
parser = BerryParser()
parser.convert("1|On|Now") # Turn on device 1 right now
parser.convert("2|Off|1555086833") # Turn off device 2 at timestamp 1555086833
print(parser.convert("1|80|1555086833")) # { deviceId : 1, dimmerValue: 80, timestamp: 1555086833 }