MySensors - Gateway to Domoticz

Moderator: leecollings

Post Reply
A1AD
Posts: 12
Joined: Sunday 11 January 2015 16:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belgium
Contact:

Re: MySensors - Gateway to Domoticz

Post by A1AD »

Thx for the implementation! I was all excited when i just learned about Domoticz, until i saw that there was no support for mysensors (i was still excited, but just a little bit less :mrgreen: ). But now there is! :D
Just want to say: Thanks for all the hard work.
BluesBro
Posts: 54
Joined: Tuesday 13 August 2013 19:55
Target OS: -
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by BluesBro »

Howis this connected to domoticz? I'm using raspberry pi.

Do I connect the arduino nano directly to the rpi via USB or do i hardware connect the NRF24L01+ directly to the IO-ports on the rpi?
hansrune
Posts: 49
Joined: Monday 07 October 2013 10:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by hansrune »

For the connection question : Connection is to the Arduino via a serial USB interface.

As for RFXcom devices, it is convenient to make a persistent device name that Domoticz can read and write also for the MySensors gateway connection. Use the lsusb command to display the vendor and product id, then use these as in the following udev rule example.

Here is my /etc/udev/rules.d/71-mysensors.rules. Domoticz will find the Mysensors serial gateway via ttyUSB31

Code: Select all

#
#  idVendor           0x1a86 QinHeng Electronics
#  idProduct          0x7523 HL-340 USB-Serial adapter
#
SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="ttyUSB31", MODE="0666", SYMLINK+="mysensors"
#
# Tests:
# udevadm info --query=all --name ttyUSB0
# udevadm test $(udevadm info --query path --name ttyUSB0 )
#
A1AD
Posts: 12
Joined: Sunday 11 January 2015 16:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Belgium
Contact:

Re: MySensors - Gateway to Domoticz

Post by A1AD »

gizmocuz,are you planning to implement the Ethernet Gateway?
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: MySensors - Gateway to Domoticz

Post by gizmocuz »

If this works the same as connecting the usb via ser2net, then this will be included in the next version.
(Tested here, and working)

But it could take a few days because currently domoticz is undergoing some changes that needs to be tested good
Quality outlives Quantity!
rtenklooster
Posts: 36
Joined: Tuesday 23 December 2014 16:20
Target OS: Linux
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by rtenklooster »

Have added a lux sensor. It's working if the value is < 1000
If the value is greater then 1000 it's displayed as 1000.

This is a copy of the serial gateway output.

Code: Select all

0;0;3;0;9;read: 3-3-0 s=2,c=1,t=23,pt=3,l=2:3494
3;2;1;0;23;3494
Another issue is all mysensors values are (mostly) listed under utilitys.
A barometer isn't listed under weather, while a mysensors temperature is listed under temperature.
rachmat
Posts: 8
Joined: Wednesday 04 February 2015 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany
Contact:

Re: MySensors - Gateway to Domoticz

Post by rachmat »

rtenklooster wrote:Have added a lux sensor. It's working if the value is < 1000
If the value is greater then 1000 it's displayed as 1000.

This is a copy of the serial gateway output.

Code: Select all

0;0;3;0;9;read: 3-3-0 s=2,c=1,t=23,pt=3,l=2:3494
3;2;1;0;23;3494
Another issue is all mysensors values are (mostly) listed under utilitys.
A barometer isn't listed under weather, while a mysensors temperature is listed under temperature.
You just have to comment MySensorBase.cpp line 829 until 831 change to this and make ;)

Code: Select all

case V_LIGHT_LEVEL:
			pSensor->floatValue = (float)atof(payload.c_str());
			//convert percentage to 1000 scale
			/*
pSensor->floatValue = (1000.0f / 100.0f)*pSensor->floatValue;
			if (pSensor->floatValue > 1000.0f)
				pSensor->floatValue = 1000.0f;
         */
			bHaveValue = true;
			break;
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: MySensors - Gateway to Domoticz

Post by deennoo »

Hello,

i try to plug on my Sensor etherrnet gateway i just made.

i got this error on log :

2015-02-06 17:24:29 Error: MySensors: Error: Connection refused
2015-02-06 17:24:29 Error: TCP: Error: Connection refused
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
rachmat
Posts: 8
Joined: Wednesday 04 February 2015 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany
Contact:

