@sundberg84 No worry, I talked with hek and he finded that was a pcbway mistake. BTW...very good job with the PCB, I'm using it with a lot of my sensors
Posts made by danivalencia
-
RE: Easy/Newbie PCB for MySensors
-
RE: Easy/Newbie PCB for MySensors
@sundberg84 Any idea why I've received a "2nd version" of your Rev.8 from PCBWay for free? By free I mean that I bought 10x your Rev.8 about 2 months ago (Black in the photo), but today I've got a package from China and when I opened I got that other PCB that I haven't ordered
I don't see any changes regarding the radio capacitor. Any clue? -
RE: Is it possible to delete specific nodes?
You'll have to edit your mysensors.json file (or the name you have at configuration.yaml), and remove the node from that file, with homeassistant stopped before. Normally the format is <node number>: { <lot of data> }.
This is one of my nodes from HA file."1": {"sensor_id": 1, "type": 17, "sketch_version": "1.0", "battery_level": 52, "protocol_version": "2.0.0-beta", "sketch_name": "Contact1", "children": {"0": {"id": 0, "type": 0, "values": {"16": "0"}}}}
Just delete that part, and start HA again.
-
RE: Newbie needs help
@masterkenobi said:
There is also another thing concern me. What if my neighbor also into Mysensors? Will he be able to view all the data from my sensors? How do I secure the nodes?
Take a look at https://forum.mysensors.org/topic/1021/security-introducing-signing-support-to-mysensors
-
RE: Newbie needs help
Here you have a sample of one of my battery nodes. Now I'm using V2.0 of Library, but this used to work before updating
#include <MySensor.h> #include <SPI.h> #include <BH1750.h> #define SN "SensorLuz" #define SV "1.0" unsigned long SLEEP_TIME = 300000; // 5 minutos #define CHILD_ID_LIGHT 0 #define NODE_ID 7 #define VBAT_PER_BITS 0.003363075 #define VMIN 1.9 // Vmin (radio Min Volt)=1.9V (564v) #define VMAX 3.0 // Vmax = (2xAA bat)=3.0V (892v) int batteryPcnt = 0; // Calc value for battery % int batLoop = 0; // Loop to help calc average int BATTERY_SENSE_PIN = A0; MySensor gw; BH1750 lightSensor; uint16_t lastlux; MyMessage msgLux(CHILD_ID_LIGHT, V_LEVEL); MyMessage msgLuxUnit(CHILD_ID_LIGHT, V_UNIT_PREFIX); void setup() { analogReference(INTERNAL); gw.begin(NULL, NODE_ID); lightSensor.begin(); gw.sendSketchInfo(SN, SV); gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL); gw.send(msgLuxUnit.set("lux")); } void loop() { uint16_t lux = lightSensor.readLightLevel(); Serial.print("Lux: "); Serial.println(lux); if (lux != lastlux) { gw.send(msgLux.set(lux)); lastlux = lux; } batM(); gw.sleep(SLEEP_TIME); } void batM() //The battery calculations { delay(500); int sensorValue = analogRead(BATTERY_SENSE_PIN); delay(500); float Vbat = sensorValue * VBAT_PER_BITS; int batteryPcnt = static_cast<int>(((Vbat-VMIN)/(VMAX-VMIN))*100.); //Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %"); if (batLoop > 24) { //24 ciclos de 5 min = 2h. gw.sendBatteryLevel(batteryPcnt); batLoop = 0; } else { batLoop++; } }
-
RE: Buy designs on OpenHardware.io
Just received DIY kit (My Slim 2AA node), and they sent me SMD NRLF24+, not the standard Do I have to contact them?
-
RE: Sending Battery level with sensor data.
On your sketch... (from https://www.mysensors.org/download/sensor_api_15)
gw.sendBatteryLevel(batteryLevel);
But you'll have to measure batteryLevel before someway
-
RE: Buy designs on OpenHardware.io
How do we know order's state for buyed DIY kits from OH? I ordered a kit Saturday and haven't received any news from PCBWay or OH since then.
I tried searching PCBWay site but no luck. -
RE: Problem with S_RGB_LIGHT
And there was the fail !! :s
Installed 1.5.4 and now it runs in the right manner.
Thank you!!
-
RE: Problem with S_RGB_LIGHT
I tried your sketch as is, just to try one leg for the RGB Led, but I'm not getting the expected result. When I change the brightness from the HA UI slider, the node gets the correct value, but...
send: 12-12-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:0 send: 12-12-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.3 send: 12-12-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0 sensor started, id=12, parent=0, distance=1 send: 12-12-0-0 s=1,c=0,t=26,pt=0,l=0,sg=0,st=ok: send: 12-12-0-0 s=255,c=3,t=11,pt=0,l=11,sg=0,st=ok:DimmableLED send: 12-12-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.1 send: 12-12-0-0 s=1,c=2,t=3,pt=0,l=0,sg=0,st=ok: send: 12-12-0-0 s=1,c=1,t=2,pt=2,l=2,sg=0,st=ok:0 send: 12-12-0-0 s=1,c=1,t=3,pt=2,l=2,sg=0,st=ok:0 send: 12-12-0-0 s=1,c=1,t=40,pt=0,l=6,sg=0,st=ok:ffffff read: 0-0-12 s=1,c=1,t=2,pt=0,l=1,sg=0:1 Changing level to 100, from 0 send: 12-12-0-0 s=1,c=1,t=2,pt=2,l=2,sg=0,st=ok:1 send: 12-12-0-0 s=1,c=1,t=3,pt=2,l=2,sg=0,st=ok:100 read: 0-0-12 s=1,c=1,t=3,pt=0,l=2,sg=0:17 // <- Here I modified brightness Changing level to 100, from 100 send: 12-12-0-0 s=1,c=1,t=2,pt=2,l=2,sg=0,st=ok:1 send: 12-12-0-0 s=1,c=1,t=3,pt=2,l=2,sg=0,st=ok:100 read: 0-0-12 s=1,c=1,t=3,pt=0,l=1,sg=0:9 // <- Here too Changing level to 100, from 100 send: 12-12-0-0 s=1,c=1,t=2,pt=2,l=2,sg=0,st=ok:1 send: 12-12-0-0 s=1,c=1,t=3,pt=2,l=2,sg=0,st=ok:100
As you see, no matter what level receives, It goes to 100 forever.
And if you try to move the brightness slider more over to the right (or the left to reduce), the values sometimes get higher than 100 (or -100), despite of the "clipping" method of the sketch.EDIT:
Made a few changes to the code, to find what's failing, and I think is the way HA sends commands to the node;
... if (message.type == V_DIMMER) { // Retrieve the power or dim level from the incoming request message int requestedLevel = atoi(message.data); Serial.print("Received: "); Serial.println(message.data); Serial.print("Bright: "); Serial.println(requestedLevel); ...
And the log from the sensor:
send: 12-12-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:0 send: 12-12-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.3 send: 12-12-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0 sensor started, id=12, parent=0, distance=1 send: 12-12-0-0 s=1,c=0,t=26,pt=0,l=0,sg=0,st=ok: send: 12-12-0-0 s=255,c=3,t=11,pt=0,l=11,sg=0,st=ok:DimmableLED send: 12-12-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.1 send: 12-12-0-0 s=1,c=2,t=3,pt=0,l=0,sg=0,st=ok: read: 0-0-12 s=1,c=1,t=3,pt=0,l=3,sg=0:100 Received: 100mableLED Bright: 100 Changing level to 100, from 0 send: 12-12-0-0 s=1,c=1,t=3,pt=2,l=2,sg=0,st=ok:100 send: 12-12-0-0 s=1,c=1,t=2,pt=2,l=2,sg=0,st=ok:1 send: 12-12-0-0 s=1,c=1,t=3,pt=2,l=2,sg=0,st=ok:100 send: 12-12-0-0 s=1,c=1,t=40,pt=0,l=6,sg=0,st=ok:ffffff read: 0-0-12 s=1,c=1,t=3,pt=0,l=2,sg=0:45 Received: 450mableLED Bright: 450 Changing level to 100, from 100 send: 12-12-0-0 s=1,c=1,t=3,pt=2,l=2,sg=0,st=ok:100
Seems there is a string of the message (sketch name maybe) messing with the brightness data.
-
RE: Problem with S_RGB_LIGHT
Thanks a lot!
So, I can remove two of the presentations, but I have to send three messages or can I send just one?
And for the respond to the gateway, can you show me an example?
Thanks again!
-
RE: Problem with S_RGB_LIGHT
Thanks!
I think I figured out the solution, but not yet fixed at all.
I presented the three V_ types, and sent a value for each all. But now I'm dealing with the ON/OFF "order" for the light. It doesn't respond to the switch at the UI.
#include <MySensor.h> #include <SPI.h> #define RED_PIN 3 #define GREEN_PIN 5 #define BLUE_PIN 6 #define NODE_ID 2 #define CHILD_ID 0 #define SKETCH_NAME "RGB_LED" #define SKETCH_VERSION "1.0" MySensor gw; MyMessage msgBright(CHILD_ID, V_PERCENTAGE); MyMessage msgColor(CHILD_ID, V_RGB); MyMessage msgLight(CHILD_ID, V_LIGHT); long RGB_values[3] = {0, 0, 0}; float dimmer; void setup() { pinMode(RED_PIN, OUTPUT); pinMode(GREEN_PIN, OUTPUT); pinMode(BLUE_PIN, OUTPUT); gw.begin(incomingMessage, NODE_ID, NODE_REPEAT); gw.sendSketchInfo(SKETCH_NAME, SKETCH_VERSION); gw.present(CHILD_ID, S_RGB_LIGHT); gw.present(CHILD_ID, S_DIMMER); gw.present(CHILD_ID, S_LIGHT); gw.request(CHILD_ID, V_RGB); gw.request(CHILD_ID, V_PERCENTAGE); gw.request(CHILD_ID, V_LIGHT); gw.send(msgBright.set(100)); gw.send(msgColor.set("000000")); gw.send(msgLight.set(1)); } void loop() { gw.process(); } void incomingMessage(const MyMessage &message) { if (message.type == V_RGB) { String hexstring = message.getString(); long number = (long) strtol( &hexstring[0], NULL, 16); RGB_values[0] = number >> 16; RGB_values[1] = number >> 8 & 0xFF; RGB_values[2] = number & 0xFF; } if (message.type == V_PERCENTAGE) { dimmer = message.getInt(); analogWrite(RED_PIN, int(RGB_values[0] * (dimmer / 100))); analogWrite(GREEN_PIN, int(RGB_values[1] * (dimmer / 100))); analogWrite(BLUE_PIN, int(RGB_values[2] * (dimmer / 100))); } if (message.type == V_LIGHT) { if (message.getInt() == 0) { digitalWrite(RED_PIN, 0); digitalWrite(GREEN_PIN, 0); digitalWrite(BLUE_PIN, 0); } if (message.getInt() == 1) { analogWrite(RED_PIN, int(RGB_values[0] * (dimmer / 100))); analogWrite(GREEN_PIN, int(RGB_values[1] * (dimmer / 100))); analogWrite(BLUE_PIN, int(RGB_values[2] * (dimmer / 100))); } } }
Any idea why?
-
Problem with S_RGB_LIGHT
Hi all.
I'm trying to set up a test sensor, with a RGB Led attached to a Nano/NRF sensor.
For now what I have is this code borrowed from the domoticz forum, but the light doesn't show on the UI.
Any help apreciated (and sorry for my english )
#include <MySensor.h> #include <SPI.h> #define RED_PIN 3 #define GREEN_PIN 5 #define BLUE_PIN 6 #define NODE_ID 2 #define CHILD_ID 0 #define SKETCH_NAME "RGB_STRIP" #define SKETCH_VERSION "1.0.0" #define NODE_REPEAT false MySensor gw; long RGB_values[3] = {0, 0, 0}; float dimmer; void setup() { pinMode(RED_PIN, OUTPUT); pinMode(GREEN_PIN, OUTPUT); pinMode(BLUE_PIN, OUTPUT); gw.begin(incomingMessage, NODE_ID, NODE_REPEAT); gw.sendSketchInfo(SKETCH_NAME, SKETCH_VERSION); gw.present(CHILD_ID, S_RGB_LIGHT, "RGB Strip", false); gw.request(CHILD_ID, V_RGB); } void loop() { gw.process(); } void incomingMessage(const MyMessage &message) { if (message.type == V_RGB) { String hexstring = message.getString(); long number = (long) strtol( &hexstring[0], NULL, 16); RGB_values[0] = number >> 16; RGB_values[1] = number >> 8 & 0xFF; RGB_values[2] = number & 0xFF; } if (message.type == V_DIMMER) { dimmer = message.getInt(); analogWrite(RED_PIN, int(RGB_values[0] * (dimmer / 100))); analogWrite(GREEN_PIN, int(RGB_values[1] * (dimmer / 100))); analogWrite(BLUE_PIN, int(RGB_values[2] * (dimmer / 100))); } if (message.type == V_LIGHT) { if (message.getInt() == 0) { digitalWrite(RED_PIN, 0); digitalWrite(GREEN_PIN, 0); digitalWrite(BLUE_PIN, 0); } if (message.getInt() == 1) { analogWrite(RED_PIN, int(RGB_values[0] * (dimmer / 100))); analogWrite(GREEN_PIN, int(RGB_values[1] * (dimmer / 100))); analogWrite(BLUE_PIN, int(RGB_values[2] * (dimmer / 100))); } } }