Yes, that worked... I downloaded master.zip and replaced the current Liquid Crystal folder with the new one. Restarted IDE and was able to compile and upload the sketch. Thank you!
mrhutchinsonmn
@mrhutchinsonmn
Best posts made by mrhutchinsonmn
-
RE: MySensors_Sprinkler:174: error: 'POSITIVE' was not declared in this scope
-
RE: [Solved] Getting Arduino IDE error with Relay Actuator sketch
@tekka I moved the library and reinstalled. The sketch works now. Thank you for pointing me in the right direction!
-
RE: What parts would be needed for timer with light panel indicator
Here is my first prototype of a working solution for a timing light: ( neopixal timing light):https://youtu.be/b3TDGKUS05I
Thank you for direction @mfalkvidd !
-
RE: [SOLVED] NRF24L01 Radio Fails connecting to Gateway
Thank you for your reply. I did resolve the problem and wanted to share what I did, in hopes of helping other newbies.
Firstly, I double checked the wiring, compared it to the working gateway and it seemed to be fine but still did not work.I ran across this post and it turned out to be ideal for my situation:
https://forum.arduino.cc/index.php?topic=421081.0Got the two radios communicating in a simplistic configuration and once working, uploaded mysensors sketches and the radios continued to work correctly. Maybe dismantling and reconnecting was the fix. Not sure, but things are working now. Thank you for a great resource of information and projects!
-
Is the moisture sensor build doc accurate
I am attempting to set up a moisture sensor, using the diagram and included sketch (https://www.mysensors.org/build/moisture). The diagram shows pin 3 for data but the sketch references d6 and d7. I don't see any reference to pin 3 there. I am not clear why there are references to d6 and d7 when my sensor only has a single data pin.
-
RE: Best sensor for falling alert
@bjacobse That seems to be the ticket! I will update the project as I learn more and develop a prototype.
-
RE: Relay shows up in mysensors.json but not in gui [homeassistant]
Version 0.94.4
Thank you for the recommendation. I learned to look there through trial-and-error but the relay does not show up.
However, everything works as expected (4 relays show up in Unused Entities) when I use the following sketch:
Copy to clipboard // Override Setting for Manual Node ID to 2 #define MY_NODE_ID 2 // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 // Enable repeater functionality for this node #define MY_REPEATER_FEATURE #include <SPI.h> #include <MySensors.h> #define RELAY_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 4 // Total number of attached relays: 4 // Opto Relay Module I was using Active Low - Low (0):ON, High (1): OFF #define RELAY_ON 0 // GPIO value to write to turn on attached relay #define RELAY_OFF 1 // GPIO value to write to turn off attached relay bool initialValueSent = false; //Init MyMessage for Each Child ID MyMessage msg1(1, V_LIGHT); MyMessage msg2(2, V_LIGHT); MyMessage msg3(3, V_LIGHT); MyMessage msg4(4, V_LIGHT); void before() { for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) { // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); } } void setup() { } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Relay", "1.0"); for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_LIGHT); } } void loop() { if (!initialValueSent) { Serial.println("Sending initial value"); send(msg1.set(loadState(1)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg2.set(loadState(2)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg3.set(loadState(3)?RELAY_OFF:RELAY_ON),true); wait(1000); send(msg4.set(loadState(4)?RELAY_OFF:RELAY_ON),true); wait(1000); Serial.println("Sending initial value: Completed"); wait(5000); } } void receive(const MyMessage &message) { Serial.println("=============== Receive Start ======================="); if (message.isAck()) { Serial.println(">>>>> ACK <<<<<"); Serial.println("This is an ack from gateway"); Serial.println("<<<<<< ACK >>>>>>"); } // We only expect one type of message from controller. But we better check anyway. if (message.type==V_LIGHT) { Serial.println(">>>>> V_LIGHT <<<<<"); if (!initialValueSent) { Serial.println("Receiving initial value from controller"); initialValueSent = true; } // Update relay state to HA digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF); switch (message.sensor) { case 1: Serial.print("Incoming change for sensor 1"); send(msg1.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 2: Serial.print("Incoming change for sensor 2"); send(msg2.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 3: Serial.print("Incoming change for sensor 3"); send(msg3.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; case 4: Serial.print("Incoming change for sensor 4"); send(msg4.set(message.getBool()?RELAY_OFF:RELAY_ON)); break; default: Serial.println("Default Case: Receiving Other Sensor Child ID"); break; } // Store state in Arduino eeprom saveState(message.sensor, message.getBool()); Serial.print("Saved State for sensor: "); Serial.print( message.sensor); Serial.print(", New status: "); Serial.println(message.getBool()); Serial.println("<<<<<< V_LIGHT >>>>>>"); } Serial.println("=============== Receive END ======================="); }```
-
RE: Looking for esp8266 moisture sensor sketch that works with current libraries
@mfalkvidd was part of the sketch. I could see right away that sleep did not work
-
RE: New ethernet gateway errors out on Home Assistant
Much appreciated!
This is what I ended up with for a working config:
automation: !include 'automations.yaml' default_config: ~ group: !include 'groups.yaml' scene: !include 'scenes.yaml' script: !include 'scripts.yaml' mysensors: gateways: - device: '/dev/ttyUSB0' persistence_file: 'mysensors1.pickle' - device: '10.10.1.69' persistence_file: 'mysensors2.pickle' tcp_port: 5003 optimistic: false persistence: true retain: true version: '2.3'
-
RE: Best sensor for falling alert
Apologies!! I kept getting errors when using that board, so used another. I am on a new worksation and it turns out python was not installed. The error ceased after I installed. The sketch works fine now.
Latest posts made by mrhutchinsonmn
-
RE: Relay device not showing up in HA but does in .json
@cabat Thank you! Apparently, the MySensors sketch supplied in the Build section is not written to work with HA. I did take a stab at it and pop some code in the loop section, and the sensor now shows up but is not functional. I will have to dig more and determine what should be added to the sketch for it to work.
Thanks much for the pointer.
-
Relay device not showing up in HA but does in .json
I have the following relay device that shows up in the .json file of HA, but will not appear on the dashboard as an available device. Guessing it doesn't like something about the sketch, but not sure what that might be.
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. * ******************************* * * REVISION HISTORY * Version 1.0 - Henrik Ekblad * * DESCRIPTION * Example sketch showing how to control physical relays. * This example will remember relay state after power failure. * http://www.mysensors.org/build/relay */ // 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 // Enable repeater functionality for this node #define MY_REPEATER_FEATURE #define MY_NODE_ID 100 #include <MySensors.h> #define RELAY_PIN 2 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #define NUMBER_OF_RELAYS 1 // Total number of attached relays #define RELAY_ON 1 // GPIO value to write to turn on attached relay #define RELAY_OFF 0 // GPIO value to write to turn off attached relay void before() { for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF); } } void setup() { } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Relay", "1.0"); for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) present(sensor, S_BINARY); } } void loop() { } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.getType()==V_STATUS) { // Change relay state digitalWrite(message.getSensor()-1+RELAY_PIN, message.getBool()?RELAY_ON:RELAY_OFF); // Store state in eeprom saveState(message.getSensor(), message.getBool()); // Write some debug info Serial.print("Incoming change for sensor:"); Serial.print(message.getSensor()); Serial.print(", New status: "); Serial.println(message.getBool()); } }
.json file:
{ "0": { "sensor_id": 0, "children": {}, "type": 18, "sketch_name": null, "sketch_version": null, "battery_level": 0, "protocol_version": "2.3.2", "heartbeat": 0 }, "100": { "sensor_id": 100, "children": { "1": { "id": 1, "type": 3, "description": "", "values": {} } }, "type": 18, "sketch_name": "Relay", "sketch_version": "1.0", "battery_level": 0, "protocol_version": "2.3.2", "heartbeat": 0 }
-
make erring out on raspberry pi 2 b
I am attempting to set up homeassistant with a mysensors ethernet gateway on the same raspberry pi 2 b. However, make is erring out. Do I need an older mysensors library?
[SECTION] Detecting target machine. [OK] machine detected: SoC=BCM2835, Type=rpi1, CPU=armv7l. [SECTION] Detecting SPI driver. [OK] SPI driver detected:BCM. [SECTION] Gateway configuration. [OK] Type: ethernet. [OK] Transport: rf24. [OK] Signing: Disabled. [OK] Encryption: Disabled. [OK] CPPFLAGS: -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_PORT=5003 [OK] CXXFLAGS: -std=c++11 [SECTION] Detecting init system. [OK] Init system detected: systemd. [SECTION] Saving configuration. [OK] Saved. [SECTION] Cleaning previous builds. [OK] Finished. root@rpi2-20230102:~/MySensors# ^C root@rpi2-20230102:~/MySensors# ^C root@rpi2-20230102:~/MySensors# make gcc -MT build/hal/architecture/Linux/drivers/core/config.o -MMD -MP -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_PORT=5003 -Ofast -g -Wall -Wextra -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/config.c -o build/hal/architecture/Linux/drivers/core/config.o In file included from /usr/include/stdio.h:864, from hal/architecture/Linux/drivers/core/config.c:23: /usr/include/arm-linux-gnueabihf/bits/stdio.h: In function 'vprintf': /usr/include/arm-linux-gnueabihf/bits/stdio.h:40:1: sorry, unimplemented: Thumb-1 hard-float VFP ABI 40 | { | ^ make: *** [Makefile:103: build/hal/architecture/Linux/drivers/core/config.o] Error 1
-
RE: Possible to have an external power source for moisture sensors??
@mfalkvidd I was looking at it through the perspective of my 8 channel relay which needs an external power source to work reliably. Seems 6 moisture sensors will work fine.
-
RE: Possible to have an external power source for moisture sensors??
@mrhutchinsonmn Did some more research. It seems it is possible to run all 6 sensors on a single board without a 2nd power source since readings are not taken simultaneously. Is that a correct assertation?
-
Possible to have an external power source for moisture sensors??
I want to run 6 analog moisture sensors on a single arduino nano(if possible). I am guessing that may cause erratic behavior from power issues. Is there a way to use an external power source and still provide a connection to the nano, like is done with a jd-vcc pin on my 8 channel relay, so the sensor will work correctly?
-
Contributions
Is there a way to contribute to mysensors tutorials, example sketches, etc? In my experience, I have found some tutorials to be limited, vague, or missing information that would be helpful to a novice, such as myself. For example: currently, I am learning RS485 and have a working moisture sensor sketch I would like to contribute that may be helpful to someone else. Is there a corner for such contributions?
-
RE: Motion Sensor not presenting to RS485 Gateway / TSM:FPAR:NO REPLY
@electrik Yes... that worked!!! Moved node and child id above mysensors.h
Thank you!!!!
-
RE: Motion Sensor not presenting to RS485 Gateway / TSM:FPAR:NO REPLY
@rejoe2 In research, some stated it needed to be there if the sensor did not present itself. Followed @electrik advice and it now works. Thank you for your feedback!
-
RE: Motion Sensor not presenting to RS485 Gateway / TSM:FPAR:NO REPLY
Thank you for the advice!
I started over, just to be sure I didn't have anymore mix ups, but still have not been able to get the RS485 motion sensor and RS485 gateway to talk.
Hardware: Arduino Nanos+ RS485 modules.
Wiring:
RO = Pin 8 of Arduino
DI = Pin 9 of Arduino
A = A on other Nano
B = B on other Nano
DI= Pin 9 of Nano
RO = Pin 8 of Nano
DE & RE = Pin 2 of Nano
VCC = External power source
GND = External power sourceCurrent Gateway 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 RS485 Gateway prints data received from sensors on the serial link. * The gateway accepts input on seral which will be sent out on * the RS485 link. * * Wire connections (OPTIONAL): * - Inclusion button should be connected between digital pin 3 and GND * - RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series * * LEDs (OPTIONAL): * - RX (green) - blink fast on radio message received. In inclusion mode will blink fast only on presentation received * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly * - ERR (red) - fast blink on error during transmission error or receive crc error * * If your Arduino board has additional serial ports * you can use to connect the RS485 module. * Otherwise, the gateway uses AltSoftSerial to handle two serial * links on one Arduino. Use the following pins for RS485 link * * Board Transmit Receive PWM Unusable * ----- -------- ------- ------------ * Teensy 3.0 & 3.1 21 20 22 * Teensy 2.0 9 10 (none) * Teensy++ 2.0 25 4 26, 27 * Arduino Uno 9 8 10 * Arduino Leonardo 5 13 (none) * Arduino Mega 46 48 44, 45 * Wiring-S 5 6 4 * Sanguino 13 14 12 * */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable RS485 transport layer #define MY_RS485 // Define this to enables DE-pin management on defined pin #define MY_RS485_DE_PIN 2 // Set RS485 baud rate to use #define MY_RS485_BAUD_RATE 9600 // Enable this if RS485 is connected to a hardware serial port //#define MY_RS485_HWSERIAL Serial // Enable serial gateway #define MY_GATEWAY_SERIAL // Enable inclusion mode #define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway #define MY_INCLUSION_BUTTON_FEATURE // 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 // Flash leds on rx/tx/err #define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin #define MY_DEFAULT_RX_LED_PIN 5 // Receive led pin #define MY_DEFAULT_TX_LED_PIN 6 // the PCB, on board LED #include <MySensors.h> void setup() { // Setup locally attached sensors } void presentation() { // Present locally attached sensors } void loop() { // Send locally attached sensor data here }
Current Motion Detector 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. * ******************************* * * REVISION HISTORY * Version 1.0 - Henrik Ekblad * * DESCRIPTION * This is an example of sensors using RS485 as transport layer * * Motion Sensor example using HC-SR501 * http://www.mysensors.org/build/motion * * If your Arduino board has additional serial ports * you can use to connect the RS485 module. * Otherwise, the transport uses AltSoftSerial to handle two serial * links on one Arduino. Use the following pins for RS485 link * * Board Transmit Receive PWM Unusable * ----- -------- ------- ------------ * Teensy 3.0 & 3.1 21 20 22 * Teensy 2.0 9 10 (none) * Teensy++ 2.0 25 4 26, 27 * Arduino Uno 9 8 10 * Arduino Leonardo 5 13 (none) * Arduino Mega 46 48 44, 45 * Wiring-S 5 6 4 * Sanguino 13 14 12 * * */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable RS485 transport layer #define MY_RS485 // Define this to enables DE-pin management on defined pin #define MY_RS485_DE_PIN 2 // Set RS485 baud rate to use #define MY_RS485_BAUD_RATE 9600 // Enable this if RS485 is connected to a hardware serial port //#define MY_RS485_HWSERIAL Serial1 #include <MySensors.h> uint32_t SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds) #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!) #define MY_NODE_ID 12 #define CHILD_ID 1 // Id of the sensor child // Initialize motion message MyMessage msg(CHILD_ID, V_TRIPPED); void setup() { pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Motion Sensor", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID, S_MOTION); } void loop() { // Read digital motion value bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; Serial.println(tripped); send(msg.set(tripped?"1":"0")); // Send tripped value to gw // Sleep until interrupt comes in on motion sensor. Send update every two minute. sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); }
Commented the following out on the gateway, as per other forum users recommendations ( but made no difference)
// Enable inclusion mode //#define MY_INCLUSION_MODE_FEATURE // Enable Inclusion mode button on gateway //#define MY_INCLUSION_BUTTON_FEATURE // 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
Serial Monitor info:
21257 TSM:FAIL:CNT=7 321259 TSM:FAIL:DIS 321261 TSF:TDI:TSL 381263 TSM:FAIL:RE-INIT 381265 TSM:INIT 381266 TSM:INIT:TSP OK 381268 TSM:FPAR 381287 ?TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 383295 !TSM:FPAR:NO REPLY 383297 TSM:FPAR 383315 ?TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 385324 !TSM:FPAR:NO REPLY 385326 TSM:FPAR 385344 ?TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 387352 !TSM:FPAR:NO REPLY 387354 TSM:FPAR 387373 ?TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 389381 !TSM:FPAR:FAIL
Ideas?