Created
December 17, 2025 05:06
-
-
Save Katheesh/1979e85501e95d1f2451a616eafaf7cb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #ifdef WITH_RS485_PEER | |
| #define MY_ADDRESS 0x21 | |
| uint8_t peers[] = {0x21, 0x22}; | |
| uint8_t peerCount = 2; | |
| #endif | |
| uint8_t SWITCHES[] = {4, 5, 6, 7}; | |
| const char* THERMOSTAT_NAME = "std_thermostat"; | |
| void setupSensors(){ | |
| addSensor(1, "std_room_presense", "presence", "{}"); | |
| addSensor(2, "bathroom_presense", "presence", "{}"); | |
| } | |
| void setupModbusDevices(){ | |
| // "roomtemp": 40030, | |
| // "setpoint": 40031, | |
| // "fanmode": 40032, | |
| addModbusDevice(15, 30, 3, 100, true); // true = enable callbacks during startup delay | |
| addModbusDevice(181, 0, 8, 100, false);// false = disable callbacks during startup delay | |
| addModbusDevice(19, 0, 0, 1000, false); | |
| addModbusPointer(15, 30, THERMOSTAT_NAME, "fcu", "roomtemp", "{\"actuator\": 22}"); | |
| addModbusPointer(15, 31, THERMOSTAT_NAME, "fcu", "setpoint", "{\"actuator\": 22}"); | |
| addModbusPointer(15, 32, THERMOSTAT_NAME, "fcu", "fanmode", "{\"l\": 1, \"m\": 2, \"h\": 3}"); | |
| addModbusPointer(181, 0, "master", "scene", "master", "{\"toggle\": [4,5,6,7]}"); | |
| addModbusPointer(181, 1, "dnd", "scene", "dnd", "{}"); // should be change registers in inside function | |
| addModbusPointer(181, 2, "mur", "scene", "mur", "{}"); // should be change registers in inside function | |
| addModbusPointer(181, 3, "bathroom", "switch", "4", "{}"); | |
| addModbusPointer(181, 4, "welcome", "scene", "group", "{\"toggle\": [5,6,7]}"); | |
| addModbusPointer(181, 5, "dinning", "switch", "5", "{}"); | |
| addModbusPointer(181, 6, "ceiling", "switch", "6", "{}"); | |
| //addModbusPointer(181, 7, "cove", "switch", "7", "{}"); | |
| addModbusPointer(181, 7, "bathroomblind", "curtain", "open", "{\"open\": 11, \"close\": 12, \"delay\": 10000}"); | |
| // addModbusPointer(181, 7, "speakerbell", "bell", "mbbell", "{}"); | |
| // You can add up to 10 devices total | |
| // addModbusDevice(4, 0, 10, 1000); | |
| // addModbusDevice(5, 0, 10, 1000); | |
| } | |
| void activate_nor(){ | |
| writeDeviceHoldingRegister(181,11,0); | |
| delay(10); | |
| writeDeviceHoldingRegister(181,12,0); | |
| } | |
| void activate_dnd(){ | |
| writeDeviceHoldingRegister(181,11,1); | |
| delay(10); | |
| writeDeviceHoldingRegister(181,12,0); | |
| } | |
| void activate_mur(){ | |
| writeDeviceHoldingRegister(181,12,1); | |
| delay(10); | |
| writeDeviceHoldingRegister(181,11,0); | |
| } | |
| void ring_bell(){ | |
| writeDeviceHoldingRegister(19,10,1); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment