I plan to write a mysensor controller core API



  • I checked out many controllers, also the Home-assistant written in python, but due to my requirements I wish to write my own controller in PHP. I wish to write a core api that'll parse nodes, sensors and readings for MySensors. Anybody in future can use it develop their own controllers with a suitable frontend.
    I am having trouble in understanding the serial API of mysensors library, its not documented quite well.

    2;0;1;0;1;37.0
    0;0;3;0;9;read: 2-2-0 s=2,c=1,t=16,pt=0,l=1:0
    2;2;1;0;16;0
    0;0;3;0;9;read: 2-2-0 s=2,c=1,t=16,pt=0,l=1:0
    2;2;1;0;16;0
    0;0;3;0;9;read: 2-2-0 s=0,c=1,t=1,pt=7,l=5:38.0
    2;0;1;0;1;38.0
    0;0;3;0;9;read: 2-2-0 s=2,c=1,t=16,pt=0,l=1:0
    2;2;1;0;16;0
    0;0;3;0;9;read: 2-2-0 s=0,c=1,t=1,pt=7,l=5:37.0
    2;0;1;0;1;37.0
    0;0;3;0;9;read: 2-2-0 s=2,c=1,t=16,pt=0,l=1:0
    2;2;1;0;16;0
    0;0;3;0;9;read: 2-2-0 s=2,c=1,t=16,pt=0,l=1:0
    2;2;1;0;16;0
    0;0;3;0;9;read: 2-2-0 s=0,c=1,t=1,pt=7,l=5:38.0
    2;0;1;0;1;38.0
    0;0;3;0;9;read: 2-2-0 s=2,c=1,t=16,pt=0,l=1:0
    2;2;1;0;16;0
    0;0;3;0;9;read: 2-2-0 s=0,c=1,t=1,pt=7,l=5:37.0
    2;0;1;0;1;37.0
    0;0;3;0;9;read: 2-2-0 s=2,c=1,t=16,pt=0,l=1:0
    2;2;1;0;16;0
    0;0;3;0;9;read: 2-2-0 s=2,c=1,t=16,pt=0,l=1:0
    2;2;1;0;16;0
    0;0;3;0;9;read: 2-2-0 s=0,c=1,t=1,pt=7,l=5:38.0
    2;0;1;0;1;38.0
    0;0;3;0;9;read: 2-2-0 s=2,c=1,t=16,pt=0,l=1:0
    2;2;1;0;16;0
    0;0;3;0;9;read: 1-1-0 s=1,c=1,t=13,pt=2,l=2:6
    1;1;1;0;13;6
    0;0;3;0;9;read: 2-2-0 s=0,c=1,t=1,pt=7,l=5:37.0
    2;0;1;0;1;37.0
    0;0;3;0;9;read: 2-2-0 s=2,c=1,t=16,pt=0,l=1:0
    2;2;1;0;16;0
    0;0;3;0;9;read: 2-2-0 s=2,c=1,t=16,pt=0,l=1:0
    2;2;1;0;16;0
    

    I still need to understand the serial API. Also, can anybody explain what does

    0;0;3;0;9;read: 2-2-0 s=0,c=1,t=1,pt=7,l=5:38.0
    

    Also, what exactly is the way to design a controller.
    Eg Presentation->Assign IDs-> etc
    Thanks.



  • Welcome to the club, there is a buch of folks building controllers (me included).

    I had and still have similar questions, so here are some pointers:

    Checkout this controller implementation in nodeJS it has the basics of a controller.

    Go through the MySensors code, important clues can be found there.

    And of course go through the existing documentation Library API and Serial API

    Cheers



  • @barduino Hey thanks for the links.
    I already checked out the serial API which led me to ask this ques.
    Btw what are the basic functions of a controller?

    • To assign IDs to new nodes
    • Get data and set actuators based on user
    • Get status of nodes

    Anything that I might be missing here?

    Thanks again



  • Hi Prateek,

    I can say for sure, I whish we had a list of all the functions... still looking...

    I've started by creatining the auto assign, this forces you to implement message interpertation and message send back.

    Next was the basic ones, message type internal and presentation of the nodes.

    You will get battery level, configuration, scetch name and version, logs from the gateway, etc.

    I still havent implemented all the internal ones...

    Next i did the send messagetype, I created a generic one to log information form the sensors, so far temperature and humidity.

    Next I'll implement sending commands, like turnin on the AC, lights or fans.

    Cheers



  • Hello,

    I'm interesting in your work. Have you got some sources , a git repository ?
    What kind of connexion do you plan to code for gateway : serial mqtt ?
    BTW, i can be part of coding team.

    Regards



  • @extrablind I forgot username and pass of my original ID. No I dont have a git repo as of now. I plan to host controller on cloud and send the protocol data using a MQTT Broker or HTTP using a RESTful api. I am still planning how to do it. Once I start it I'll surely add you as contributor.

    @barduino do u have a github repo?

    Also, if we make a core API kindoff thing which everyone can use to develop their own controllers it would be really awesome.



  • @Prateek-Gupta179

    I code in a visual language, not very suited for github.

    However you can access my code here

    I did exactly wht you wrote, there is a nodeJS app reading from the serial gateway and sending the payloads to a REST service.

    Cheers



  • @barduino said:

    @Prateek-Gupta179

    I code in a visual language, not very suited for github.

    However you can access my code here

    I did exactly wht you wrote, there is a nodeJS app reading from the serial gateway and sending the payloads to a REST service.

    Cheers

    Do you plan to make this controller available to the Mysensor forum?



  • @mntlvr

    Absolutely! In fact it has been available since day 1.

    Check this post

    Since this is developed using a Platform you need to do some steps to set it up:

    • Register as a developer here (this is free and there are no strings attached)
    • Start your free and unlimited personal environment
    • Install HAALL from here

    and just hack away.


Log in to reply
 

Suggested Topics

  • 2
  • 4
  • 75
  • 482
  • 6
  • 2

50
Online

11.4k
Users

11.1k
Topics

112.6k
Posts