Re: MySensors - Gateway to Domoticz

Post by rachmat »

gizmocuz wrote:Will be fixed in next beta
another issue, Domoticz doesn't create device for relayactuator. it's only create device for relaywithbuttonactuator skecth. I think because RelayActuator only send sketch once while domoticz will add device after few reading.
rtenklooster
Posts: 36
Joined: Tuesday 23 December 2014 16:20
Target OS: Linux
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by rtenklooster »

rachmat wrote: You just have to comment MySensorBase.cpp line 829 until 831 change to this and make ;)
Thanks, it did the trick!

Another issue; the battery percentage of sensors is reported as 100% while the percentage being send is 93%
My guess is the battery level is being ignored / not implemented yet?
hansrune
Posts: 49
Joined: Monday 07 October 2013 10:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by hansrune »

Mine has battery levels reported as sent (svn revision 2252)
rtenklooster
Posts: 36
Joined: Tuesday 23 December 2014 16:20
Target OS: Linux
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by rtenklooster »

hansrune wrote:Mine has battery levels reported as sent (svn revision 2252)
Thanks for letting me know.
i've checked my code and it appears i used a sketch witch reported the battery level as a custom variable instead of

Code: Select all

gw.sendBatteryLevel(batteryPcnt);
Updated my sketch and it's working fine now! Thanks

Update: another small issue:
The only unit reporting battery states, is unit 4.
The battery percentage of unit 1 is also updated with unit 4's percentage.

It would be nice to be able to set notifications when a bettery level drops below xx, and show a graph of the battery level.
rachmat
Posts: 8
Joined: Wednesday 04 February 2015 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany
Contact:

Re: MySensors - Gateway to Domoticz

Post by rachmat »

Issue: Dimmable Led also not showing off at devices list, it show on log only this

Code: Select all

2015-02-08 21:06:38 MySensors: Node: 33, Sketch Name: DimmableLED
2015-02-08 21:06:38 MySensors: Node: 33, Sketch Version: 1.1
2015-02-08 21:06:52 MySensors: Node: 33, Sketch Name: DimmableLED
2015-02-08 21:06:52 MySensors: Node: 33, Sketch Version: 1.1
2015-02-08 21:07:00 Hardware Monitor: Fetching data (System sensors)
2015-02-08 21:07:30 Hardware Monitor: Fetching data (System sensors)
rachmat
Posts: 8
Joined: Wednesday 04 February 2015 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany
Contact:

Re: MySensors - Gateway to Domoticz

Post by rachmat »

Anyone here interesting to implement pushbullet notification? it's free and I think better than the others
BluesBro
Posts: 54
Joined: Tuesday 13 August 2013 19:55
Target OS: -
Domoticz version:
Contact:

Re: MySensors - Gateway to Domoticz

Post by BluesBro »

Is there a list of Domoticz supported devices or is every device on http://www.mysensors.org/build/ list supported?
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: MySensors - Gateway to Domoticz

Post by gizmocuz »

rtenklooster wrote:
hansrune wrote:Mine has battery levels reported as sent (svn revision 2252)
Thanks for letting me know.
i've checked my code and it appears i used a sketch witch reported the battery level as a custom variable instead of

Code: Select all

gw.sendBatteryLevel(batteryPcnt);
Updated my sketch and it's working fine now! Thanks

Update: another small issue:
The only unit reporting battery states, is unit 4.
The battery percentage of unit 1 is also updated with unit 4's percentage.

It would be nice to be able to set notifications when a bettery level drops below xx, and show a graph of the battery level.
If possible could you keep talking in mySensors terms ?

Unit = Node_ID ? or Unit = Child_ID ?

What (i tried) todo, when you receive a battery status on for example Node_ID=2, then all sensors of this Node with ID=2 will get the battery status
Quality outlives Quantity!
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: MySensors - Gateway to Domoticz

Post by gizmocuz »

BluesBro wrote:Is there a list of Domoticz supported devices or is every device on http://www.mysensors.org/build/ list supported?
Most sensors are implemented, but i could not test them all.
If you find a problem, let me know
Quality outlives Quantity!
pj-r
Posts: 140
Joined: Wednesday 17 December 2014 17:30
Target OS: Linux
Domoticz version: V3.8650
Location: Jyväskylä, Finland
Contact:

