To communicate with mysensors serial gateway I’m using Python script which run as cron job on my controller (Raspberry pi). Python script is used to receive all incoming and sending all out going commands through serial gateway to all mysensors nodes.

MySQL Table to ForĀ  Incoming Messages

First you need to create table in MySQL database so we can save all incoming messages from wireless sensors to MySQL database. Simply create table or copy and past this script to create table.

MySQL Table to For Out-Going Messages

To send out commands to remote relays/nodes you need to create following table. This table and columns are self explanatory but if you need more deep knowledge you can refer to MySensors Serial Protocole

 

Python Script To Communicate with Serial Gateway

Python script runs in loop to capture all in incoming messages and check database base for any outgoing messages. This script is very self explanatory but if you need help or can not understand let me know i will do my best to reply you as quickly as humanely possible.

Checkout how to Building a MySensors Serial Gateway as Raspberry pi hat