HI. I use this sketch to my lisght but in Home Assistant it show me it as SWITCH. Is any chance to change it in mysensors sketch to show in Home Assisnatnt as LIGHT ?
Posts made by pepson
-
How use mysensors to show in Home Assistant as LIGHT
-
RE: 💬 Building an Ethernet Gateway
Hi
I try building gateway on my Arduino Mega and i defined this:
// Controller ip address. Enables client mode (default is "server" mode).
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
#define MY_CONTROLLER_IP_ADDRESS 192, 168, 13, 252This is ip my Controller on RPI4 with installed Hassos(Home Assistant). But when it is defined i can not controll my relay on gateway. When delete this define all works ok and i can controll relay from home assistant. Please help me... I want define it to block controll only from one device in my network(controller automation Home Assistant).
-
RE: 💬 Sensebender Gateway
Hi
Can anybody help me how compile sketch to this gateway to work as Ethernet Gateway...
When i try compile i get the error:
https://pastebin.com/BSQGsCgiand my sketch looks like:
https://pastebin.com/R3vG076i -
RE: 💬 Sensebender Gateway
When try compilation with this W5100 i get error:
Opcje projektu zmienione, przeładuj całość
In file included from C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/MySensors.h:208:0,from C:\Users\Piotrek\Desktop\SensebenderGatewayETHERNET\SensebenderGatewayETHERNET.ino:111:
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:74:1: error: 'EthernetServer' does not name a type
EthernetServer _ethernetServer(_ethernetGatewayPort);
^~~~~~~~~~~~~~
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:89:8: error: 'EthernetClient' does not name a type
static EthernetClient client = EthernetClient();
^~~~~~~~~~~~~~
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp: In function 'bool gatewayTransportInit()':
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:149:7: error: 'Ethernet' was not declared in this scope
if (!Ethernet.begin(_ethernetGatewayMAC)) {
^~~~~~~~
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:149:7: note: suggested alternative: '_ethernetMsg'
if (!Ethernet.begin(_ethernetGatewayMAC)) {
^~~~~~~~ _ethernetMsg
In file included from C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/MySensors.h:49:0,
from C:\Users\Piotrek\Desktop\SensebenderGatewayETHERNET\SensebenderGatewayETHERNET.ino:111:
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:156:16: error: 'Ethernet' was not declared in this scope
Ethernet.localIP()[0], ^
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/MyConfig.h:1815:48: note: in definition of macro 'DEBUG_OUTPUT'
#define DEBUG_OUTPUT(x,...) hwDebugPrint(x, ##VA_ARGS) //!< debug
^~~~~~~~~~~
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:155:2: note: in expansion of macro 'GATEWAY_DEBUG'
GATEWAY_DEBUG(PSTR("GWT:TIN:IP=%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 "\n"),
^~~~~~~~~~~~~
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:156:16: note: suggested alternative: '_ethernetMsg'
Ethernet.localIP()[0], ^
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/MyConfig.h:1815:48: note: in definition of macro 'DEBUG_OUTPUT'
#define DEBUG_OUTPUT(x,...) hwDebugPrint(x, ##VA_ARGS) //!< debug
^~~~~~~~~~~
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:155:2: note: in expansion of macro 'GATEWAY_DEBUG'
GATEWAY_DEBUG(PSTR("GWT:TIN:IP=%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 "\n"),
^~~~~~~~~~~~~
In file included from C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/MySensors.h:208:0,
from C:\Users\Piotrek\Desktop\SensebenderGatewayETHERNET\SensebenderGatewayETHERNET.ino:111:
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:189:2: error: '_ethernetServer' was not declared in this scope
_ethernetServer.begin();
^~~~~~~~~~~~~~~
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:189:2: note: suggested alternative: '_ethernetMsg'
_ethernetServer.begin();
^~~~~~~~~~~~~~~
_ethernetMsg
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp: In function 'bool gatewayTransportSend(MyMessage&)':
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:246:11: error: '_ethernetServer' was not declared in this scope
nbytes = _ethernetServer.write(_ethernetMsg);
^~~~~~~~~~~~~~~
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:246:11: note: suggested alternative: '_ethernetMsg'
nbytes = _ethernetServer.write(_ethernetMsg);
^~~~~~~~~~~~~~~ _ethernetMsg
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp: In function 'bool _readFromClient()':
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:289:9: error: 'client' was not declared in this scope
while (client.connected() && client.available()) {
^~~~~~
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:289:9: note: suggested alternative: 'Print'
while (client.connected() && client.available()) {
^~~~~~ Print
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp: In function 'bool gatewayTransportAvailable()':
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:409:2: error: 'EthernetClient' was not declared in this scope
EthernetClient newclient = _ethernetServer.available();
^~~~~~~~~~~~~~
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:411:6: error: 'newclient' was not declared in this scope
if (newclient) {
^~~~~~~~~
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:412:7: error: 'client' was not declared in this scope
if (client != newclient) {
^~~~~~
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:412:7: note: suggested alternative: 'Print'
if (client != newclient) {
^~~~~~ Print
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:422:6: error: 'client' was not declared in this scope
if (client) {
^~~~~~
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:422:6: note: suggested alternative: 'Print'
if (client) {
^~~~~~ Print
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp: In function 'void gatewayTransportRenewIP()':
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:463:6: error: 'Ethernet' was not declared in this scope
if (Ethernet.maintain() & ~(0x06)) {
^~~~~~~~
C:\Users\Piotrek\Documents\Arduino\libraries\MySensors/core/MyGatewayTransportEthernet.cpp:463:6: note: suggested alternative: '_ethernetMsg'
if (Ethernet.maintain() & ~(0x06)) {
^~~~~~~~ _ethernetMsg
exit status 1
Błąd kompilacji dla płytki Sensebender Gateway.What is a problem ?
-
RE: 💬 Sensebender Gateway
And please help me how i can compile it as gateway Ethernet with module W5100.
Only add to sketch:
// Enable gateway ethernet module type
#define MY_GATEWAY_W5100// Enable to UDP
//#define MY_USE_UDP//#define MY_IP_ADDRESS 192,168,3,160 // wpisz adres ip bramki
// Renewal period if using DHCP
//#define MY_IP_RENEWAL_INTERVAL 60000
// The port to keep open on node server mode / or port to contact in client mode
#define MY_PORT 5003 //wpisz numer portu bramki// Controller ip address. Enables client mode (default is "server" mode).
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
//#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254// The MAC address can be anything you want but should be unique on your network.
// Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
// Note that most of the Ardunio examples use "DEAD BEEF FEED" for the MAC address.
#define MY_MAC_ADDRESS 0xDC, 0xAE, 0xB2, 0x3F, 0xFF, 0xDC???
-
RE: 💬 Sensebender Gateway
Hi
I compiled and write to gateway this programmm. Then i connected it to my RPI with Hassio (Home Assistant). In logs on home assistant still show me info: Gateway /dev/serial/by-id/usb-MySensors.org_Sensebender_GW_6A153443514D355934202020FF10182D-if00 not ready after 15.0 secs so continuing with setupbut after run Home Assistant gateway works ok. I send info mto developer Home Assistant ans she not see any bugs....
How i can resolved this problem ? -
RE: 💬 Door, Window and Push-button Sensor
@skywatch
Yes but i dont know how do it....
I dont know programing. -
RE: 💬 Door, Window and Push-button Sensor
I need connect two contact sensor. And i want to know from two sensor his status...
I need use one to door but second to door garage. -
RE: 💬 Door, Window and Push-button Sensor
Hi
Can i connect two sensor contact to this arduino ? First to pin 3 second to pin 4 ? But how modified this sketch to support two sensor contact ? -
RE: MySensors shield and RGBW Controller
But I need code in sketch to upload by Arduino IDE...
-
RE: MySensors shield and RGBW Controller
Hi
Is anybody who can help me how add phisical button to enable from the wall leds only in color white ?
Button will be connect to pin in arduino but how implement it to code sketch ? I want to on/off white color without gateway... example gateway not working.... -
RE: [SOLVED] Sensbender Gateway gives a lot of "hu"
@magpern
But mysensors newer than 2.2.0 has problems with radio Rfm69hw. -
RE: [SOLVED] Sensbender Gateway gives a lot of "hu"
@tekka said in [SOLVED] Sensbender Gateway gives a lot of "hu":
This originates from the updated Arduino SAMD board definitions (>1.8.1) and is fixed in the dev branch. You can add
Hi
I have a problem. I buy Sensbender Gateway and compile it with radio RFM69HW and write.... This is my sketch:/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2019 Sensnology AB * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * DESCRIPTION * The ArduinoGateway prints data received from sensors on the serial link. * The gateway accepts input on serial which will be sent out on radio network. * * This GW code is designed for Sensebender GateWay / (Arduino Zero variant) * * Wire connections (OPTIONAL): * - Inclusion button should be connected to SW2 * * LEDs on board (default assignments): * - Orange: USB RX/TX - Blink when receiving / transmitting on USB CDC device * - Yellow: RX - Blink fast on radio message received. In inclusion mode will blink fast only on presentation received * - Green : TX - Blink fast on radio message transmitted. In inclusion mode will blink slowly * - Red : ERR - Fast blink on error during transmission error or receive crc error * - Blue : free - (use with LED_BLUE macro) * */ #define SKETCH_VERSION "0.2" // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached //#define MY_RADIO_RF24 //#define MY_RADIO_NRF5_ESB //#define MY_RADIO_RFM69 //#define MY_RADIO_RFM95 #define MY_RADIO_RFM69 #define MY_IS_RFM69HW #define RFM69_868MH #define MY_RFM69_NEW_DRIVER // Set LOW transmit power level as default, if you have an amplified NRF-module and // power your radio separately with a good regulator you can turn up PA level. //#define MY_RF24_PA_LEVEL RF24_PA_HIGH // Enable serial gateway #define MY_GATEWAY_SERIAL // Define a lower baud rate for Arduinos running on 8 MHz (Arduino Pro Mini 3.3V & Sensebender) #if F_CPU == 8000000L #define MY_BAUD_RATE 38400 #endif // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway #define MY_INCLUSION_BUTTON_FEATURE // Inverses behavior of inclusion button (if using external pullup) //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP // Set inclusion mode duration (in seconds) #define MY_INCLUSION_MODE_DURATION 60 // Digital pin used for inclusion mode button //#define MY_INCLUSION_MODE_BUTTON_PIN 3 // Set blinking period #define MY_DEFAULT_LED_BLINK_PERIOD 300 // Inverses the behavior of leds //#define MY_WITH_LEDS_BLINKING_INVERSE // Flash leds on rx/tx/err // Uncomment to override default HW configurations //#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 5 // the PCB, on board LED #include <MySensors.h> #include <SD.h> #include <drivers/ATSHA204/ATSHA204.cpp> Sd2Card card; #define EEPROM_VERIFICATION_ADDRESS 0x01 static uint8_t num_of_leds = 5; static uint8_t leds[] = {LED_BLUE, LED_RED, LED_GREEN, LED_YELLOW, LED_ORANGE}; void setup() { // Setup locally attached sensors } void presentation() { // Present locally attached sensors } void loop() { // Send locally attached sensor data here } void preHwInit() { pinMode(MY_SWC1, INPUT_PULLUP); pinMode(MY_SWC2, INPUT_PULLUP); if (digitalRead(MY_SWC1) && digitalRead(MY_SWC2)) { return; } uint8_t tests = 0; for (int i=0; i< num_of_leds; i++) { pinMode(leds[i], OUTPUT); } if (digitalRead(MY_SWC1)) { uint8_t led_state = 0; while (!Serial) { digitalWrite(LED_BLUE, led_state); led_state ^= 0x01; delay(500); } // Wait for USB to be connected, before spewing out data. } if (Serial) { Serial.println("Sensebender GateWay test routine"); Serial.print("MySensors core version : "); Serial.println(MYSENSORS_LIBRARY_VERSION); Serial.print("GateWay sketch version : "); Serial.println(SKETCH_VERSION); Serial.println("----------------------------------"); Serial.println(); } if (testSha204()) { digitalWrite(LED_GREEN, HIGH); tests++; } if (testSDCard()) { digitalWrite(LED_YELLOW, HIGH); tests++; } if (testEEProm()) { digitalWrite(LED_ORANGE, HIGH); tests++; } if (tests == 4) { while(1) { for (int i=0; i<num_of_leds; i++) { digitalWrite(leds[i], HIGH); delay(200); digitalWrite(leds[i], LOW); } } } else { while (1) { digitalWrite(LED_RED, HIGH); delay(200); digitalWrite(LED_RED, LOW); delay(200); } } } bool testSha204() { uint8_t rx_buffer[SHA204_RSP_SIZE_MAX]; uint8_t ret_code; if (Serial) { Serial.print("- > SHA204 "); } atsha204_init(MY_SIGNING_ATSHA204_PIN); ret_code = atsha204_wakeup(rx_buffer); if (ret_code == SHA204_SUCCESS) { ret_code = atsha204_getSerialNumber(rx_buffer); if (ret_code != SHA204_SUCCESS) { if (Serial) { Serial.println(F("Failed to obtain device serial number. Response: ")); } Serial.println(ret_code, HEX); } else { if (Serial) { Serial.print(F("Ok (serial : ")); for (int i=0; i<9; i++) { if (rx_buffer[i] < 0x10) { Serial.print('0'); // Because Serial.print does not 0-pad HEX } Serial.print(rx_buffer[i], HEX); } Serial.println(")"); } return true; } } else { if (Serial) { Serial.println(F("Failed to wakeup SHA204")); } } return false; } bool testSDCard() { if (Serial) { Serial.print("- > SD CARD "); } if (!card.init(SPI_HALF_SPEED, MY_SDCARD_CS)) { if (Serial) { Serial.println("SD CARD did not initialize!"); } } else { if (Serial) { Serial.print("SD Card initialized correct! - "); Serial.print("type detected : "); switch(card.type()) { case SD_CARD_TYPE_SD1: Serial.println("SD1"); break; case SD_CARD_TYPE_SD2: Serial.println("SD2"); break; case SD_CARD_TYPE_SDHC: Serial.println("SDHC"); break; default: Serial.println("Unknown"); } } return true; } return false; } bool testEEProm() { uint8_t eeprom_d1, eeprom_d2; SerialUSB.print(" -> EEPROM "); eeprom_d1 = hwReadConfig(EEPROM_VERIFICATION_ADDRESS); delay(500); eeprom_d1 = ~eeprom_d1; // invert the bits hwWriteConfig(EEPROM_VERIFICATION_ADDRESS, eeprom_d1); delay(500); eeprom_d2 = hwReadConfig(EEPROM_VERIFICATION_ADDRESS); if (eeprom_d1 == eeprom_d2) { SerialUSB.println("PASSED"); hwWriteConfig(EEPROM_VERIFICATION_ADDRESS, ~eeprom_d1); return true; } SerialUSB.println("FAILED!"); return false; } bool testAnalog() { int bat_detect = analogRead(MY_BAT_DETECT); Serial.print("-> analog : "); Serial.print(bat_detect); if (bat_detect < 400 || bat_detect > 650) { Serial.println(" Failed"); return false; } Serial.println(" Passed"); return true; }```
On serial port monitor show me this:
0;255;hu;0;hu;3 MCO:BGN:INIT GW,CP=RPNGS---,VER=2.2.0 0;255;hu;0;hu;3 TSF:LRT:OK 0;255;hu;0;hu;3 TSM:INIT 0;255;hu;0;hu;3 TSF:WUR:MS=0 0;255;hu;0;hu;3 TSM:INIT:TSP OK 0;255;hu;0;hu;3 TSM:INIT:GW MODE 0;255;hu;0;hu;3 TSM:READY:ID=hu,PAR=hu,DIS=hu 0;255;hu;0;hu;3 MCO:REG:NOT NEEDED hu;hu;hu;hu;hu;⸮ hu;hu;hu;hu;hu;⸮ 0;255;hu;0;hu;3 MCO:BGN:STP 0;255;hu;0;hu;3 MCO:BGN:INIT OK,TSP=hu
I connect it to my raspberry pi 4 with Hass.io image 3.3. Then in configuration add it:
mysensors: gateways: - device: '/dev/ttyACM0' persistence_file: '/config/mysensors.json' baud_rate: 38400 optimistic: false persistence: true version: '2.2'
and still in log has info:
Gateway /dev/ttyACM0 not ready after 15.0 secs so continuing with setup 20:56 components/mysensors/gateway.py (WARNING)
In hardware on hassio show this:
/dev/ttyACM0
/dev/serial/by-id/usb-MySensors.org_Sensebender_GW_6A153443514D355934202020FF10182D-if00
/dev/ttyAMA0Please help me what i do wrong...and how resolved this problem.
-
RE: 💬 Sensebender Gateway
I also can not install board in Arduino IDE 1.8.9
-
RE: 💬 Sensebender Gateway
hi
when i try compile sketch only with change radio to rfm69hw i have this:
Arduino:1.8.9 (Windows 10), Płytka:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"SensebenderGatewaySerial:95:26: error: 'LED_BLUE' was not declared in this scope
static uint8_t leds[] = {LED_BLUE, LED_RED, LED_GREEN, LED_YELLOW, LED_ORANGE};
^
SensebenderGatewaySerial:95:36: error: 'LED_RED' was not declared in this scope
static uint8_t leds[] = {LED_BLUE, LED_RED, LED_GREEN, LED_YELLOW, LED_ORANGE};
^
SensebenderGatewaySerial:95:45: error: 'LED_GREEN' was not declared in this scope
static uint8_t leds[] = {LED_BLUE, LED_RED, LED_GREEN, LED_YELLOW, LED_ORANGE};
^
SensebenderGatewaySerial:95:56: error: 'LED_YELLOW' was not declared in this scope
static uint8_t leds[] = {LED_BLUE, LED_RED, LED_GREEN, LED_YELLOW, LED_ORANGE};
^
SensebenderGatewaySerial:95:68: error: 'LED_ORANGE' was not declared in this scope
static uint8_t leds[] = {LED_BLUE, LED_RED, LED_GREEN, LED_YELLOW, LED_ORANGE};
^
C:\Users\Piotrek\Desktop\SensebenderGatewaySerial-sketch\SensebenderGatewaySerial\SensebenderGatewaySerial.ino: In function 'void preHwInit()':
SensebenderGatewaySerial:116:10: error: 'MY_SWC1' was not declared in this scope
pinMode(MY_SWC1, INPUT_PULLUP);
^
SensebenderGatewaySerial:117:10: error: 'MY_SWC2' was not declared in this scope
pinMode(MY_SWC2, INPUT_PULLUP);
^
SensebenderGatewaySerial:130:17: error: 'LED_BLUE' was not declared in this scope
digitalWrite(LED_BLUE, led_state); ^
SensebenderGatewaySerial:145:16: error: 'LED_GREEN' was not declared in this scope
digitalWrite(LED_GREEN, HIGH);
^
SensebenderGatewaySerial:149:16: error: 'LED_YELLOW' was not declared in this scope
digitalWrite(LED_YELLOW, HIGH);
^
SensebenderGatewaySerial:154:16: error: 'LED_ORANGE' was not declared in this scope
digitalWrite(LED_ORANGE, HIGH);
^
SensebenderGatewaySerial:167:17: error: 'LED_RED' was not declared in this scope
digitalWrite(LED_RED, HIGH); ^
C:\Users\Piotrek\Desktop\SensebenderGatewaySerial-sketch\SensebenderGatewaySerial\SensebenderGatewaySerial.ino: In function 'bool testSDCard()':
SensebenderGatewaySerial:219:33: error: 'MY_SDCARD_CS' was not declared in this scope
if (!card.init(SPI_HALF_SPEED, MY_SDCARD_CS)) {
^
C:\Users\Piotrek\Desktop\SensebenderGatewaySerial-sketch\SensebenderGatewaySerial\SensebenderGatewaySerial.ino: In function 'bool testEEProm()':
SensebenderGatewaySerial:249:2: error: 'SerialUSB' was not declared in this scope
SerialUSB.print(" -> EEPROM ");
^
C:\Users\Piotrek\Desktop\SensebenderGatewaySerial-sketch\SensebenderGatewaySerial\SensebenderGatewaySerial.ino: In function 'bool testAnalog()':
SensebenderGatewaySerial:267:30: error: 'MY_BAT_DETECT' was not declared in this scope
int bat_detect = analogRead(MY_BAT_DETECT);
^
exit status 1
'LED_BLUE' was not declared in this scopeWhat is error ? please help me
-
RE: 💬 OH MySensors RGBW Controller
With how long max tape you test it ? I have a living room and i need control RGBW with about 16 meters.... I can use your controller ?
-
RE: 💬 OH MySensors RGBW Controller
Hi
Can you share me file for board for this to print on 3D. -
RE: About DS18B20 onewire.
But.... Can you also help me to add to this sketch option to send to example to Home Assistant also DESCRIPTION to each sensors ? And description will be get from sketch from name about address sensor ?
As in this sketch which i have for relay:
#define USE_EXPANDER // Enable debug prints to serial monitor //#define MY_DEBUG #define MY_GATEWAY_SERIAL #include <MySensors.h> #include <Bounce2.h> #ifdef USE_EXPANDER #include <Wire.h> // Required for I2C communication #include "PCF8574.h" uint8_t expanderAddresses[] = {0x20}; const int numberOfExpanders = sizeof(expanderAddresses); PCF8574 expander[numberOfExpanders]; #define E(expanderNo, ExpanderPin) (((expanderNo+1)<<8) | (ExpanderPin)) #endif // No Button Constant #define NOB -1 #define MULTI_RELAY_VERSION 9 #define RELAY_STATE_STORAGE 1 const uint8_t RELAY_TRIGGER_LOW = 0; const uint8_t RELAY_TRIGGER_HIGH = 1; const uint8_t RELAY_STARTUP_ON = 2; const uint8_t RELAY_STARTUP_OFF = 4; const uint8_t RELAY_STARTUP_MASK = RELAY_STARTUP_ON | RELAY_STARTUP_OFF; enum ButtonType { MONO_STABLE = 0, BI_STABLE = 1, DING_DONG = 2 // HIGH state immediatly after push, LOW state after release }; typedef struct { int sensorId; int relay; int button; uint8_t relayOptions; ButtonType buttonType; const char * relayDescription; } RelayButton; // CONFIGURE ONLY THIS ARRAY! // Row params: sensor ID - sensor ID reported on MySensor Gateway // relay pin - Expander supported // button pin - <0 for virtual buttons (only available in MySensor Gateway); no support for Expander // relay options - [RELAY_TRIGGER_LOW|RELAY_TRIGGER_HIGH] {RELAY_STARTUP_ON|RELAY_STARTUP_OFF} // button type - [MONO_STABLE|BI_STABLE|DING_DONG] // relay description - reported on MySensor Gateway, can help identify device on initial configuration in Home Automation App, can be empty ("") RelayButton myRelayButtons[] = { {0, 2, A0, RELAY_TRIGGER_LOW, MONO_STABLE, "Ł2 - kinkiet [C10]"}, // WŁ: Ł2 {1, 16, A1, RELAY_TRIGGER_LOW, BI_STABLE, "Salon 2 [A9]"}, // WŁ: Salon 2 {2, 15, A2, RELAY_TRIGGER_LOW, BI_STABLE, "Salon 1 [A10]"}, // WŁ: Salon 1 {3, E(0,1), A3, RELAY_TRIGGER_LOW | RELAY_STARTUP_OFF, BI_STABLE, "Halogen - Taras [B8]"}, // WŁ: Taras {4, 22, A4, RELAY_TRIGGER_LOW, BI_STABLE, "Kuchnia [B2]"}, // WŁ: Kuchnia 1 {5, 23, A5, RELAY_TRIGGER_LOW, BI_STABLE, "Kuchnia - Kinkiet [B3]"}, // WŁ: Kuchnia 2 {6, 28, A6, RELAY_TRIGGER_LOW, BI_STABLE, "Jadalnia 2 [A4]"}, // WŁ: Hall I/Jadalnia prawy {17, 17, A7, RELAY_TRIGGER_LOW, BI_STABLE, "Ł1 - Kinkiet [A11]"}, // WŁ: Hall I/Ł1 prawy {8, 31, A8, RELAY_TRIGGER_LOW, MONO_STABLE, "Garaż [A7]"}, // WŁ: Kotłownia/Garaż {8, 31, A9, RELAY_TRIGGER_LOW, MONO_STABLE, "Garaż [A7]"}, // WŁ: Garaż {10, 14, A10, RELAY_TRIGGER_LOW | RELAY_STARTUP_ON, BI_STABLE, "Halogen - wejście [B4]"}, // WŁ: Drzwi wejściowe {11, E(0,7), A11, RELAY_TRIGGER_LOW, DING_DONG, "Dzwonek [?]"}, // WŁ: Dzwonek {12, 29, A12, RELAY_TRIGGER_LOW, BI_STABLE, "Hall 1 [A5]"}, // WŁ: Hall I/Jadalnia lewy {12, 29, A13, RELAY_TRIGGER_LOW, BI_STABLE, "Hall 1 [A5]"}, // WŁ: Hall I/Wiatrołap {14, 32, A14, RELAY_TRIGGER_LOW, BI_STABLE, "Wiatrołap [A8]"}, // WŁ: Wiatrołap/Hall I {15, 19, A15, RELAY_TRIGGER_LOW, MONO_STABLE, "Kotłownia [B1]"}, // WŁ: Kotłownia/Hall I {16, 24, 53, RELAY_TRIGGER_LOW, BI_STABLE, "Ł1 - Taśma LED [C1]"}, // WŁ: Hall I/Ł1 środek {17, 17, 52, RELAY_TRIGGER_LOW, MONO_STABLE, "Ł1 - Kinkiet [A11]"}, // WŁ: Ł1 {18, 18, 51, RELAY_TRIGGER_LOW, BI_STABLE, "Ł1 [A12]"}, // WŁ: Hall I/Ł1 lewy {19, 6, 50, RELAY_TRIGGER_LOW, BI_STABLE, "Klatka Schodowa [B7]"}, // WŁ: Hall I/Schody 1 {12, 29, 49, RELAY_TRIGGER_LOW, BI_STABLE, "Hall 1 [A5]"}, // WŁ: Hall I/Schody 2 {21, 26, 48, RELAY_TRIGGER_LOW, BI_STABLE, "Gabinet [A2]"}, // WŁ: Gabinet {22, 7, 47, RELAY_TRIGGER_LOW, BI_STABLE, "Hall 2 [B5]"}, // WŁ: Hall II/Schody 1 {19, 6, 46, RELAY_TRIGGER_LOW, BI_STABLE, "Klatka Schodowa [B7]"}, // WŁ: Hall II/Schody 2 {24, 10, 45, RELAY_TRIGGER_LOW, BI_STABLE, "Garderoba [C12]"}, // WŁ: Garderoba {25, 4, 44, RELAY_TRIGGER_LOW, MONO_STABLE, "Pok. nad kuchnią 2 [B10]"}, // WŁ: Pok. nad kuchnią 2 {26, 5, 43, RELAY_TRIGGER_LOW, BI_STABLE, "Pok. nad kuchnią 1 [B9]"}, // WŁ: Pok. nad kuchnią 1 {27, 8, 42, RELAY_TRIGGER_LOW, BI_STABLE, "Pok. nad salonem 2 [B12]"}, // WŁ: Pok. nad salonem 2 {28, 9, 41, RELAY_TRIGGER_LOW, MONO_STABLE, "Pok. nad salonem 1 [B11]"}, // WŁ: Pok. nad salonem 1 {29, 3, 40, RELAY_TRIGGER_LOW, BI_STABLE, "Ł2 [C7]"}, // WŁ: Hall II/Ł2 1 {30, E(0,3), 39, RELAY_TRIGGER_LOW, BI_STABLE, "Ł2 - Taśma LED [?]"}, // WŁ: Hall II/Ł2 2 {22, 7, 38, RELAY_TRIGGER_LOW, BI_STABLE, "Hall 2 [B5]"}, // WŁ: Hall II/Sypialnia {32, 11, 37, RELAY_TRIGGER_LOW, BI_STABLE, "Sypialnia 2 [C9]"}, // WŁ: Sypialnia 2 {33, 12, 36, RELAY_TRIGGER_LOW, BI_STABLE, "Sypialnia 1 [C8]"}, // WŁ: Sypialnia 1 {34, 25, -1, RELAY_TRIGGER_LOW | RELAY_STARTUP_ON, MONO_STABLE, "Halogen - Garaż [A1]"}, // WŁ: Virtual Button 1 {35, 30, -2, RELAY_TRIGGER_LOW | RELAY_STARTUP_OFF, MONO_STABLE, "Ł1 - Wentylator [A3]"}, // WŁ: Virtual Button 2 {36, E(0,2), -3, RELAY_TRIGGER_LOW | RELAY_STARTUP_OFF, MONO_STABLE, "Halogen - wschód [B6]"}, // WŁ: Virtual Button 3 {37, E(0,4), -4, RELAY_TRIGGER_LOW, MONO_STABLE, "Lampki schodowe [C6]"}, // WŁ: Virtual Button 4 {38, E(0,5), -5, RELAY_TRIGGER_LOW, MONO_STABLE, "Lampki podłogowe I [C4]"}, // WŁ: Virtual Button 5 {39, E(0,6), -6, RELAY_TRIGGER_LOW, MONO_STABLE, "Lampki podłogowe II [C2]"}, // WŁ: Virtual Button 6 {40, E(0,0), -7, RELAY_TRIGGER_LOW | RELAY_STARTUP_OFF, MONO_STABLE, "Ł2 - wentylator [C11]"}, // WŁ: Virtual Button 7 }; const int numberOfRelayButtons = sizeof(myRelayButtons) / sizeof(RelayButton); typedef struct { int firstButton; int nextButton; } RelayMultiButtons; RelayMultiButtons relayMultiButtons[numberOfRelayButtons]; uint8_t myRelayState[numberOfRelayButtons]; // MySensors - Sending Data // To send data you have to create a MyMessage container to hold the information. MyMessage msgs[numberOfRelayButtons]; Bounce myButtonDebouncer[numberOfRelayButtons]; //Function Declaration uint8_t loadRelayState(int relayNum, uint8_t forceEeprom = 0); void saveRelayState(int relayNum, uint8_t state, uint8_t useEeprom); void saveRelayState(int relayNum, uint8_t state); void changeRelayState(int relayNum, uint8_t relayState); // MySensors - This will execute before MySensors starts up void before() { Serial.begin(115200); #ifdef USE_EXPANDER /* Start I2C bus and PCF8574 instance */ for(int i = 0; i < numberOfExpanders; i++) { expander[i].begin(expanderAddresses[i]); } #endif // initialize multiple buttons list structure for (int i = 0; i < numberOfRelayButtons; i++) { relayMultiButtons[i].firstButton = -1; relayMultiButtons[i].nextButton = -1; } // find multiple buttons for the same relay (uni-directional list) for (int i = 0; i < numberOfRelayButtons-1; i++) { if (relayMultiButtons[i].firstButton == -1) { int prevRelayButton = i; for (int j = i+1; j < numberOfRelayButtons; j++) { if (myRelayButtons[i].relay == myRelayButtons[j].relay) { relayMultiButtons[prevRelayButton].firstButton = i; relayMultiButtons[prevRelayButton].nextButton = j; relayMultiButtons[j].firstButton = i; prevRelayButton = j; } } } } // if version has changed, reset state of all relays int versionChangeResetState = (MULTI_RELAY_VERSION == loadState(0) ) ? 0 : 1; for (int i = 0; i < numberOfRelayButtons; i++) { // if this relay has multiple buttons, load only first if (relayMultiButtons[i].firstButton == -1 || relayMultiButtons[i].firstButton == i) { // Then set relay pins in output mode #ifdef USE_EXPANDER if ( myRelayButtons[i].relay & 0xff00 ) { // EXPANDER int expanderNo = (myRelayButtons[i].relay >> 8) - 1; int expanderPin = myRelayButtons[i].relay & 0xff; expander[expanderNo].pinMode(expanderPin, OUTPUT); } else { #endif pinMode(myRelayButtons[i].relay, OUTPUT); #ifdef USE_EXPANDER } #endif uint8_t isTurnedOn = 0; if (myRelayButtons[i].relayOptions & RELAY_STARTUP_ON) { isTurnedOn = 1; } else if (myRelayButtons[i].relayOptions & RELAY_STARTUP_OFF) { } else { // Set relay to last known state (using eeprom storage) isTurnedOn = loadRelayState(i, 1); // 1 - true, 0 - false if (versionChangeResetState && isTurnedOn) { saveRelayState(i, 0, 1); isTurnedOn = 0; } } changeRelayState(i, isTurnedOn); myRelayState[i] = isTurnedOn; } } if (versionChangeResetState) { // version has changed, so store new version in eeporom saveState(0, MULTI_RELAY_VERSION); } } // executed AFTER mysensors has been initialised void setup() { for(int i = 0; i < numberOfRelayButtons; i++) { if (myRelayButtons[i].button >= 0) { // No Expander support for buttons (de-bouncing) pinMode(myRelayButtons[i].button, INPUT_PULLUP); // HIGH state when button is not pushed } } // Setup locally attached sensors delay(5000); // Send state to MySensor Gateway for(int i = 0; i < numberOfRelayButtons; i++) { // if this relay has multiple buttons, send only first if (relayMultiButtons[i].firstButton == -1 || relayMultiButtons[i].firstButton == i) { msgs[i] = MyMessage(myRelayButtons[i].sensorId, V_LIGHT); uint8_t relayState; if (myRelayButtons[i].relayOptions & RELAY_STARTUP_ON) { relayState = 1; } else if (myRelayButtons[i].relayOptions & RELAY_STARTUP_OFF) { relayState = 0; } else { relayState = loadRelayState(i); } send(msgs[i].set(relayState)); // send current state } } // Setup buttons for(int i = 0; i < numberOfRelayButtons; i++) { if (myRelayButtons[i].button >= 0) { // setup debouncer myButtonDebouncer[i] = Bounce(); myButtonDebouncer[i].attach(myRelayButtons[i].button); myButtonDebouncer[i].interval(50); } } } void loop() { for(int i = 0; i < numberOfRelayButtons; i++) { if (myRelayButtons[i].button >= 0 && myButtonDebouncer[i].update()) { int buttonState = myButtonDebouncer[i].read(); #ifdef MY_DEBUG Serial.print("# Button "); Serial.print(i); Serial.print(" changed to: "); Serial.println(buttonState); #endif int relayNum = (relayMultiButtons[i].firstButton == -1) ? i : relayMultiButtons[i].firstButton; if (myRelayButtons[i].buttonType == DING_DONG) { if (buttonState == LOW) { // button pressed changeRelayState(relayNum, 1); send(msgs[relayNum].set(1)); } else { // button released changeRelayState(relayNum, 0); send(msgs[relayNum].set(0)); } } else if (myRelayButtons[i].buttonType == BI_STABLE || buttonState == HIGH) { // If button type is BI_STABLE, any change will toggle relay state // For MONO_STABLE, button must be pushed and released (HIGH) uint8_t isTurnedOn = ! loadRelayState(relayNum); // 1 - true, 0 - false changeRelayState(relayNum, isTurnedOn); send(msgs[relayNum].set(isTurnedOn)); saveRelayState(relayNum, isTurnedOn); } } } } // MySensors - Presentation // Your sensor must first present itself to the controller. // The presentation is a hint to allow controller prepare for the sensor data that eventually will come. // Executed after "before()" and before "setup()" in: _begin (MySensorsCore.cpp) > gatewayTransportInit() > presentNode() void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Multi Relay", "1.2"); // Register every relay as separate sensor for (int i = 0; i < numberOfRelayButtons; i++) { // if this relay has multiple buttons, register only first if (relayMultiButtons[i].firstButton == -1 || relayMultiButtons[i].firstButton == i) { // Register all sensors to gw (they will be created as child devices) // void present(uint8_t childSensorId, uint8_t sensorType, const char *description, bool ack); // childSensorId - The unique child id you want to choose for the sensor connected to this Arduino. Range 0-254. // sensorType - The sensor type you want to create. // description An optional textual description of the attached sensor. // ack - Set this to true if you want destination node to send ack back to this node. Default is not to request any ack. present(myRelayButtons[i].sensorId, S_BINARY, myRelayButtons[i].relayDescription); } } } // MySensors - Handling incoming messages // Nodes that expects incoming data, such as an actuator or repeating nodes, // must implement the receive() - function to handle the incoming messages. // Do not sleep a node where you expect incoming data or you will lose messages. void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type == V_STATUS) { uint8_t isTurnedOn = message.getBool(); // 1 - true, 0 - false changeRelayState(message.sensor, isTurnedOn); // Store state in eeprom if changed if (loadRelayState(message.sensor) != isTurnedOn) { saveRelayState(message.sensor, isTurnedOn); } send(msgs[message.sensor].set(isTurnedOn)); // support for OPTIMISTIC=FALSE (Home Asistant) #ifdef MY_DEBUG // Write some debug info Serial.print("# Incoming change for sensor: " + message.sensor); Serial.println(", New status: " + isTurnedOn); #endif } } uint8_t loadRelayState(int relayNum, uint8_t forceEeprom) { uint8_t relayState; if (forceEeprom) { relayState = loadState(RELAY_STATE_STORAGE + relayNum); } else { relayState = myRelayState[relayNum]; } #ifdef MY_DEBUG Serial.print("# loadRelayState: "); Serial.print(relayNum); if (forceEeprom) { Serial.print("(byte "); Serial.print(RELAY_STATE_STORAGE + relayNum); Serial.print(")"); } Serial.print(" = "); Serial.println(relayState); #endif return(relayState); } void saveRelayState(int relayNum, uint8_t state, uint8_t useEeprom) { int mainRelayNum = (relayMultiButtons[relayNum].firstButton == -1) ? relayNum : relayMultiButtons[relayNum].firstButton; myRelayState[mainRelayNum] = state; if (useEeprom && (relayNum == mainRelayNum)) { saveState(RELAY_STATE_STORAGE + mainRelayNum, state); } int nextButton = mainRelayNum; // update all buttons while ((nextButton = relayMultiButtons[nextButton].nextButton) != -1) { myRelayState[nextButton] = state; }; } void saveRelayState(int relayNum, uint8_t state) { uint8_t useEeprom = ((myRelayButtons[relayNum].relayOptions & RELAY_STARTUP_MASK) == 0); saveRelayState(relayNum, state, useEeprom); } void changeRelayState(int relayNum, uint8_t relayState) { uint8_t relayTrigger = myRelayButtons[relayNum].relayOptions & RELAY_TRIGGER_HIGH; uint8_t digitalOutState = relayState ? relayTrigger : ! relayTrigger; #ifdef USE_EXPANDER if ( myRelayButtons[relayNum].relay & 0xff00 ) { int expanderNo = (myRelayButtons[relayNum].relay >> 8) - 1; int expanderPin = myRelayButtons[relayNum].relay & 0xff; expander[expanderNo].digitalWrite(expanderPin, digitalOutState); } else { #endif digitalWrite(myRelayButtons[relayNum].relay, digitalOutState); #ifdef USE_EXPANDER } #endif }
And in Home assistant show example decription: Ł2 - kinkiet [C10] or for second Salon 2 [A9] etc.
Please help me... because it will be good to identify sensors when add to Controller. -
RE: About DS18B20 onewire.
@mfalkvidd
Where ? please show me more.... i am beginner -
RE: About DS18B20 onewire.
@mfalkvidd
Still is problem after use CTRL+T/** The MySensors Arduino library handles the wireless radio link and protocol between your home built sensors/actuators and HA controller of choice. The sensors forms a self healing radio network with optional repeaters. Each repeater and gateway builds a routing tables in EEPROM which keeps track of the network topology allowing messages to be routed to nodes. Created by Henrik Ekblad <henrik.ekblad@mysensors.org> Copyright (C) 2013-2015 Sensnology AB Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors Documentation: http://www.mysensors.org Support Forum: http://forum.mysensors.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. ******************************* DESCRIPTION Example sketch showing how to send in DS1820B OneWire temperature readings back to the controller http://www.mysensors.org/build/temp */ #define MY_GATEWAY_SERIAL // Enable debug prints to serial monitor #define MY_DEBUG #define MY_NODE_ID 14 #include <SPI.h> #include <MySensors.h> #include <DallasTemperature.h> #define COMPARE_TEMP 0 // Send temperature only if changed? 1 = Yes 0 = No #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected #define ATTACHED_DS18B20 40 unsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds) OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. byte D[ATTACHED_DS18B20][8] = { { 0x10, 0x04, 0xB8, 0x3F, 0x02, 0x08, 0x00, 0xBD }, //KökTbx { 0x10, 0xF4, 0xD7, 0x3F, 0x02, 0x08, 0x00, 0xB1 }, //UppTbx { 0x10, 0x92, 0x9F, 0x3E, 0x02, 0x08, 0x00, 0x98 }, //KökUt { 0x10, 0x4E, 0xE4, 0x3E, 0x02, 0x08, 0x00, 0x3C }, //ToaUt { 0x10, 0x1E, 0xE8, 0x3E, 0x02, 0x08, 0x00, 0x33 }, //EfterPump { 0x10, 0x09, 0xA1, 0x3E, 0x02, 0x08, 0x00, 0xF7 }, //HallTbx { 0x10, 0x59, 0xCB, 0x3F, 0x02, 0x08, 0x00, 0xFA }, //UppUt { 0x10, 0x07, 0x1B, 0x3F, 0x02, 0x08, 0x00, 0x99 }, //ToaTbx { 0x28, 0xFF, 0xB1, 0xAA, 0x63, 0x15, 0x03, 0xC8 }, //Kök { 0x10, 0x80, 0xB6, 0x3F, 0x02, 0x08, 0x00, 0x29 }, //Panna komp { 0x10, 0x3C, 0x9C, 0x3E, 0x02, 0x08, 0x00, 0x99 }, //Hall ut { 0x10, 0x42, 0xE0, 0x3F, 0x02, 0x08, 0x00, 0xD1 }, //Tvätt { 0x10, 0xCE, 0xE9, 0x3E, 0x02, 0x08, 0x00, 0x3A }, //T12 { 0x10, 0x99, 0xAC, 0x3F, 0x02, 0x08, 0x00, 0x25 }, //V mellan { 0x10, 0x15, 0xDB, 0x3E, 0x02, 0x08, 0x00, 0x01 }, //Hallen { 0x10, 0xF3, 0xD7, 0x3F, 0x02, 0x08, 0x00, 0x34 }, //Panna El { 0x10, 0xFB, 0xCB, 0x3F, 0x02, 0x08, 0x00, 0xC8 }, //Toa Nere { 0x10, 0x97, 0x23, 0x3F, 0x02, 0x08, 0x00, 0x92 }, //Varmvatten { 0x10, 0x0F, 0xE6, 0x3E, 0x02, 0x08, 0x00, 0xFD }, //Carport { 0x10, 0xF3, 0xC6, 0x3F, 0x02, 0x08, 0x00, 0x85 }, //Förrådet { 0x10, 0x9C, 0x3B, 0x52, 0x02, 0x08, 0x00, 0x25 }, //Mark 60 { 0x10, 0xF2, 0x24, 0x3F, 0x02, 0x08, 0x00, 0xEB }, //Vrum V { 0x10, 0x6A, 0x5E, 0x52, 0x02, 0x08, 0x00, 0x26 }, //Mark 30 { 0x10, 0x76, 0xCE, 0x3F, 0x02, 0x08, 0x00, 0xBA }, //Plattan { 0x10, 0x0E, 0x7B, 0x13, 0x02, 0x08, 0x00, 0x7C }, //Utetemp { 0x10, 0xEE, 0xEB, 0x3E, 0x02, 0x08, 0x00, 0x0F }, //Uterum { 0x28, 0x8C, 0x2D, 0xB4, 0x04, 0x00, 0x00, 0x9C }, //Kyl uppe { 0x28, 0xFF, 0xB2, 0x74, 0x63, 0x15, 0x02, 0xCC }, //Kyl mitten { 0x28, 0xFF, 0x08, 0x07, 0x52, 0x04, 0x00, 0xFF }, //Kyl nere { 0x28, 0xFF, 0xE6, 0x06, 0x52, 0x04, 0x00, 0x08 }, //Frys uppe { 0x28, 0xFF, 0xB4, 0x07, 0x55, 0x04, 0x00, 0xEB }, //Kyl bakom { 0x10, 0x1C, 0xA8, 0x3F, 0x02, 0x08, 0x00, 0x3B }, //Lucas { 0x10, 0x83, 0x3C, 0x3F, 0x02, 0x08, 0x00, 0x06 }, //Allrum { 0x10, 0xA3, 0xE8, 0x3E, 0x02, 0x08, 0x00, 0x7E }, //Theo { 0x10, 0x33, 0x3C, 0x3F, 0x02, 0x08, 0x00, 0x01 }, //Sovrum { 0x28, 0xFF, 0xFB, 0x3D, 0xC3, 0x16, 0x03, 0x58 }, //Panna luft in(varm) { 0x28, 0xFF, 0xD4, 0x1C, 0x00, 0x17, 0x03, 0x43 }, //Dränering { 0x28, 0xFF, 0x97, 0x11, 0x01, 0x15, 0x04, 0xC0 } // Poolvatten }; float lastTemperature[ATTACHED_DS18B20]; // Initialize temperature message MyMessage msg(0, V_TEMP); MyMessage heat(0, V_STATUS); void setup() { // Startup up the OneWire library sensors.begin(); // requestTemperatures() will not block current thread sensors.setWaitForConversion(false); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("OneWire Temp+Heating LED", "20180709"); // Fetch the number of attached temperature sensors //numSensors = sensors.getDeviceCount(); // Present all sensors to controller for (int i = 0; i < ATTACHED_DS18B20; i++) { present(i, S_TEMP); } for (int i = ATTACHED_DS18B20; i < ATTACHED_DS18B20 + 5; i++) { present(i, S_HEATER); } void loop() // Fetch temperatures from Dallas sensors sensors.requestTemperatures(); // query conversion time and sleep until conversion completed int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) sleep(conversionTime); // Read temperatures and send them to controller for (int i = 0; i < ATTACHED_DS18B20; i++) { //Serial.println(sensors.getResolution(D[i]), DEC); // Fetch and round temperature to one decimal // float temperature = static_cast<float>(static_cast<int>((sensors.requestTemperaturesByAddress(D[i])) * 10.)) / 10.; float temperature = sensors.getTempC(D[i]); // Only send data if temperature has changed and no error #if COMPARE_TEMP == 1 if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) { #else if (temperature != -127.00 && temperature <= 85.00) { #endif // Send in the new temperature send(msg.setSensor(i).set(temperature, 1)); // Save new temperatures for next compare lastTemperature[i] = temperature; } } for (int i = 0; i < 5; i++) { int value = analogRead(i); /*Serial.print("Pin"); Serial.print(i); Serial.print("="); Serial.println(value); */ int j = i + ATTACHED_DS18B20; if (value > 150) { send(heat.setSensor(j).set(1)); } else { send(heat.setSensor(j).set(0)); } } sleep(SLEEP_TIME); }
C:\Users\Piotrek\Desktop\Temp dallas\Arduino_dallas_18B20_with_desc\Arduino_dallas_18B20_with_desc.ino: In function 'void presentation()':
Arduino_dallas_18B20_with_desc:117:3: error: expected initializer before 'sensors'
sensors.requestTemperatures();
^
exit status 1
expected initializer before 'sensors' -
RE: About DS18B20 onewire.
@flopp said in About DS18B20 onewire.:
/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * DESCRIPTION * * Example sketch showing how to send in DS1820B OneWire temperature readings back to the controller * http://www.mysensors.org/build/temp */ // Enable and select radio type attached #define MY_RADIO_NRF24 // Enable debug prints to serial monitor #define MY_DEBUG #define MY_NODE_ID 14 #include <SPI.h> #include <MySensors.h> #include <DallasTemperature.h> #define COMPARE_TEMP 0 // Send temperature only if changed? 1 = Yes 0 = No #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected #define ATTACHED_DS18B20 40 unsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds) OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. byte D[ATTACHED_DS18B20][8] = { { 0x10, 0x04, 0xB8, 0x3F, 0x02, 0x08, 0x00, 0xBD }, //KökTbx { 0x10, 0xF4, 0xD7, 0x3F, 0x02, 0x08, 0x00, 0xB1 }, //UppTbx { 0x10, 0x92, 0x9F, 0x3E, 0x02, 0x08, 0x00, 0x98 }, //KökUt { 0x10, 0x4E, 0xE4, 0x3E, 0x02, 0x08, 0x00, 0x3C }, //ToaUt { 0x10, 0x1E, 0xE8, 0x3E, 0x02, 0x08, 0x00, 0x33 }, //EfterPump { 0x10, 0x09, 0xA1, 0x3E, 0x02, 0x08, 0x00, 0xF7 }, //HallTbx { 0x10, 0x59, 0xCB, 0x3F, 0x02, 0x08, 0x00, 0xFA }, //UppUt { 0x10, 0x07, 0x1B, 0x3F, 0x02, 0x08, 0x00, 0x99 }, //ToaTbx { 0x28, 0xFF, 0xB1, 0xAA, 0x63, 0x15, 0x03, 0xC8 }, //Kök { 0x10, 0x80, 0xB6, 0x3F, 0x02, 0x08, 0x00, 0x29 }, //Panna komp { 0x10, 0x3C, 0x9C, 0x3E, 0x02, 0x08, 0x00, 0x99 }, //Hall ut { 0x10, 0x42, 0xE0, 0x3F, 0x02, 0x08, 0x00, 0xD1 }, //Tvätt { 0x10, 0xCE, 0xE9, 0x3E, 0x02, 0x08, 0x00, 0x3A }, //T12 { 0x10, 0x99, 0xAC, 0x3F, 0x02, 0x08, 0x00, 0x25 }, //V mellan { 0x10, 0x15, 0xDB, 0x3E, 0x02, 0x08, 0x00, 0x01 }, //Hallen { 0x10, 0xF3, 0xD7, 0x3F, 0x02, 0x08, 0x00, 0x34 }, //Panna El { 0x10, 0xFB, 0xCB, 0x3F, 0x02, 0x08, 0x00, 0xC8 }, //Toa Nere { 0x10, 0x97, 0x23, 0x3F, 0x02, 0x08, 0x00, 0x92 }, //Varmvatten { 0x10, 0x0F, 0xE6, 0x3E, 0x02, 0x08, 0x00, 0xFD }, //Carport { 0x10, 0xF3, 0xC6, 0x3F, 0x02, 0x08, 0x00, 0x85 }, //Förrådet { 0x10, 0x9C, 0x3B, 0x52, 0x02, 0x08, 0x00, 0x25 }, //Mark 60 { 0x10, 0xF2, 0x24, 0x3F, 0x02, 0x08, 0x00, 0xEB }, //Vrum V { 0x10, 0x6A, 0x5E, 0x52, 0x02, 0x08, 0x00, 0x26 }, //Mark 30 { 0x10, 0x76, 0xCE, 0x3F, 0x02, 0x08, 0x00, 0xBA }, //Plattan { 0x10, 0x0E, 0x7B, 0x13, 0x02, 0x08, 0x00, 0x7C }, //Utetemp { 0x10, 0xEE, 0xEB, 0x3E, 0x02, 0x08, 0x00, 0x0F }, //Uterum { 0x28, 0x8C, 0x2D, 0xB4, 0x04, 0x00, 0x00, 0x9C }, //Kyl uppe { 0x28, 0xFF, 0xB2, 0x74, 0x63, 0x15, 0x02, 0xCC }, //Kyl mitten { 0x28, 0xFF, 0x08, 0x07, 0x52, 0x04, 0x00, 0xFF }, //Kyl nere { 0x28, 0xFF, 0xE6, 0x06, 0x52, 0x04, 0x00, 0x08 }, //Frys uppe { 0x28, 0xFF, 0xB4, 0x07, 0x55, 0x04, 0x00, 0xEB }, //Kyl bakom { 0x10, 0x1C, 0xA8, 0x3F, 0x02, 0x08, 0x00, 0x3B }, //Lucas { 0x10, 0x83, 0x3C, 0x3F, 0x02, 0x08, 0x00, 0x06 }, //Allrum { 0x10, 0xA3, 0xE8, 0x3E, 0x02, 0x08, 0x00, 0x7E }, //Theo { 0x10, 0x33, 0x3C, 0x3F, 0x02, 0x08, 0x00, 0x01 }, //Sovrum { 0x28, 0xFF, 0xFB, 0x3D, 0xC3, 0x16, 0x03, 0x58 }, //Panna luft in(varm) { 0x28, 0xFF, 0xD4, 0x1C, 0x00, 0x17, 0x03, 0x43 }, //Dränering { 0x28, 0xFF, 0x97, 0x11, 0x01, 0x15, 0x04, 0xC0 } // Poolvatten }; float lastTemperature[ATTACHED_DS18B20]; // Initialize temperature message MyMessage msg(0,V_TEMP); MyMessage heat(0,V_STATUS); void setup() { // Startup up the OneWire library sensors.begin(); // requestTemperatures() will not block current thread sensors.setWaitForConversion(false); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("OneWire Temp+Heating LED", "20180709"); // Fetch the number of attached temperature sensors //numSensors = sensors.getDeviceCount(); // Present all sensors to controller for (int i=0; i<ATTACHED_DS18B20; i++) { present(i, S_TEMP); } for (int i=ATTACHED_DS18B20; i<ATTACHED_DS18B20+5; i++) { present(i, S_HEATER); } } void loop() { // Fetch temperatures from Dallas sensors sensors.requestTemperatures(); // query conversion time and sleep until conversion completed int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) sleep(conversionTime); // Read temperatures and send them to controller for (int i=0; i<ATTACHED_DS18B20; i++) { //Serial.println(sensors.getResolution(D[i]), DEC); // Fetch and round temperature to one decimal // float temperature = static_cast<float>(static_cast<int>((sensors.requestTemperaturesByAddress(D[i])) * 10.)) / 10.; float temperature = sensors.getTempC(D[i]); // Only send data if temperature has changed and no error #if COMPARE_TEMP == 1 if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) { #else if (temperature != -127.00 && temperature <= 85.00) { #endif // Send in the new temperature send(msg.setSensor(i).set(temperature,1)); // Save new temperatures for next compare lastTemperature[i]=temperature; } } for (int i=0; i<5;i++){ int value = analogRead(i); /*Serial.print("Pin"); Serial.print(i); Serial.print("="); Serial.println(value); */ int j=i+ATTACHED_DS18B20; if (value>150) { send(heat.setSensor(j).set(1)); } else { send(heat.setSensor(j).set(0)); } } sleep(SLEEP_TIME); }
When i try compile this sketch it get me error:
C:\Users\Piotrek\Desktop\Temp dallas\Arduino_dallas_18B20_with_desc\Arduino_dallas_18B20_with_desc.ino: In function 'void presentation()':
Arduino_dallas_18B20_with_desc:117:3: error: expected initializer before 'sensors'
sensors.requestTemperatures();
^
exit status 1
expected initializer before 'sensors' -
RE: About DS18B20 onewire.
@rejoe2 said in About DS18B20 onewire.:
If you want a "hardcoded version", you'd have to addopt the sketch for something in between these variants: if you use an array for the 1-wire addresses like https://github.com/rejoe2/MySensors-Dallas-Address-ChildID-Consistency/blob/master/Dallas_Addresses_Array_Solution/Dallas_Addresses_Array_Solution.ino does, just built the comment char-array based on that info.
Ok i know how add to present description , but still dont know how add description to each sensors.... as in sketch for relay as i show as example.
-
RE: About DS18B20 onewire.
@rejoe2
But where in sketch you define address and description ? -
RE: About DS18B20 onewire.
@mfalkvidd
OK but also must add defined description to all address. But how add also description? -
RE: About DS18B20 onewire.
@flopp
Hi
Tell me... is any chance to add in sketch position to write description for sensor and to send this description to Home Assistant....? It is ok write in other sketch for relay and it works perfect:
https://github.com/lkankowski/arduino-multi-relay/blob/master/arduino-multi-relay.inoIt show in Home Assisnatn this information in description example: Ł2 - kinkiet [C10]
-
RE: 💬 OH MySensors RGBW Controller
Hi
Is any chance to implement in sketch option to Node after connect power go to state OFF. Now it go to ON. In situation when power lost and come back all leds will be ON.and is any chance to implement in your sketch option to add manual button to enable LEDS color WHITE ?
Any color i want to setup by gateway but on the wall i want mount switch to enable color white and also to disable.
Please add this if you can... In sketch setup pin on which button works and also color which should be turn on.... -
RE: 💬 OH MySensors RGBW Controller
I found one bug in your project PCB. Pin from radio nae IRQ should be connect on PCB to pin 2 ARDUINO. But it is not connect. Also when i use radio RFM69HW i also need connect PIN 2 Arduino to pin DI00 on radio RFM69HW. This should be correct... Now pin 9 from radio is not connect to any pin Arduino.
On RFM69HW all works ok. In previus post my radio is fix.
-
RE: 💬 OH MySensors RGBW Controller
This from gateway:
pi@hassbian:~/MySensors $ sudo ./bin/mysgw -d
mysgw: Starting gateway...
mysgw: Protocol version - 2.2.0
mysgw: MCO:BGN:INIT GW,CP=RPNGL---,VER=2.2.0
mysgw: TSF:LRT:OK
mysgw: TSM:INIT
mysgw: TSF:WUR:MS=0
mysgw: TSM:INIT:TSP OK
mysgw: TSM:INIT:GW MODE
mysgw: TSM:READY:ID=0,PAR=0,DIS=0
mysgw: MCO:REG:NOT NEEDED
mysgw: Listening for connections on 0.0.0.0:5003
mysgw: MCO:BGN:STP
mysgw: MCO:BGN:INIT OK,TSP=1
mysgw: TSF:MSG:READ,61-61-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=61
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: !TSF:MSG:SEND,0-0-61-61,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
mysgw: TSF:MSG:READ,61-61-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=61
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: !TSF:MSG:SEND,0-0-61-61,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
mysgw: TSF:MSG:READ,61-61-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=61
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: !TSF:MSG:SEND,0-0-61-61,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
mysgw: TSF:MSG:READ,61-61-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=61
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: !TSF:MSG:SEND,0-0-61-61,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
mysgw: TSF:MSG:READ,61-61-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=61
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: !TSF:MSG:SEND,0-0-61-61,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0Other node works ok with this gateway.... Only this RGNW not working.
This is log from gateway with connectionm with other node:
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
mysgw: TSF:MSG:PINGED,ID=30,HP=1
mysgw: TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
mysgw: TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
mysgw: TSF:MSG:READ,30-30-0,s=255,c=0,t=18,pt=0,l=5,sg=0:2.2.0
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=11,pt=0,l=24,sg=0:Cover Roleta Sypialnia__
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=12,pt=0,l=4,sg=0:20.0
mysgw: TSF:MSG:READ,30-30-0,s=1,c=0,t=5,pt=0,l=21,sg=0:Roller Shutter for HA
mysgw: TSF:MSG:READ,30-30-0,s=21,c=0,t=29,pt=0,l=0,sg=0:
mysgw: TSF:MSG:READ,30-30-0,s=41,c=0,t=29,pt=0,l=0,sg=0:
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
mysgw: TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=29,pt=2,l=2,sg=0:1
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=45,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=0,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=44,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=0,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:99
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:98
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:97
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:96
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:95
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:94
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:93
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:92
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:91
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:90
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:89
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:88
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:87
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:86
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=31,pt=2,l=2,sg=0:1
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:86
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=45,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=0,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=44,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=0,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=31,pt=2,l=2,sg=0:1
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:86
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=45,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=0,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=44,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=0,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:87
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:88
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:89
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:90
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:91
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:92
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:93
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:94
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:95
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:96
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:97
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:98
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:99
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=29,pt=2,l=2,sg=0:1
mysgw: TSF:MSG:READ,30-30-0,s=1,c=1,t=3,pt=2,l=2,sg=0:100
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=45,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=21,c=1,t=0,pt=2,l=2,sg=0:60
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=44,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-0,s=41,c=1,t=0,pt=2,l=2,sg=0:55
mysgw: TSF:MSG:READ,30-30-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=30
mysgw: TSF:PNG:SEND,TO=0
mysgw: TSF:CKU:OK
mysgw: TSF:MSG:GWL OK
mysgw: !TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
mysgw: TSF:MSG:READ,30-30-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
mysgw: TSF:MSG:BC
mysgw: TSF:MSG:FPAR REQ,ID=30
mysgw: TSF:CKU:OK,FCTRL
mysgw: TSF:MSG:GWL OK
mysgw: TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
mysgw: TSF:MSG:PINGED,ID=30,HP=1
mysgw: TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
mysgw: !TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=NACK:0100
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=11,pt=0,l=24,sg=0:Cover Roleta Sypialnia__
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=12,pt=0,l=4,sg=0:20.0
mysgw: TSF:MSG:READ,30-30-0,s=1,c=0,t=5,pt=0,l=21,sg=0:Roller Shutter for HA
mysgw: TSF:MSG:READ,30-30-0,s=21,c=0,t=29,pt=0,l=0,sg=0:
mysgw: TSF:MSG:READ,30-30-0,s=41,c=0,t=29,pt=0,l=0,sg=0:
mysgw: TSF:MSG:READ,30-30-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
mysgw: TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1 -
RE: 💬 OH MySensors RGBW Controller
Hi
I build this project but i want use it with radio RFM69HW and controller Home Assistant. But it not working with Home Assistant. Not connect with gateway on my RPI3b+. Other node with this radio connect ok. I dont know why ?Radio works and show this:
| / |_ / | ___ _ __ ___ ___ _ __ ___
| |/| | | | _ \ / _ \_ \/ __|/ _ \|
_/ __|
| | | | || || | / | | _ \ _ | | _
|| ||_, |/ ___|| ||/_/|| |/
|__/ 2.2.016 MCO:BGN:INIT NODE,CP=RPNNA---,VER=2.2.0
26 TSM:INIT
28 TSF:WUR:MS=0
30 TSM:INIT:TSP OK
32 TSM:INIT:STATID=61
34 TSF:SID:OK,ID=61
36 TSM:FPAR
1038 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
3045 !TSM:FPAR:NO REPLY
3047 TSM:FPAR
4050 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
6060 !TSM:FPAR:NO REPLY
6062 TSM:FPAR
7065 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
9072 !TSM:FPAR:NO REPLY
9074 TSM:FPAR
10076 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
12083 !TSM:FPAR:FAIL
12085 TSM:FAIL:CNT=1
12087 TSM:FAIL:DIS
12089 TSF:TDI:TSL
22093 TSM:FAIL:RE-INIT
22095 TSM:INIT
22097 TSM:INIT:TSP OK
22099 TSM:INIT:STATID=61
22104 TSF:SID:OK,ID=61
22106 TSM:FPAR
23109 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
25116 !TSM:FPAR:NO REPLY
25118 TSM:FPAR
26120 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
28127 !TSM:FPAR:NO REPLY
28129 TSM:FPAR
29132 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
31139 !TSM:FPAR:NO REPLY
31141 TSM:FPAR
32143 TSF:MSG:SEND,61-61-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
34150 !TSM:FPAR:FAIL
34152 TSM:FAIL:CNT=2
34154 TSM:FAIL:DIS
34156 TSF:TDI:TSL -
RE: 💬 OH MySensors RGBW Controller
Why on 5 picture POWER MOSFET IRLM2502 is other side solder than on picture 9 ?
-
RE: About DS18B20 onewire.
@flopp
Probably tommorow I test your sketch and send you an info...And what you mean in sketch write Heat?
And is any chance to modify this sketch and add value name "Description" to each sensor Dallas to send info to controller like Home Assistant to user can easily identify sensors in controller? What is what....
-
RE: About DS18B20 onewire.
But for what is number 8 in this ?
byte D[3][8] = {On what MySensors you use it ?
Previous sketch your in this thread i can not compile. I convert it as i show. You mean that sketch with 2 pcs dallas should look like this:/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * DESCRIPTION * * Example sketch showing how to send in DS1820B OneWire temperature readings back to the controller * http://www.mysensors.org/build/temp */ #define MY_GATEWAY_SERIAL #include <MySensors.h> #include <SPI.h> #include <DallasTemperature.h> #include <OneWire.h> #define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected #define MAX_ATTACHED_DS18B20 16 unsigned long SLEEP_TIME = 3000; // Sleep time between reads (in milliseconds) OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. byte D[2][8] = { { 0x28, 0xFB, 0x8F, 0x77, 0x91, 0x15, 0x02, 0x32 }, { 0x28, 0xC5, 0xBF, 0x77, 0x91, 0x16, 0x02, 0x1D } }; //MySensor gw; float lastTemperature[MAX_ATTACHED_DS18B20]; int numSensors=0; boolean receivedConfig = false; boolean metric = true; // Initialize temperature message MyMessage msg(0,V_TEMP); void before() { // Startup up the OneWire library sensors.begin(); } void setup() { // requestTemperatures() will not block current thread sensors.setWaitForConversion(false); // Startup and initialize MySensors library. Set callback for incoming messages. // begin(); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Temp. Sensor", "1.1"); // Fetch the number of attached temperature sensors numSensors = sensors.getDeviceCount(); // Present all sensors to controller for (int i=0; i<3 && i<MAX_ATTACHED_DS18B20; i++) { present(i, S_TEMP); } } void loop() { Serial.println(millis()); // Process incoming messages (like config from server) //process(); // Fetch temperatures from Dallas sensors sensors.requestTemperatures(); // query conversion time and sleep until conversion completed int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) sleep(conversionTime); // Read temperatures and send them to controller for (int i=0; i<3 && i<MAX_ATTACHED_DS18B20; i++) { // Fetch and round temperature to one decimal //float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(D[i]):sensors.getTempFByIndex(D[i])) * 10.)) / 10.; //float temperature = static_cast<float>(static_cast<int>((sensors.requestTemperaturesByAddress(D[i])) * 10.)) / 10.; float temperature = sensors.getTempC(D[i]); // Only send data if temperature has changed and no error #if COMPARE_TEMP == 1 if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) { #else if (temperature != -127.00 && temperature != 85.00) { #endif // Send in the new temperature send(msg.setSensor(i).set(temperature,1)); // Save new temperatures for next compare lastTemperature[i]=temperature; } } sleep(SLEEP_TIME); }
And what command in sketch should be use:
- float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(D[i]):sensors.getTempFByIndex(D[i])) * 10.)) / 10.;
- float temperature = static_cast<float>(static_cast<int>((sensors.requestTemperaturesByAddress(D[i])) * 10.)) / 10.;
- float temperature = sensors.getTempC(D[i]);
In original sketch from Mysensors he use this :
float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;And please share me sketch which you use with MySensors 2.x and with how system controller you use it ? I want use with Home Assistant.
-
RE: About DS18B20 onewire.
@mfalkvidd
Hi
I am not programmer and i dont know how. Is any chance to you can help me convert it to working with MySensors 2.x ?
This sketch looks similary as standard sketch from mysensors:
https://www.mysensors.org/build/tempStandard sketch works but i want use sketch with ID Dallas to write in my Home assistant to specify number child.... and when dallas destroy i replace ID in sketch write to arduino and in Home Assistant automaticaly replace it and show still correct temp to my room.
-
RE: About DS18B20 onewire.
I correct this sketch But for me dont read temp.....
standard sketch from mysensors looks similary like this read with no problem.
https://www.mysensors.org/build/temp/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * DESCRIPTION * * Example sketch showing how to send in DS1820B OneWire temperature readings back to the controller * http://www.mysensors.org/build/temp */ #define MY_GATEWAY_SERIAL #include <MySensors.h> #include <SPI.h> #include <DallasTemperature.h> #include <OneWire.h> #define COMPARE_TEMP 0 // Send temperature only if changed? 1 = Yes 0 = No #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected #define MAX_ATTACHED_DS18B20 16 unsigned long SLEEP_TIME = 3000; // Sleep time between reads (in milliseconds) OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. byte D[3][8] = { { 0x28, 0xFB, 0x8F, 0x77, 0x91, 0x15, 0x02, 0x32 }, { 0x28, 0xFF, 0x37, 0x77, 0x91, 0x18, 0x02, 0x16 } }; //MySensor gw; float lastTemperature[MAX_ATTACHED_DS18B20]; int numSensors=0; boolean receivedConfig = false; boolean metric = true; // Initialize temperature message MyMessage msg(0,V_TEMP); void before() { // Startup up the OneWire library sensors.begin(); } void setup() { // requestTemperatures() will not block current thread sensors.setWaitForConversion(false); // Startup and initialize MySensors library. Set callback for incoming messages. // begin(); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Temp. Sensor", "1.1"); // Fetch the number of attached temperature sensors numSensors = sensors.getDeviceCount(); // Present all sensors to controller for (int i=0; i<3 && i<MAX_ATTACHED_DS18B20; i++) { present(i, S_TEMP); } } void loop() { Serial.println(millis()); // Process incoming messages (like config from server) //process(); // Fetch temperatures from Dallas sensors sensors.requestTemperatures(); // query conversion time and sleep until conversion completed int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) sleep(conversionTime); // Read temperatures and send them to controller for (int i=0; i<3 && i<MAX_ATTACHED_DS18B20; i++) { // Fetch and round temperature to one decimal // float temperature = static_cast<float>(static_cast<int>((sensors.requestTemperaturesByAddress(D[i])) * 10.)) / 10.; float temperature = sensors.getTempC(D[i]); // Only send data if temperature has changed and no error #if COMPARE_TEMP == 1 if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) { #else if (temperature != -127.00 && temperature != 85.00) { #endif // Send in the new temperature send(msg.setSensor(i).set(temperature,1)); // Save new temperatures for next compare lastTemperature[i]=temperature; } } //gw.sleep(SLEEP_TIME); }
-
RE: About DS18B20 onewire.
Hi
i try use your sketch but it is not working... I add in this to use serial gateway but also i get error why ?/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * DESCRIPTION * * Example sketch showing how to send in DS1820B OneWire temperature readings back to the controller * http://www.mysensors.org/build/temp */ #define MY_GATEWAY_SERIAL #include <MySensors.h> #include <SPI.h> #include <DallasTemperature.h> #include <OneWire.h> #define COMPARE_TEMP 0 // Send temperature only if changed? 1 = Yes 0 = No #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected #define MAX_ATTACHED_DS18B20 16 unsigned long SLEEP_TIME = 3000; // Sleep time between reads (in milliseconds) OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. byte D[3][8] = { { 0x28, 0xC6, 0xCA, 0xA0, 0x05, 0x00, 0x00, 0x30 } }; MySensor gw; float lastTemperature[MAX_ATTACHED_DS18B20]; int numSensors=0; boolean receivedConfig = false; boolean metric = true; // Initialize temperature message MyMessage msg(0,V_TEMP); void setup() { // Startup up the OneWire library sensors.begin(); // requestTemperatures() will not block current thread sensors.setWaitForConversion(false); // Startup and initialize MySensors library. Set callback for incoming messages. gw.begin(); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Temperature Sensor", "1.1"); // Fetch the number of attached temperature sensors numSensors = sensors.getDeviceCount(); // Present all sensors to controller for (int i=0; i<3 && i<MAX_ATTACHED_DS18B20; i++) { gw.present(i, S_TEMP); } } void loop() { Serial.println(millis()); // Process incoming messages (like config from server) gw.process(); // Fetch temperatures from Dallas sensors sensors.requestTemperatures(); // query conversion time and sleep until conversion completed int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) gw.sleep(conversionTime); // Read temperatures and send them to controller for (int i=0; i<3 && i<MAX_ATTACHED_DS18B20; i++) { // Fetch and round temperature to one decimal // float temperature = static_cast<float>(static_cast<int>((sensors.requestTemperaturesByAddress(D[i])) * 10.)) / 10.; float temperature = sensors.getTempC(D[i]); // Only send data if temperature has changed and no error #if COMPARE_TEMP == 1 if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) { #else if (temperature != -127.00 && temperature != 85.00) { #endif // Send in the new temperature gw.send(msg.setSensor(i).set(temperature,1)); // Save new temperatures for next compare lastTemperature[i]=temperature; } } //gw.sleep(SLEEP_TIME); }
But when try compile i get error:
dallas_with_address_ok:45:1: error: 'MySensor' does not name a type MySensor gw; ^ C:\Users\Piotrek\Desktop\Arduino\dallas_with_address_ok\dallas_with_address_ok.ino: In function 'void setup()': dallas_with_address_ok:61:3: error: 'gw' was not declared in this scope gw.begin(); ^ C:\Users\Piotrek\Desktop\Arduino\dallas_with_address_ok\dallas_with_address_ok.ino: In function 'void loop()': dallas_with_address_ok:81:3: error: 'gw' was not declared in this scope gw.process(); ^ exit status 1 'MySensor' does not name a type
Please help me...
-
RE: 💬 Temperature Sensor
Anybody has sketch for sensors dallas DS18b20 with identify it with ID Dallas ?
And i can change value 16 to more sensors ? Example 20 ? -
RE: About DS18B20 onewire.
Is any chance to connect more than 16 dallas ? By change value 16 to example 20 ?
-
RE: Arduino Mega 2560 Ethernet Gateway - Cant get it going.
Any news in this thread ?
-
RE: 💬 OH MySensors RGBW Controller
Hello
How long led strips in meters i can connect to this device ? What max power led strips support it ? -
RE: Hass.io gateway
Hi
Did you resolved your problem?
I also want have Hass.io and install mysensors gateway on my raspberry. Hass.io is also on raspberry. -
Multirelay for Home Assistant
Hi
Is anybody who has or who can write sketch for multirelay with buttons controlled by Arduino Mega 2560 some pcs relay board as example:
https://www.aliexpress.com/item/16-Channel-5V-Relay-Shield-Module-with-optocoupler-LM2576-Power-supply-For-Arduino/32700261256.html?spm=2114.search0604.3.1.6ee871cdJslziS&s=p&ws_ab_test=searchweb0_0,searchweb201602_1_10065_10068_10843_10059_10884_10887_312_10696_100031_10084_10083_10103_10618_10304_10307_10820_10301_10821_528,searchweb201603_45,ppcSwitch_4&algo_expid=9778a327-b65b-44d1-8d96-1b16e3c4bf04-0&algo_pvid=9778a327-b65b-44d1-8d96-1b16e3c4bf04&priceBeautifyAB=0In sketch good if will be option to define which relay should read state from eeprom, which alsways is ON or OFF after restart lost power.I have this sketch... it is very good but he always read states from eeprom. Maybe we can modify this. Please help me...
// Enable debug prints to serial monitor //#define USE_EXPANDER #define MY_DEBUG #define MY_GATEWAY_SERIAL #define MY_INCLUSION_MODE_FEATURE #define MY_INCLUSION_BUTTON_FEATURE #define MY_INCLUSION_MODE_DURATION 60 #define MY_INCLUSION_MODE_BUTTON_PIN 3 #include <MySensors.h> #include <Bounce2.h> #ifdef USE_EXPANDER #include <Wire.h> // Required for I2C communication #include "PCF8574.h" // Required for PCF8574 PCF8574 expander0; // Expander constants #define E00 0x0100 #define E01 0x0101 #define E02 0x0102 #define E03 0x0103 #define E04 0x0104 #define E05 0x0105 #define E06 0x0106 #define E07 0x0107 #endif // No Button Constant #define NOB -1 #define MULTI_RELAY_VERSION 7 #define RELAY_STATE_STORAGE 1 #define RELAY_ON 1 #define RELAY_OFF 0 enum ButtonType { MONO_STABLE = 0, BI_STABLE = 1, DING_DONG = 3 // HIGH state immediatly after push, LOW state after release }; typedef struct { int relay; int button; uint8_t relayTrigger; ButtonType buttonType; } RelayButton; // CONFIGURE ONLY THIS ARRAY! // Row params: relay pin, button pin, relay trigger [HIGH|LOW], button type [MONO_STABLE|BI_STABLE] RelayButton myRelayButtons[] = { {4, A0, HIGH, MONO_STABLE}, {5, A1, HIGH, MONO_STABLE}, {6, A2, HIGH, MONO_STABLE}, {7, A3, HIGH, MONO_STABLE}, {8, A4, HIGH, MONO_STABLE}, {9, A5, HIGH, MONO_STABLE}, {10, A6, HIGH, MONO_STABLE}, {11, A7, HIGH, MONO_STABLE}, }; const int numberOfRelayButtons = sizeof(myRelayButtons) / sizeof(RelayButton); typedef struct { int firstButton; int nextButton; } RelayMultiButtons; RelayMultiButtons relayMultiButtons[numberOfRelayButtons]; // MySensors - Sending Data // To send data you have to create a MyMessage container to hold the information. MyMessage msgs[numberOfRelayButtons]; Bounce myButtonDebouncer[numberOfRelayButtons]; // MySensors - This will execute before MySensors starts up void before() { Serial.begin(115200); #ifdef USE_EXPANDER /* Start I2C bus and PCF8574 instance */ expander0.begin(0x20); #endif // initialize multiple buttons list structure for (int i = 0; i < numberOfRelayButtons; i++) { relayMultiButtons[i].firstButton = -1; relayMultiButtons[i].nextButton = -1; } // find multiple buttons for the same relay (uni-directional list) for (int i = 0; i < numberOfRelayButtons-1; i++) { if (relayMultiButtons[i].firstButton == -1) { int prevRelayButton = i; for (int j = i+1; j < numberOfRelayButtons; j++) { if (myRelayButtons[i].relay == myRelayButtons[j].relay) { relayMultiButtons[prevRelayButton].firstButton = i; relayMultiButtons[prevRelayButton].nextButton = j; relayMultiButtons[j].firstButton = i; prevRelayButton = j; } } } } // if version has changed, reset state of all relays int versionChangeResetState = 0; if (MULTI_RELAY_VERSION != loadState(0) ) for (int i = 0; i < numberOfRelayButtons; i++) { // if this relay has multiple buttons, load only first if (relayMultiButtons[i].firstButton == -1 || relayMultiButtons[i].firstButton == i) { // Then set relay pins in output mode #ifdef USE_EXPANDER if ( myRelayButtons[i].relay >= 0x0100 ) { // EXPANDER expander0.pinMode(myRelayButtons[i].relay & 0xf, OUTPUT); } else { #endif pinMode(myRelayButtons[i].relay, OUTPUT); #ifdef USE_EXPANDER } #endif uint8_t isTurnedOn = 0; if (versionChangeResetState) { saveRelayState(i, 0); } else { // Set relay to last known state (using eeprom storage) isTurnedOn = loadRelayState(i); // 1 - true, 0 - false } uint8_t state = isTurnedOn ? myRelayButtons[i].relayTrigger : ! myRelayButtons[i].relayTrigger; digitalWrite(myRelayButtons[i].relay, state); } } } // executed AFTER mysensors has been initialised void setup() { // Setup locally attached sensors delay(5000); // Setup Relays for(int i = 0; i < numberOfRelayButtons; i++) { // if this relay has multiple buttons, send only first if (relayMultiButtons[i].firstButton == -1 || relayMultiButtons[i].firstButton == i) { msgs[i] = MyMessage(i, V_LIGHT); send(msgs[i].set(loadRelayState(i))); // send current state } } // Setup buttons for(int i = 0; i < numberOfRelayButtons; i++) { if (myRelayButtons[i].button >= 0) { // No Expander support for buttons (de-bouncing) pinMode(myRelayButtons[i].button, INPUT_PULLUP); // HIGH state when button is not pushed // After setting up the button, setup debouncer. myButtonDebouncer[i] = Bounce(); myButtonDebouncer[i].attach(myRelayButtons[i].button); myButtonDebouncer[i].interval(50); } } //presentation(); } void loop() { for(int i = 0; i < numberOfRelayButtons; i++) { if (myRelayButtons[i].button >= 0 && myButtonDebouncer[i].update()) { int buttonState = myButtonDebouncer[i].read(); #ifdef MY_DEBUG Serial.print("Button "); Serial.print(i); Serial.print(" changed to: "); Serial.println(buttonState); #endif int nextButton = (relayMultiButtons[i].firstButton == -1) ? i : relayMultiButtons[i].firstButton; if (myRelayButtons[i].buttonType == DING_DONG) { if (buttonState == LOW) { // button pressed digitalWrite(myRelayButtons[nextButton].relay, myRelayButtons[nextButton].relayTrigger); send(msgs[nextButton].set(1)); } else { // button released digitalWrite(myRelayButtons[nextButton].relay, ! myRelayButtons[nextButton].relayTrigger); send(msgs[nextButton].set(0)); } } else if (myRelayButtons[i].buttonType == BI_STABLE || buttonState == HIGH) { // If button type is BI_STABLE, any change will toggle relay state // For MONO_STABLE, button must be pushed and released (HIGH) uint8_t isTurnedOn = ! loadRelayState(nextButton); // 1 - true, 0 - false uint8_t newState = isTurnedOn ? myRelayButtons[nextButton].relayTrigger : ! myRelayButtons[nextButton].relayTrigger; digitalWrite(myRelayButtons[nextButton].relay, newState); send(msgs[nextButton].set(isTurnedOn)); // update state in eeprom for all buttons do { saveRelayState(nextButton, isTurnedOn); nextButton = relayMultiButtons[nextButton].nextButton; } while (nextButton != -1); } } } } // MySensors - Presentation // Your sensor must first present itself to the controller. // The presentation is a hint to allow controller prepare for the sensor data that eventually will come. // void present(uint8_t childSensorId, uint8_t sensorType, const char *description, bool ack); // childSensorId - The unique child id you want to choose for the sensor connected to this Arduino. Range 0-254. // sensorType - The sensor type you want to create. // description An optional textual description of the attached sensor. // ack - Set this to true if you want destination node to send ack back to this node. Default is not to request any ack. void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Multi Relay", "1.1"); // Register every relay as separate sensor for (int i = 0; i < numberOfRelayButtons; i++) { // if this relay has multiple buttons, register only first if (relayMultiButtons[i].firstButton == -1 || relayMultiButtons[i].firstButton == i) { // Register all sensors to gw (they will be created as child devices) present(i, S_BINARY); } } } // MySensors - Handling incoming messages // Nodes that expects incoming data, such as an actuator or repeating nodes, // must implement the receive() - function to handle the incoming messages. // Do not sleep a node where you expect incoming data or you will lose messages. void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type == V_STATUS) { uint8_t isTurnedOn = message.getBool(); // 1 - true, 0 - false uint8_t newState = isTurnedOn ? myRelayButtons[message.sensor].relayTrigger : ! myRelayButtons[message.sensor].relayTrigger; // Change relay state digitalWrite(myRelayButtons[message.sensor].relay, newState); // Store state in eeprom if changed if (loadRelayState(message.sensor) != isTurnedOn) { saveRelayState(message.sensor, isTurnedOn); } send(msgs[message.sensor].set(isTurnedOn)); // support for OPTIMISTIC=FALSE (Home Asistant) } } uint8_t loadRelayState(int relayNum) { return(loadState(RELAY_STATE_STORAGE + relayNum)); } void saveRelayState(int relayNum, uint8_t state) { saveState(RELAY_STATE_STORAGE + relayNum, state); }
please help.
-
Multirelay sketch-help with modification
Hi all
I have this sketch which support working with multi relay and buttons on Arduino Mega 2560.
All is ok and works with Domoticz and Home Assistant. Now sketch after reboot or power lost , read latest state from eeprom.
But is any chance to anybody can modification this sketch to user can define option which can be use after power lost:- read latest state from eeprom
- relay ON
- relay OFF
And good will be if user can define this oprtion separate to each relay ex:
// CONFIGURE ONLY THIS ARRAY!
// Row params: relay pin, button pin, relay trigger [HIGH|LOW], button type [MONO_STABLE|BI_STABLE], state relay [EEPROM|ON|OFF]
RelayButton myRelayButtons[] = {
{4, A0, HIGH, MONO_STABLE, EEPROM},
{5, A1, HIGH, MONO_STABLE, ON},
{6, A2, HIGH, MONO_STABLE, OFF},
{7, A3, HIGH, MONO_STABLE, OFF},
{8, A4, HIGH, MONO_STABLE, EEPROM},
};this is sketch:
// Enable debug prints to serial monitor //#define USE_EXPANDER #define MY_DEBUG #define MY_GATEWAY_SERIAL #define MY_INCLUSION_MODE_FEATURE #define MY_INCLUSION_BUTTON_FEATURE #define MY_INCLUSION_MODE_DURATION 60 #define MY_INCLUSION_MODE_BUTTON_PIN 3 #include <MySensors.h> #include <Bounce2.h> #ifdef USE_EXPANDER #include <Wire.h> // Required for I2C communication #include "PCF8574.h" // Required for PCF8574 PCF8574 expander0; // Expander constants #define E00 0x0100 #define E01 0x0101 #define E02 0x0102 #define E03 0x0103 #define E04 0x0104 #define E05 0x0105 #define E06 0x0106 #define E07 0x0107 #endif // No Button Constant #define NOB -1 #define MULTI_RELAY_VERSION 7 #define RELAY_STATE_STORAGE 1 #define RELAY_ON 1 #define RELAY_OFF 0 enum ButtonType { MONO_STABLE = 0, BI_STABLE = 1, DING_DONG = 3 // HIGH state immediatly after push, LOW state after release }; typedef struct { int relay; int button; uint8_t relayTrigger; ButtonType buttonType; } RelayButton; // CONFIGURE ONLY THIS ARRAY! // Row params: relay pin, button pin, relay trigger [HIGH|LOW], button type [MONO_STABLE|BI_STABLE] RelayButton myRelayButtons[] = { {4, A0, HIGH, MONO_STABLE}, {5, A1, HIGH, MONO_STABLE}, {6, A2, HIGH, MONO_STABLE}, {7, A3, HIGH, MONO_STABLE}, {8, A4, HIGH, MONO_STABLE}, {9, A5, HIGH, MONO_STABLE}, {10, A6, HIGH, MONO_STABLE}, {11, A7, HIGH, MONO_STABLE}, }; const int numberOfRelayButtons = sizeof(myRelayButtons) / sizeof(RelayButton); typedef struct { int firstButton; int nextButton; } RelayMultiButtons; RelayMultiButtons relayMultiButtons[numberOfRelayButtons]; // MySensors - Sending Data // To send data you have to create a MyMessage container to hold the information. MyMessage msgs[numberOfRelayButtons]; Bounce myButtonDebouncer[numberOfRelayButtons]; // MySensors - This will execute before MySensors starts up void before() { Serial.begin(115200); #ifdef USE_EXPANDER /* Start I2C bus and PCF8574 instance */ expander0.begin(0x20); #endif // initialize multiple buttons list structure for (int i = 0; i < numberOfRelayButtons; i++) { relayMultiButtons[i].firstButton = -1; relayMultiButtons[i].nextButton = -1; } // find multiple buttons for the same relay (uni-directional list) for (int i = 0; i < numberOfRelayButtons-1; i++) { if (relayMultiButtons[i].firstButton == -1) { int prevRelayButton = i; for (int j = i+1; j < numberOfRelayButtons; j++) { if (myRelayButtons[i].relay == myRelayButtons[j].relay) { relayMultiButtons[prevRelayButton].firstButton = i; relayMultiButtons[prevRelayButton].nextButton = j; relayMultiButtons[j].firstButton = i; prevRelayButton = j; } } } } // if version has changed, reset state of all relays int versionChangeResetState = 0; if (MULTI_RELAY_VERSION != loadState(0) ) for (int i = 0; i < numberOfRelayButtons; i++) { // if this relay has multiple buttons, load only first if (relayMultiButtons[i].firstButton == -1 || relayMultiButtons[i].firstButton == i) { // Then set relay pins in output mode #ifdef USE_EXPANDER if ( myRelayButtons[i].relay >= 0x0100 ) { // EXPANDER expander0.pinMode(myRelayButtons[i].relay & 0xf, OUTPUT); } else { #endif pinMode(myRelayButtons[i].relay, OUTPUT); #ifdef USE_EXPANDER } #endif uint8_t isTurnedOn = 0; if (versionChangeResetState) { saveRelayState(i, 0); } else { // Set relay to last known state (using eeprom storage) isTurnedOn = loadRelayState(i); // 1 - true, 0 - false } uint8_t state = isTurnedOn ? myRelayButtons[i].relayTrigger : ! myRelayButtons[i].relayTrigger; digitalWrite(myRelayButtons[i].relay, state); } } } // executed AFTER mysensors has been initialised void setup() { // Setup locally attached sensors delay(5000); // Setup Relays for(int i = 0; i < numberOfRelayButtons; i++) { // if this relay has multiple buttons, send only first if (relayMultiButtons[i].firstButton == -1 || relayMultiButtons[i].firstButton == i) { msgs[i] = MyMessage(i, V_LIGHT); send(msgs[i].set(loadRelayState(i))); // send current state } } // Setup buttons for(int i = 0; i < numberOfRelayButtons; i++) { if (myRelayButtons[i].button >= 0) { // No Expander support for buttons (de-bouncing) pinMode(myRelayButtons[i].button, INPUT_PULLUP); // HIGH state when button is not pushed // After setting up the button, setup debouncer. myButtonDebouncer[i] = Bounce(); myButtonDebouncer[i].attach(myRelayButtons[i].button); myButtonDebouncer[i].interval(50); } } //presentation(); } void loop() { for(int i = 0; i < numberOfRelayButtons; i++) { if (myRelayButtons[i].button >= 0 && myButtonDebouncer[i].update()) { int buttonState = myButtonDebouncer[i].read(); #ifdef MY_DEBUG Serial.print("Button "); Serial.print(i); Serial.print(" changed to: "); Serial.println(buttonState); #endif int nextButton = (relayMultiButtons[i].firstButton == -1) ? i : relayMultiButtons[i].firstButton; if (myRelayButtons[i].buttonType == DING_DONG) { if (buttonState == LOW) { // button pressed digitalWrite(myRelayButtons[nextButton].relay, myRelayButtons[nextButton].relayTrigger); send(msgs[nextButton].set(1)); } else { // button released digitalWrite(myRelayButtons[nextButton].relay, ! myRelayButtons[nextButton].relayTrigger); send(msgs[nextButton].set(0)); } } else if (myRelayButtons[i].buttonType == BI_STABLE || buttonState == HIGH) { // If button type is BI_STABLE, any change will toggle relay state // For MONO_STABLE, button must be pushed and released (HIGH) uint8_t isTurnedOn = ! loadRelayState(nextButton); // 1 - true, 0 - false uint8_t newState = isTurnedOn ? myRelayButtons[nextButton].relayTrigger : ! myRelayButtons[nextButton].relayTrigger; digitalWrite(myRelayButtons[nextButton].relay, newState); send(msgs[nextButton].set(isTurnedOn)); // update state in eeprom for all buttons do { saveRelayState(nextButton, isTurnedOn); nextButton = relayMultiButtons[nextButton].nextButton; } while (nextButton != -1); } } } } // MySensors - Presentation // Your sensor must first present itself to the controller. // The presentation is a hint to allow controller prepare for the sensor data that eventually will come. // void present(uint8_t childSensorId, uint8_t sensorType, const char *description, bool ack); // childSensorId - The unique child id you want to choose for the sensor connected to this Arduino. Range 0-254. // sensorType - The sensor type you want to create. // description An optional textual description of the attached sensor. // ack - Set this to true if you want destination node to send ack back to this node. Default is not to request any ack. void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Multi Relay", "1.1"); // Register every relay as separate sensor for (int i = 0; i < numberOfRelayButtons; i++) { // if this relay has multiple buttons, register only first if (relayMultiButtons[i].firstButton == -1 || relayMultiButtons[i].firstButton == i) { // Register all sensors to gw (they will be created as child devices) present(i, S_BINARY); } } } // MySensors - Handling incoming messages // Nodes that expects incoming data, such as an actuator or repeating nodes, // must implement the receive() - function to handle the incoming messages. // Do not sleep a node where you expect incoming data or you will lose messages. void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type == V_STATUS) { uint8_t isTurnedOn = message.getBool(); // 1 - true, 0 - false uint8_t newState = isTurnedOn ? myRelayButtons[message.sensor].relayTrigger : ! myRelayButtons[message.sensor].relayTrigger; // Change relay state digitalWrite(myRelayButtons[message.sensor].relay, newState); // Store state in eeprom if changed if (loadRelayState(message.sensor) != isTurnedOn) { saveRelayState(message.sensor, isTurnedOn); } send(msgs[message.sensor].set(isTurnedOn)); // support for OPTIMISTIC=FALSE (Home Asistant) } } uint8_t loadRelayState(int relayNum) { return(loadState(RELAY_STATE_STORAGE + relayNum)); } void saveRelayState(int relayNum, uint8_t state) { saveState(RELAY_STATE_STORAGE + relayNum, state); }```
-
RE: Multi Button Relay Sketch
Hi
I change your sketch to working wirg serial wire gateway on my Arduino Mega 2560 but not working.
Why...
In home assistant found 4 childs number:50, 51, 52, 53 but when try change state relay by button or by Home Assistant , state relay not change. Please look.// Enable debug prints to serial monitor #define MY_DEBUG // Enable serial gateway #define MY_GATEWAY_SERIAL // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender) #if F_CPU == 8000000L #define MY_BAUD_RATE 38400 #endif // Enable debug prints to serial monitor #define MY_DEBUG #include <SPI.h> #include <MySensors.h> #include <Bounce2.h> #define RELAY_PIN0 5 // Arduino Digital I/O pin number for relay #define RELAY_PIN1 6 #define RELAY_PIN2 7 #define RELAY_PIN3 8 #define BUTTON_PIN0 A0 // Arduino Digital I/O pin number for button #define BUTTON_PIN1 A1 // Arduino Digital I/O pin number for button #define BUTTON_PIN2 A2 // Arduino Digital I/O pin number for button #define BUTTON_PIN3 A3 // Arduino Digital I/O pin number for button #define CHILD0_ID 50 // Id of the sensor child #define CHILD1_ID 51 // Id of the sensor child #define CHILD2_ID 52 // Id of the sensor child #define CHILD3_ID 53 // Id of the sensor child #define RELAY_ON 1 #define RELAY_OFF 0 Bounce debouncerA = Bounce(); Bounce debouncerB = Bounce(); Bounce debouncerC = Bounce(); Bounce debouncerD = Bounce(); int oldValueA = 0; int oldValueB = 0; int oldValueC = 0; int oldValueD = 0; bool stateA; bool stateB; bool stateC; bool stateD; MyMessage msgA(CHILD0_ID, V_LIGHT); MyMessage msgB(CHILD1_ID, V_LIGHT); MyMessage msgC(CHILD2_ID, V_LIGHT); MyMessage msgD(CHILD3_ID, V_LIGHT); void setup() { // Setup the button pinMode(BUTTON_PIN0, INPUT_PULLUP); pinMode(BUTTON_PIN1, INPUT_PULLUP); pinMode(BUTTON_PIN2, INPUT_PULLUP); pinMode(BUTTON_PIN3, INPUT_PULLUP); // After setting up the button, setup debouncer debouncerA.attach(BUTTON_PIN0); debouncerA.interval(5); debouncerB.attach(BUTTON_PIN1); debouncerB.interval(5); debouncerC.attach(BUTTON_PIN2); debouncerC.interval(5); debouncerD.attach(BUTTON_PIN3); debouncerD.interval(5); // Make sure relays are off when starting up digitalWrite(RELAY_PIN0, RELAY_OFF); digitalWrite(RELAY_PIN1, RELAY_OFF); digitalWrite(RELAY_PIN2, RELAY_OFF); digitalWrite(RELAY_PIN3, RELAY_OFF); // Then set relay pins in output mode pinMode(RELAY_PIN0, OUTPUT); pinMode(RELAY_PIN1, OUTPUT); pinMode(RELAY_PIN2, OUTPUT); pinMode(RELAY_PIN3, OUTPUT); // Set relay to last known state (using eeprom storage) stateA = loadState(CHILD0_ID); digitalWrite(RELAY_PIN0, stateA ? RELAY_ON : RELAY_OFF); stateB = loadState(CHILD1_ID); digitalWrite(RELAY_PIN1, stateB ? RELAY_ON : RELAY_OFF); stateC = loadState(CHILD2_ID); digitalWrite(RELAY_PIN2, stateC ? RELAY_ON : RELAY_OFF); stateD = loadState(CHILD3_ID); digitalWrite(RELAY_PIN3, stateD ? RELAY_ON : RELAY_OFF); } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("4 Relay & button", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD0_ID, S_LIGHT); present(CHILD1_ID, S_LIGHT); present(CHILD2_ID, S_LIGHT); present(CHILD3_ID, S_LIGHT); } /* Example on how to asynchronously check for new messages from gw */ void loop() { debouncerA.update(); // Get the update value int valueA = debouncerA.read(); if (valueA != oldValueA && valueA == 0) { send(msgA.set(stateA ? false : true), true); // Send new state and request ack back } oldValueA = valueA; debouncerB.update(); // Get the update value int valueB = debouncerB.read(); if (valueB != oldValueB && valueB == 0) { send(msgB.set(stateB ? false : true), true); // Send new state and request ack back } oldValueB = valueB; debouncerC.update(); // Get the update value int valueC = debouncerC.read(); if (valueC != oldValueC && valueC == 0) { send(msgC.set(stateC ? false : true), true); // Send new state and request ack back } oldValueC = valueC; debouncerD.update(); // Get the update value int valueD = debouncerD.read(); if (valueD != oldValueD && valueD == 0) { send(msgD.set(stateD ? false : true), true); // Send new state and request ack back } oldValueD = valueD; } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type == V_LIGHT) { switch (message.sensor) { case CHILD0_ID: stateA = message.getBool(); digitalWrite(RELAY_PIN0, stateA ? RELAY_ON : RELAY_OFF); saveState(CHILD0_ID, stateA); break; case CHILD1_ID: stateB = message.getBool(); digitalWrite(RELAY_PIN1, stateB ? RELAY_ON : RELAY_OFF); saveState(CHILD1_ID, stateB); break; case CHILD2_ID: stateC = message.getBool(); digitalWrite(RELAY_PIN2, stateC ? RELAY_ON : RELAY_OFF); saveState(CHILD2_ID, stateC); break; case CHILD3_ID: stateD = message.getBool(); digitalWrite(RELAY_PIN3, stateD ? RELAY_ON : RELAY_OFF); saveState(CHILD3_ID, stateD); break; } // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); } }```
-
RE: 💬 Security & Signing
@anticimex
But still I don't know how read serial number from Node on Arduino Mini Pro when I want use White Listening... -
RE: 💬 Security & Signing
@anticimex
OK but how I can get serial from my Node on Arduino Pro Mini?And when I want use chip AtSHA204A what I must change on my GW and on Node?
Can I build GW on Rpi with this chip AtSHA204A? -
RE: 💬 Security & Signing
Ok i removed Whitelisting and switch is show in Hoem Assistant and works.
pi@raspberrypi:~/MySensors $ sudo ./bin/mysgw -d
mysgw: Starting gateway...
mysgw: Protocol version - 2.2.0
mysgw: MCO:BGN:INIT GW,CP=RPNGLS--,VER=2.2.0
mysgw: SGN:PER:OK
mysgw: SGN:INI:BND OK
mysgw: TSF:LRT:OK
mysgw: TSM:INIT
mysgw: TSF:WUR:MS=0
mysgw: TSM:INIT:TSP OK
mysgw: TSM:INIT:GW MODE
mysgw: TSM:READY:ID=0,PAR=0,DIS=0
mysgw: MCO:REG:NOT NEEDED
mysgw: Listening for connections on 0.0.0.0:5003
mysgw: MCO:BGN:STP
mysgw: MCO:BGN:INIT OK,TSP=1
mysgw: TSF:MSG:READ,3-3-0,s=255,c=3,t=1,pt=0,l=0,sg=0:
mysgw: !SGN:VER:NSG
mysgw: !TSF:MSG:SIGN VERIFY FAIL
mysgw: TSF:MSG:READ,33-33-0,s=255,c=3,t=16,pt=0,l=0,sg=1:
mysgw: SGN:SKP:MSG CMD=3,TYPE=16
mysgw: SGN:SKP:MSG CMD=3,TYPE=17
mysgw: TSF:MSG:SEND,0-0-33-33,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
mysgw: SGN:NCE:XMT,TO=0
mysgw: TSF:MSG:READ,33-33-0,s=255,c=3,t=1,pt=0,l=0,sg=1:
mysgw: SGN:BND:NONCE=44E4127024F4EB1003DCBF3701D8469E4664CC454E2A20A257AAAAAAAAAAAAAA
mysgw: SGN:BND:HMAC=E1EE2D4046FEF0AEC323AA737A8367A2F290CCEFB7A4663448AD0B155FFD5A74
mysgw: SGN:VER:OK
mysgw: TSF:MSG:READ,33-33-0,s=1,c=3,t=16,pt=0,l=0,sg=1:
mysgw: SGN:SKP:MSG CMD=3,TYPE=16
mysgw: SGN:SKP:MSG CMD=3,TYPE=17
mysgw: TSF:MSG:SEND,0-0-33-33,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
mysgw: SGN:NCE:XMT,TO=0
mysgw: TSF:MSG:READ,33-33-0,s=1,c=1,t=2,pt=1,l=1,sg=1:0
mysgw: SGN:BND:NONCE=4AD7D9430FA96BBD0B18D4F57480F009BE31C6F3821F182766AAAAAAAAAAAAAA
mysgw: SGN:BND:HMAC=3AADB41A42B91C0B2137BE2C2C76F57E3ADB7082F3669DECCA85B993C955D36E
mysgw: SGN:VER:OK
mysgw: TSF:MSG:READ,33-33-0,s=1,c=3,t=16,pt=0,l=0,sg=1:
mysgw: SGN:SKP:MSG CMD=3,TYPE=16
mysgw: SGN:SKP:MSG CMD=3,TYPE=17
mysgw: TSF:MSG:SEND,0-0-33-33,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
mysgw: SGN:NCE:XMT,TO=0
mysgw: TSF:MSG:READ,33-33-0,s=1,c=1,t=2,pt=1,l=1,sg=1:1
mysgw: SGN:BND:NONCE=B272E537F5C6DAF21A0C5042078EFCFD3A02B5C61F698792AAAAAAAAAAAAAAAA
mysgw: SGN:BND:HMAC=5AF82BD16724069A436E0735229D32F532108A45407EF0DE7CABDADA1F7E39A0
mysgw: SGN:VER:OK
mysgw: TSF:MSG:READ,3-3-0,s=255,c=3,t=1,pt=0,l=0,sg=0:
mysgw: !SGN:VER:NSG
mysgw: !TSF:MSG:SIGN VERIFY FAIL
mysgw: TSF:MSG:READ,33-33-0,s=1,c=3,t=16,pt=0,l=0,sg=1:
mysgw: SGN:SKP:MSG CMD=3,TYPE=16
mysgw: SGN:SKP:MSG CMD=3,TYPE=17
mysgw: TSF:MSG:SEND,0-0-33-33,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
mysgw: SGN:NCE:XMT,TO=0
mysgw: TSF:MSG:READ,33-33-0,s=1,c=1,t=2,pt=1,l=1,sg=1:0
mysgw: SGN:BND:NONCE=61F78D66E675349B8A63B1370E81D2D1AB44BC1D0BB1F988D6AAAAAAAAAAAAAA
mysgw: SGN:BND:HMAC=04EEE2B60E0C71CC092E13C68C07F3088D66F264A826C23426053C17C2353DED
mysgw: SGN:VER:OK
mysgw: TSF:MSG:READ,33-33-0,s=1,c=3,t=16,pt=0,l=0,sg=1:
mysgw: SGN:SKP:MSG CMD=3,TYPE=16
mysgw: SGN:SKP:MSG CMD=3,TYPE=17
mysgw: TSF:MSG:SEND,0-0-33-33,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
mysgw: SGN:NCE:XMT,TO=0
mysgw: TSF:MSG:READ,33-33-0,s=1,c=1,t=2,pt=1,l=1,sg=1:1
mysgw: SGN:BND:NONCE=627FAEEEFFFD6E55F371C07A54F785FDA3EE52EBD4092E0CE9AAAAAAAAAAAAAA
mysgw: SGN:BND:HMAC=65503227CDB04C1A2DCB03D0E5BAFD35A4EBA956E8EBA917B2DF40FB09520092
mysgw: SGN:VER:OK
mysgw: TSF:MSG:READ,33-33-0,s=1,c=1,t=2,pt=1,l=1,sg=1:1
mysgw: !SGN:BND:VER ONGOING
mysgw: !SGN:VER:FAIL
mysgw: !TSF:MSG:SIGN VERIFY FAIL
mysgw: TSF:MSG:READ,33-33-0,s=255,c=3,t=16,pt=0,l=0,sg=1:
mysgw: SGN:SKP:MSG CMD=3,TYPE=16
mysgw: SGN:SKP:MSG CMD=3,TYPE=17
mysgw: TSF:MSG:SEND,0-0-33-33,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
mysgw: SGN:NCE:XMT,TO=0
mysgw: TSF:MSG:READ,33-33-0,s=255,c=3,t=1,pt=0,l=0,sg=1:
mysgw: SGN:BND:NONCE=32CE07784E14ED2B6D455C2C5C4D83E025185970838C0B743AAAAAAAAAAAAAAA
mysgw: SGN:BND:HMAC=F04885315D93DB7FC95F3B190D68009055495ECEE698E0ADF6F50292157A8927
mysgw: SGN:VER:OK
mysgw: TSF:MSG:READ,33-33-0,s=1,c=3,t=16,pt=0,l=0,sg=1:
mysgw: SGN:SKP:MSG CMD=3,TYPE=16
mysgw: SGN:SKP:MSG CMD=3,TYPE=17
mysgw: TSF:MSG:SEND,0-0-33-33,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
mysgw: SGN:NCE:XMT,TO=0
mysgw: TSF:MSG:READ,33-33-0,s=1,c=1,t=2,pt=1,l=1,sg=1:0
mysgw: SGN:BND:NONCE=3DAAB19C10BB3CB8A08CDAACED4BFB385F1EB22AA9F926F940AAAAAAAAAAAAAA
mysgw: SGN:BND:HMAC=392AB4EAFDE59AC0CC9BE6EE667FC33A69A33E86AD5CB3EC49C6C114722941F5
mysgw: SGN:VER:OK
mysgw: TSF:MSG:READ,33-33-0,s=1,c=3,t=16,pt=0,l=0,sg=1:
mysgw: SGN:SKP:MSG CMD=3,TYPE=16
mysgw: SGN:SKP:MSG CMD=3,TYPE=17
mysgw: TSF:MSG:SEND,0-0-33-33,s=255,c=3,t=17,pt=6,l=25,sg=1,ft=0,st=OK:<NONCE>
mysgw: SGN:NCE:XMT,TO=0
mysgw: TSF:MSG:READ,33-33-0,s=1,c=1,t=2,pt=1,l=1,sg=1:1
mysgw: SGN:BND:NONCE=CF101801DA5324E2F66C3B9350E8FC2BCCBD337E3F588EBE2FAAAAAAAAAAAAAA
mysgw: SGN:BND:HMAC=53795E79C8FE9D599D1A88363F7E2BA607ADBB265E4E99356886B65C3D0A06D0
mysgw: SGN:VER:OK
mysgw: TSF:MSG:READ,3-3-0,s=255,c=3,t=1,pt=0,l=0,sg=0:
mysgw: !SGN:VER:NSG
mysgw: !TSF:MSG:SIGN VERIFY FAIL -
RE: 💬 Security & Signing
In my first time I use only serial number gateway in flag whitelistening and also not working.
-
RE: 💬 Security & Signing
@anticimex
Ok read... but...
when i use MY_SIGNING_NODE_WHITELISTING i must on node in sketch add serial number my gateway and also serial number for node. But from where i can get serial number for my arduino pro mini ? I dont know...becasue i don use ATSHA204 but i use only soft signing.... -
RE: 💬 Security & Signing
HI
i don as describe...- install gateway on raspberry with this configuration:
./configure --my-transport=rfm69 --my-rfm69-frequency=868 --my-is-rfm69hw --my-gateway=ethernet --my-port=5003 --my-leds-err-pin=12 --my-leds-rx-pin=16 --my-leds-tx-pin=18 --my-signing=software --my-signing-request-signatures --my-signing-weak_security --my-signing-debug
and then generate serial, aes and hmac
pi@raspberrypi:~/MySensors $ sudo mysgw --gen-soft-serial-key
SOFT_SERIAL | 8FC828503E6EB14C5DThe next line is intended to be used in SecurityPersonalizer.ino:
#define MY_SOFT_SERIAL 0X8F,0XC8,0X28,0X50,0X3E,0X6E,0XB1,0X4C,0X5DTo use this key, run mysgw with:
--set-soft-serial-key=8FC828503E6EB14C5D
pi@raspberrypi:~/MySensors $ sudo mysgw --gen-soft-hmac-key
SOFT_HMAC_KEY | 0D682ED05106E5F361C64288D68AAE1B34F5FFB62B4E39773C9D92DED04B6514The next line is intended to be used in SecurityPersonalizer.ino:
#define MY_SOFT_HMAC_KEY 0XD,0X68,0X2E,0XD0,0X51,0X6,0XE5,0XF3,0X61,0XC6,0X42,0X88,0XD6,0X8A,0XAE,0X1B,0X34,0XF5,0XFF,0XB6,0X2B,0X4E,0X39,0X77,0X3C,0X9D,0X92,0XDE,0XD0,0X4B,0X65,0X14To use this key, run mysgw with:
--set-soft-hmac-key=0D682ED05106E5F361C64288D68AAE1B34F5FFB62B4E39773C9D92DED04B6514
pi@raspberrypi:~/MySensors $ sudo mysgw --gen-aes-key
AES_KEY | 8FDB1EE8D0351CFF874D337731BF37AEThe next line is intended to be used in SecurityPersonalizer.ino:
#define MY_AES_KEY 0X8F,0XDB,0X1E,0XE8,0XD0,0X35,0X1C,0XFF,0X87,0X4D,0X33,0X77,0X31,0XBF,0X37,0XAETo use this key, run mysgw with:
--set-aes-key=8FDB1EE8D0351CFF874D337731BF37AE
pi@raspberrypi:~/MySensors $and setup it on my gateway
sudo mysgw --set-soft-serial-key=8FC828503E6EB14C5D && sudo mysgw --set-aes-key=8FDB1EE8D0351CFF874D337731BF37AE && sudo mysgw --set-soft-hmac-key=0D682ED05106E5F361C64288D68AAE1B34F5FFB62B4E39773C9D92DED04B6514
all is ok to this moment
Then
- clear eeprom in node Arduino pro mini with this sketch:
https://github.com/sineverba/domoraspi/tree/master/utils/sketches - write sketch security with setup my serial, aes and hmac
https://github.com/sineverba/domoraspi/tree/master/utils/sketches
at the top setup...
/************************************ User defined key data ***************************************//** @brief The user-defined HMAC key to use unless @ref GENERATE_HMAC_KEY is set */
//#define MY_HMAC_KEY 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
#define MY_HMAC_KEY 0XD,0X68,0X2E,0XD0,0X51,0X6,0XE5,0XF3,0X61,0XC6,0X42,0X88,0XD6,0X8A,0XAE,0X1B,0X34,0XF5,0XFF,0XB6,0X2B,0X4E,0X39,0X77,0X3C,0X9D,0X92,0XDE,0XD0,0X4B,0X65,0X14/** @brief The user-defined AES key to store in EEPROM unless @ref GENERATE_AES_KEY is set */
//#define MY_AES_KEY 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
#define MY_AES_KEY 0X8F,0XDB,0X1E,0XE8,0XD0,0X35,0X1C,0XFF,0X87,0X4D,0X33,0X77,0X31,0XBF,0X37,0XAE/** @brief The user-defined soft serial to use for soft signing unless @ref GENERATE_SOFT_SERIAL is set */
#define MY_SOFT_SERIAL 0X8F,0XC8,0X28,0X50,0X3E,0X6E,0XB1,0X4C,0X5D/***************************** Flags for guided personalization flow ******************************/
- then write my sketch relay with added at the top this info:
#define MY_SIGNING_SOFT
#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
#define MY_SIGNING_REQUEST_SIGNATURES
#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0X8F,0XC8,0X28,0X50,0X3E,0X6E,0XB1,0X4C,0X5D}}} // got from gateway setupand now on my Home assistant in file
/home/homeassistant/.homeassistant/mysensors.jsonfound my node but wthout full information like name....
{
"0": {
"battery_level": 0,
"sketch_name": null,
"sketch_version": null,
"children": {},
"type": 18,
"protocol_version": "2.2.0",
"sensor_id": 0
},
"33": {
"battery_level": 0,
"sketch_name": null,
"sketch_version": "1.0",
"children": {
"1": {
"type": 3,
"id": 1,
"values": {
"2": "1"
},
"description": ""
}
},
"type": 17,
"protocol_version": "2.2.0",
"sensor_id": 33
}
}and in Home Assistant is not show in devices this node. Not found it.
What i done wrong ? - install gateway on raspberry with this configuration:
-
RE: MySensors 2.3.0 released
With released 2.3.0 is many problem with communication on radio RFM69HW. On 2.2.0 this problem is no available.
-
RE: 💬 Security & Signing
What flag i must remove ?
This :
#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0X2C,0X61,0X17,0X2E,0XEE,0XDD,0XCC,0XBB,0XAA}}} // got from gateway setupBut on GW i setup this:
sudo mysgw --set-soft-serial-key=2C61172EEEDDCCBBAA && sudo mysgw --set-aes-key=9D2AD43CF909875C4C77111111111111 && sudo mysgw --set-soft-hmac-key=A2A64C48EA6765C5DAEFA12A1E41E2F038515A9CAED9FED73D11111111111111 -
RE: 💬 Security & Signing
@anticimex
What you mean white list?Before adding all security my nodes and gateway works perfect.
-
RE: 💬 Security & Signing
Ok i build my gateway on RPI on MySensors 2.2.0 with this configuration:
./configure --my-transport=rfm69 --my-rfm69-frequency=868 --my-is-rfm69hw --my-gateway=ethernet --my-port=5003 --my-signing=software --my-signing-request-signatures
Then generate 3 key and setup it on gateway.
Then clear_epprom on Arduino MIni Pro, and then send sketch security with add serial, HMAC, and AES. Then put sketch with add this on top sketch with my SERIAL generated on gateway RPI.
#define MY_SIGNING_SOFT
#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
#define MY_SIGNING_REQUEST_SIGNATURES
#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0X2C,0X61,0X17,0X2E,0XEE,0XDD,0XCC,0XBB,0XAA}}} // got from gateway setupAfter that i run HA and he not found my nodes...
WHat is wrondg ? -
RE: 💬 Security & Signing
@sineverba
ok all is very good.But what give me this if i can connect nodes also with defines bla bla bla in skethc and also without define bla bla bla in sketch?
But Do I think right ? In each of these accidents in the eeprom I need to have the keys loaded? -
RE: 💬 Security & Signing
Can you share me this document when is describe how define only pass ? I want also read this.
-
RE: 💬 Security & Signing
@sineverba said in Security & Signing:
setup gateway with weak security.
But when configure my gateway without flag setup gateway with weak security i can only use nodes with setup in sketches keys. yes ?
-
RE: 💬 Security & Signing
Ok summary
When i have setup on Raspberry Gateway , generate keys.When i write in node all keys with sketches.... Node connect ok.
But when write to node only sketches without keys.,... node connect to gateway or not connect to gateway ?
-
RE: 💬 Security & Signing
@sineverba said in Security & Signing:
no need to remove. Simply, in your sketches, don't use signing at all.
ok but if on gateway it was generate and setup keys and when in skethces i dont use keys will nody connect? and what the purpose of the signature is then ?
I thought that if the gate has a set of keys and will try to connect noda without a key that it will not connect .... -
RE: 💬 Security & Signing
@sineverba I also have the same problem with communication. But tell me you send issue to developer ? I send but nothing done.
Ok in point 4 in your guide in sketch for node i must put serial key from gateway ? Yes ?
And tell me how remove setup serial, HMAC and AES when i dont want to use it ? How remove it from gateway ?
Thanks -
RE: 💬 Security & Signing
@sineverba
Hi
Yes i use radio RFM69HW. I also on 2.3.0 have big problem... and back to 2.2.0. What you have problem on 2.3.0 with radio RFM69 ?I read all your guide and it is ok. But i dont know what i must put in place:
#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0Xaa,0Xbb,0Xcc,0XF9,0X82,0XB2,0X50,0XF2,0XAB}}} // got from gateway setupPut serial from this:
sudo mysgw --gen-soft-serial-keyWe will get:
SOFT_SERIAL | 7850987FA6601F6538
The next line is intended to be used in SecurityPersonalizer.ino:
#define MY_SOFT_SERIAL 0X78,0X50,0X98,0X7F,0XA6,0X60,0X1F,0X65,0X38To use this key, run mysgw with:
--set-soft-serial-key=7850987FA6601F6538And i must put my keys to mysensors.conf when i use version 2.2.0 ? Or only when use 2.3.0 ?
Software signing settings
Note: The gateway must have been built with signing
support to use the options below.
To generate a HMAC key run mysgw with: --gen-soft-hmac-key
copy the new key in the line below and uncomment it.
#soft_hmac_key=To generate a serial key run mysgw with: --gen-soft-serial-key
copy the new key in the line below and uncomment it.
#soft_serial_key=Encryption settings
Note: The gateway must have been built with encryption
support to use the options below.
To generate a AES key run mysgw with: --gen-aes-key
copy the new key in the line below and uncomment it.
#aes_key=or only send command
sudo mysgw --set-soft-serial-key=7850987FA6601F6538 && sudo mysgw --set-aes-key=768859210B4A75FACC78B757ADAFE75B && sudo mysgw --set-soft-hmac-key=0298FF121DD3194BCC33DC8185055B9D981EBE0A90D847A4777A9E65CCE4F524 ?
-
RE: 💬 Security & Signing
@sineverba
Very very good manuals...
But i dont understand what i must type number in this placeand how get it ? It is MAC number network from RPI ?:#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0Xaa,0Xbb,0Xcc,0XF9,0X82,0XB2,0X50,0XF2,0XAB}}} // got from gateway setup
And what is diffrent with MySensors 2.3.0 ?
I must do all point from MySensors 2.2.0 and additional point for 2.3.0 ?After got your ./configure instruction, type
sudo nano /etc/mysensors.conf
And add your KEYs to the specific section on bottom of the file.
To get your first KEYs follow guide for 2.2.0And in version 2.3.0 i must do this under building gateway ?
And add serial,HMAC,AES in this place in mysensors.conf
Software signing settings
Note: The gateway must have been built with signing
support to use the options below.
To generate a HMAC key run mysgw with: --gen-soft-hmac-key
copy the new key in the line below and uncomment it.
#soft_hmac_key=
To generate a serial key run mysgw with: --gen-soft-serial-key
copy the new key in the line below and uncomment it.
#soft_serial_key=
Encryption settings
Note: The gateway must have been built with encryption
support to use the options below.
To generate a AES key run mysgw with: --gen-aes-key
copy the new key in the line below and uncomment it.
#aes_key=
and then build gateway ?
-
RE: 💬 Security & Signing
@anticimex
But please show me as you have to have example... -
RE: 💬 Security & Signing
Can you show me full manual how implement it on Gateway on RPI and how add this to sketch on nodes ? Please...
If you can describe me very good. I am begginer... -
RE: 💬 Security & Signing
@anticimex
I don't understand. I want secure my nodes... By Atsha204a. How I can secure it by other solution. -
RE: 💬 Security & Signing
Hi
I have a gateway mysensors on my RPI3 with radio RFM69HW. Is any chance to build gateway on RPI3 but also with chip ATSHA204A ? And how build it... -
RE: 💬 Button size radionode with sensors swarm extension
@koresh said in Button size radionode with sensors swarm extension:
You mixed gerbers of the main board and adapter board.
Can you explaine me more ? What can i do ?
-
RE: 💬 Button size radionode with sensors swarm extension
Please share also layer describe...
Failed load project to production.
-
RE: 💬 Button size radionode with sensors swarm extension
Description to model elemnts. Ex. U4
-
RE: 💬 Button size radionode with sensors swarm extension
Hi
Can you share your project file and file gerber with this specification
https://support.jlcpcb.com/article/44-how-to-export-kicad-pcb-to-gerber-filesOr can you put description to also file gerber ?
Thanks -
RE: 💬 Button size radionode with sensors swarm extension
Ok thanks. only wait for list component
-
RE: 💬 Button size radionode with sensors swarm extension
Ok please share list components... i wait for it.
And diffrent with v1 and v2 is only that v2 have two batteries ? -
RE: 💬 Button size radionode with sensors swarm extension
But v2 is also for radio RFM69HW ?
-
RE: 💬 Button size radionode with sensors swarm extension
But please share a list element what capacity and resistor and other and with what body. Ex 0805 etc.
But for programming i dont need push/wire RST with GND ?
Explaine me how works Programming is activated via DTR pin automatically ??
And what is ButtonSizeNode_V2 (with dc-dc) ?? What is diffrent to v1 ?
-
RE: 💬 Button size radionode with sensors swarm extension
And anybody what pin should be wire to activate programming... ? In arduino pro mini is dedicated micro switch. In this dont have microswitch and i want add microswitch. It should be RST connected to GND ? please help...
-
RE: 💬 Button size radionode with sensors swarm extension
And what is size gold pins ? 2.54 ?
-
RE: 💬 Button size radionode with sensors swarm extension
Can you share elemnts for version RFM69HW ? I see only PCB files but i dont know whatr i must have elements...
-
RE: RFM69 new driver delay
Ok tested as show in previus post. And the same problem. Maybe a little better. But maybe no...
On 2.2.0 is a very very better. -
RE: RFM69 new driver delay
Should looks like this ?
if (isMoving) { unsigned long _now = millis(); if (_now - lastLevelTime >= timeOneLevel * 1000) { if (directionUpDown == DIRECTION_UP) { currentShutterLevel += 1; } else { currentShutterLevel -= 1; } currentShutterLevel = constrain(currentShutterLevel, 0, 100); #ifdef MY_DEBUG Serial.println(String(requestedShutterLevel)); Serial.println(String(currentShutterLevel)); #endif lastLevelTime = millis(); if (currentShutterLevel % 5 == 0) send(msgPercentage.set(currentShutterLevel)); // change 5 by 10 if you want to send each 10% for example```
-
RE: RFM69 new driver delay
Sorry but i dont know what line chage with this your line
if (currentShutterLevel % 5 == 0) send(msgPercentage.set(currentShutterLevel)); // change 5 by 10 if you want to send each 10% for example```
-
RE: RFM69 new driver delay
@scalz
Hmmm
I am not advanced user. This sketch i found on github from other user. I can change sometinh in sketch to test it ? Can you help me what change in sketch to test ? -
RE: RFM69 new driver delay
@mickecarlsson said in RFM69 new driver delay:
MY_RADIO_RFM69 -DMY_RFM69_NEW_DRIVER -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_RFM69_FREQUENCY=RFM69_868MHZ -DMY_IS_RFM69HW
LDFLAGS=-pthreadMy defined is the same:
SOC=BCM2837 CPPFLAGS=-march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_RFM69 -DMY_RFM69_NEW_DRIVER -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_DEFAULT_TX_LED_PIN=18 -DMY_DEFAULT_RX_LED_PIN=16 -DMY_DEFAULT_ERR_LED_PIN=12 -DMY_PORT=5003 -DMY_IS_RFM69HW -DMY_RFM69_FREQUENCY=RFM69_868MHZ LDFLAGS=-pthread PREFIX=/usr/local CC=gcc CXX=g++ BUILDDIR=build BINDIR=bin GATEWAY_DIR=/usr/local/bin INIT_SYSTEM=systemd SPI_DRIVER=BCM
-
RE: RFM69 new driver delay
@mickecarlsson
You dont have issue becuase temp/hum send data from time to time every defined time.
My sketch with relay also looks that works ok.
But problem is on sketch with relay to control covers. WHen cover roll node send still data and it is problem...
This is my opinion. -
RE: RFM69 new driver delay
Ok thanks. WAiting for info... and good info for me will be that problem with RFM69HW on version 2.3.0 will be resolve and i can update to this version. Now i must come back to version 2.2.0
-
RE: MySensors 2.3.0 released
Version 2.3.0 has very big problem with communication on radio RFM69HW.
On version 2.2.0 the same configuration and parameters has no problem. Works perfect.Now i can not use 2.3.0 with RFM69HW. Please help and correct this problem.
I use gateway on RPI3. I updated gateway to 2.3.0 but it no working with nodes with version 2.3.0
Also problem is when on Gateway and Nodes has the same version 2.3.0For me on radio RFM69HW only works correct on version 2.2.0
-
RE: RFM69 new driver delay
ANd tell me how you connect Gateway to your Domoticz Controller ? What path to usb or serial you setup in Domoticz ?
-
RE: RFM69 new driver delay
Finally
In my opinion on MySensors 2.2.0 all my sketches (switch relay and cover ) works better. With no problem. NO PROBLEM.
Cover works perfect and switch works perfect without any timeout and delay. ANd all node works without REPEATER.
My opinion is that in version 2.3.0 something not working correct with radio RFM69HW.
Maybe for sensors which send data from time to time is ok , but for cover which transfer data when cover is roll, it is problem... and gateway can not recived all data when node send position cover. Maybe developer read this thread and can do any changes to correct it.