Re: MySensors - Gateway to Domoticz

Post by pj-r »

gizmocuz wrote:Most sensors are implemented, but i could not test them all.
If you find a problem, let me know
Nice work!!

I did already order hw for mysensors controlling venetian blinds tilt angle with servo actuator 8-)

A small question:
Does anyone know if there Is any good or what is the best concept of making rgb controller with arduino and mysensors? Or will it currently be just 3 sub-dimmers?

All I found from the wonderland of internet was these:
http://forum.mysensors.org/topic/816/se ... sensors/17
http://forum.pidome.org/viewtopic.php?id=58
LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors
rachmat
Posts: 8
Joined: Wednesday 04 February 2015 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany
Contact:

Re: MySensors - Gateway to Domoticz

Post by rachmat »

pj-r wrote:
gizmocuz wrote:Most sensors are implemented, but i could not test them all.
If you find a problem, let me know
Nice work!!

I did already order hw for mysensors controlling venetian blinds tilt angle with servo actuator 8-)

A small question:
Does anyone know if there Is any good or what is the best concept of making rgb controller with arduino and mysensors? Or will it currently be just 3 sub-dimmers?

All I found from the wonderland of internet was these:
http://forum.mysensors.org/topic/816/se ... sensors/17
http://forum.pidome.org/viewtopic.php?id=58
Basically it just 3 sub dimmer, then the controller will manipulate it. I tried with openhab and it works just fine with rgb color picker/slider. here is openhab rules and items https://github.com/openhab/openhab/wiki ... led-stripe

I don't know will it works on Domoticz or not. but until now Domoticz need to read node more than once before adding to devices while some some of Mysensors devices only send information once on startup
here is RGB Sketch :

Code: Select all

#define SN "RGB DIMMER"
#define SV "1.1"

#include <MySensor.h> 
#include <SPI.h>
#include <MyConfig.h>

#define RED_PIN 3 // Arduino pin attached to MOSFET Gate pin
#define GREEN_PIN 5
#define BLUE_PIN 6

MySensor gw(9,10);

void setup()  
{ 
  Serial.println( SN ); 
  gw.begin(incomingMessage, 31, true);
  
  gw.sendSketchInfo(SN, SV);
  
  gw.present(RED_PIN, S_DIMMER);
  gw.present(GREEN_PIN, S_DIMMER);
  gw.present(BLUE_PIN, S_DIMMER);
   
  pinMode(RED_PIN, OUTPUT);
  pinMode(GREEN_PIN, OUTPUT);
  pinMode(BLUE_PIN, OUTPUT);
  
  analogWrite(RED_PIN, 255 * gw.loadState(RED_PIN) / 100); //Get value from RAM and write to output
  analogWrite(GREEN_PIN, 255 * gw.loadState(GREEN_PIN) / 100);
  analogWrite(BLUE_PIN, 255 * gw.loadState(BLUE_PIN) / 100);
  // Pull the gateway's current dim level - restore light level upon sendor node power-up
  /*
  gw.request(RED_PIN, V_DIMMER );
  gw.request(GREEN_PIN, V_DIMMER );
  gw.request(BLUE_PIN, V_DIMMER );
  */
}

void loop() 
{
  gw.process();
}


void incomingMessage(const MyMessage &message) {
  if (message.type == V_DIMMER)
	{
		uint8_t incomingDimmerStatus = message.getByte();
		// Change Dimmer level

		analogWrite(message.sensor, 255 * incomingDimmerStatus / 100);
		gw.saveState(message.sensor, message.getByte()); //Save value to RAM
		// Write some debug info
		//Serial.print("Incoming change for dimmer on pin:");
		//Serial.print(message.header.childId);
		//Serial.print(", New status: ");
		//Serial.println(incomingDimmerStatus);
	}
}

pj-r
Posts: 140
Joined: Wednesday 17 December 2014 17:30
Target OS: Linux
Domoticz version: V3.8650
Location: Jyväskylä, Finland
Contact:

Re: MySensors - Gateway to Domoticz

Post by pj-r »

Thanks! I'll give it a try.
LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest