Raspberry PI OpenHab and gateway
I have just discovered the MySensors website and I want to setup my RPi as an Openhab controller and use the same RPi as the gateway. For a start I want to setup my RPi as a Serial gateway. The following is from the MySensors website:
"If you are running a controller on the Raspberry Pi that doesn't support communication with the gateway through ethernet, you can use a virtual serial port:
./configure --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensorsGateway
For some controllers a more recognisable name needs to be used: e.g. /dev/ttyUSB020 (check if this is free). "
- Does that mean the virtual port will be created after the build, or do I have to create the port separately?
- Which is the best gateway option where you use the same RPi for gateway and OpenHab controller?
Have a look here https://forum.mysensors.org/topic/4803/building-a-raspberry-pi-gateway/115 to determine your serial port
dmesg |grep -i tty
will list your serial ports
@FredRoot serial port will be created when you run the gateway binary. Which is the best gateway ? it depends on your needs, I am using mqtt and i'm happy with that but never tried different one.
Personally I'd suggest to use ethernet gateway as you will be able to use MYSController for debugging
To answer the second Point.
MQTT is in the IOT world a defaco standard and should get used as much as it can be.
Unfortunately at the moment the OpenHAB binding for MySensors doesn't Support MQTT. But I read it is on the way.
You can use OpenHAB with MQTT and without the binding but than you can't use smart sleep which enables your nodes to sleep most of the time and save lots of energy.
Ethernet gateway is the simplest to get to work. 😀
@strangeoptics what is the point of using mqtt gateway with dedicated mysensors binding ? At least from the side of OpenHAB if using mysensors bindig, the underlying protocol doesn't matter.
Other thing, could you elaborate more on the smartSleep topic ? I'm not using smartSleep, I'm just using sleep and my nodes are sleeping most of the time so it is not true that using mqtt makes it impossible nodes to sleep. What are the differences between smartSleep and sleep and why smartSleep does not work with mqtt ?
Smartsleep actually allows to queue some commands to be executed when sensor wakes up
@gohan the nature of sleeping nodes makes it rather useless to send them commands form the controller, what use cases are You talking about ? Sensor configuration is one use case I can think about but this is much more related to controller that has to be able to queue commands than to just smartSleep function.
@rozpruwacz Sorry for my somehow confusing post.
Smart sleep is important if you not only want to get some sensor reading once in a while but want to actively control a device like lights or a power plug. To receive commands in your node you have to be always online or use smart sleep.
MQTT is good for decoupling. If you channel alle your communication through mqtt the rest of your smart things that speak mqtt could directly act on them. Or you can log the data and other stuff. It is just more flexible and more open.
But like gohan said the Ethernet is simpler for a start.
@strangeoptics I don't think that smartSleep will enable to control device like lights. At least what is written in the api docs, the smartSleep just do some additional tasks before going to sleep, but when it goes to sleep there is no way to controll the lights until the sensor wakes up.
smartsleep is more for like garden water controller in case you need to change the schedule, or any other needs where of course you don't need immediate interaction
oh, yes now it makes sense. Actually I just realised that my z-wave controlled radiator works in this manner
@gohan Yes it depends on the time lag or reaction time one can live with. I could live with 10-20 seconds for most of my things. And in this mode the node can stay for years on battery. Not actually tested but calculated
In fact it depends what you are automating, because I wouldn't live with lights that turn on after 10 seconds I pressed the button 😁
I have decided to use Network Gateway and not serial Gateway.