Domoticz full integration



  • It is a popular request (just make a search on the forum to be sure..): Domoticz full integration !
    Let's go further python/lua scripts with dummy sensors.

    Regards,

    QQ.



  • @qqlapraline I am waiting for full integration, but the Domoticz API documentation is very brief so it's very hard to do it...:(



  • I think this is not that hard.
    Actually, there is a simple enumeration of devices usable by any api.
    Furthermore, as an example you can review the recent integration of meteostick (a simple usb device for Davis meteo stations).
    Have a look at revision 1779

    QQ.



  • @qqlapraline I am not very good at programming, so we have to wait for some talented people to do this. Looking forward for this.


  • Hero Member

    Hello,

    Yes it is, domoticz doesn't have (to be confirmed) all the sensors interface intended in mysensors first, and it doesn't handle the discussion (send the metric, assign the node id and assure unicity, assure that the node id has the right sensors and that it didn't change nightly...).

    RFXtrx does all it by itself for the protocols are mainly one way (discovery but no further discussion except orders for those that can receive them). It published the result on the usb that are read, and thus removes a lot of integration issues. But on the other way, some logic is coded inside (e.g. CM180i which produces a cumulated energy usage even if it is whole house plus specialized circuits...).

    It is not that difficult to make, as the vera plugins shows, but it is a bit technical because it has its own logic. Vera can run "server process" of their own, and thus the vera plugin is in lua, in domoticz it would have to be run either inside (un the main engine) or outside (an independant program polling the gateway holding specific mysensors logic, and pushing through JSON).



  • Fair enough: then we have to build up a gateway as part of Domoticz.
    Nonetheless, an intermediary solution would be to use the Domoticz lua script towards dummy sensors.

    QQ.



  • @qqlapraline Perfect would be if Domoticz creators have interest in integration mysensors on deeper level to their software, but i don't know if they are interested in any way on doing this.



  • I have exchanged with Gizmocuz who's in charge of Domoticz code. He is very eager to integrate mysensors into Domoticz.
    He needs some help so and asks for volunteers.

    But we haven't talked about integration policy. I would understand that he would not consider refactoring to integrate mysensors, a simple integration with a gateway engine (some kind of RFXCOM integration + gateway) is the key.



  • To move forward, I may have misunderstood things but can't we use one arduino as the gateway that reads/writes from serial ?
    Isn't it the principle of the raspberry pi gateway ?

    QQ.


  • Hero Member

    The Arduino is needed for it has all the libraries to interface the rf24 and the mysensors protocols... it hides it to the controller, but there are plenty of stuff hidden below... consider mysensors library as the protocol stack, the gateway as the layer 4 to 6, and application as layer 7 in OSI model 😉



  • @qqlapraline Yes, arduino can work as a gateway. But i think it should communicate with Domoticz not by json, but in better way.


  • Hero Member

    json is sometime the simplest way to have it working...



  • OK, so basically, nobody wants to do anything...Good way for the integration process !



  • @qqlapraline I want but unfortunately i do not have abilities:( I can only suggest that if someone have contact with domoticz creators he can ask them if they can write better api...


  • Hero Member

    Hey QQ it is always easier to ask than to do...

    So far there is no will on one side to do something, on the other same issue... (one developper on each side alone...)some people have ported the mysensors integration to openahab (which has a working z-wave integration and RFXtrx), but for your case it is a bit different...

    First ask yourself if you are building a mysensors and for what use (needs some soldering, DIY, purchase, enery solving issue, boxing... that is not things bought uppon a shelf), and then you'll need to find people or make it yourself.


  • Admin

    @qqlapraline said:

    I have exchanged with Gizmocuz who's in charge of Domoticz code. He is very eager to integrate mysensors into Domoticz.

    If Gizmocuz has specific questions about MySensors protocol or library I can probably answer them.



  • @epierre Yeah..right..:| thank you for the life lesson.

    Actually, how surprising it might look, I don't have the need: I have Arduino, communicating together in a simple protocol and integrating very well with my domoticz installation (by the way, it supports lots of devices...). But, I have good will....And integration between mysensors and Domoticz seems quite logical to me. If this is a fight between number of code lines (which is probably not to the advantage of mysensors), then, fine by me: I'm out the game.

    Regards.

    QQ.


  • Mod

    @qqlapraline I don't really understand what you are trying to ask or say but I do know that the mySensors project is a project supported by only a handful of people.
    I for myself wanted integration with Indigo Domotica and, because I soon understood that I am the first (and at this point only) person asking for it I started developing a plugin for it.
    It is not my first priority (I have to make a living and my partner needs some attention as well) but I will get there.
    What you are asking (as far as I understand) is others to step up to the plate for something that you want or think makes sense in some future.
    That, as you probably understand by now, will only happen when more people start asking for it and/or someone takes the lead.
    When you are not that person I don't think it is correct to 'blame' anybody or get cynical because, just maybe, the time is not on your side.



  • 1 + for full integration with domoticz.



  • Nevertheless i am not a good programmer i will try tomorrow to make mysensors work with domoticz with at least temp sensors by the ethernet and json. Will see what i can acomplish with 90% desire, and 10% of knowledge:) Maybe it would be first step for others:)


  • Hero Member

    Hi all,

    A hint of what is going on... with the vera gateway !

    http://forum.mysensors.org/topic/142/#1321



  • +1 on domoticz integration!



  • +1 for the full domoticz integration.
    And sorry for not being helpful because i'm no programmer..



  • So please..
    Include this realy nice stuff to domoticz.

    +10



  • I ask again what is the best way to use mysensor in domoticz software?


  • Admin

    @maglo18

    Someone who knows Domoticz need to step up and help creating a plugin for the controller. Either by using the serial protocol or by utilizing MQTT.

    We can help someone get started but the actual work has to be done by someone actually using the controller.


  • Hero Member

    I would add someone developping in domoticz for there are (too) few and some new features should be added too...

    externally is possible and ongoing...



  • +1 to domoticz full integration plizzzz !!!!



  • +1 to Domoticz full integration 🙂


  • Admin

    I've commented on the Domiticz feature request:
    http://www.domoticz.com/forum/tracker.php?p=2&t=143


  • Hero Member

    Also, if such a C++ ninja would appear, many would be very, very happy to also see native MQTT support for Domoticz.
    http://www.domoticz.com/forum/viewtopic.php?f=5&t=838


  • Mod

    @bjornhallberg did you call for a c++ ninja? 😉


  • Hero Member

    @hek I would say a demi dozen ninjas would be necessary, one for understanding, one for mapping, one for coding, one for testing one for answering people claims and one ... to support the integration of the code... did I miss one ? 😉

    the internal model is not unified, this is more types built uppon types in several classes, based on evolutions from rfxtrx and then zwave, some are duplications of others (hard coded, no attributes...)... a real headache just on the JSON interface and no testbed/test cases/testmaterial, just full debug with users reporting bugs... doing the Imperihome integration I can say I had a hard time just from outside the code...


  • Hero Member

    @Yveaux Haha, yeah, but in all honestly I'm not expecting or suggesting anyone here do their work for them. If they had any sense they would have had support for MQTT and such years ago. And an infrastructure in place for user plugins. I'm such a sad sod that I actually subscribe to the RSS feed for Domoticz commits (for a few months now, as I do with many of these HA software) and I can't say I'm often surprised by anything they put into the code.

    On the other hand Domoticz has a lot going for it, including pretty decent graphs that work out of the box. It has blockly. And it has native code. And its JSON API isn't half bad either. I mean, I did try the script by @epierre for a while and I could have settled for hard coding sensor input into Domoticz ... but now I've scrapped the serial gateway due to issues brought up in the other thread and I'm back to either the MQTT or Ethernet gateway so no more Domoticz input. Unless I get a new single-board computer or NUC or whatever to interface with.


  • Hero Member

    @bjornhallberg What do you mean by :

    but now I've scrapped the serial gateway due to issues brought up in the other thread and I'm back to either the MQTT or Ethernet gateway so no more Domoticz input. Unless I get a new single-board computer or NUC or whatever to interface with.
    

    Domoticz is perfect for 433Mhz users supported by the rfxtrx, which is its origin. Here you need to code, flash, wire, power, find a box... not for the faintest of heart... clearly not a plug and play philosophy of Domoticz. This is why I'm wopndering so many people ask for the integration but actually don't report questions on sketches or issues, are there are many...


  • Hero Member

    @epierre I just meant that I used to have an Arduino Nano + NRF24 PA LNA connected to my Raspberry, but due to some issue or another (I'm not sure) it wouldn't work properly. Perhaps the power draw on the 3.3V. Perhaps the two extra walls between the Raspberry and where I currently have the MQTT gateway. Perhaps interference from some other piece of electronic inside the cramped camera housing. Who knows.

    Of course moving away from serial gateway means a world of trouble as most controllers and such have plugins made with that gateway in mind. IF I get a new computer to host a serial gateway, it would have to be many, many times faster than the Raspberry and preferably x86. With only slightly higher idle power consumption. Only the latest generation i3 and i5 NUCs match that description.

    Right now I'm looking into paho-mqtt for python and making a script much like yours that uses the JSON API to update virtual sensors inside Domoticz. I'm almost there I hope. It's not pretty but trying to get some of these other HA solutions to work is like banging your head against a brick wall. At least with Domoticz you have a great deal going for you out of the box. Like graphing which I mentioned above. Seeing all these new and fantastic JS graphing solutions, you sort of get a bit spoiled. Domoticz has some of the best graphs imo, even if that isn't saying much.


  • Hero Member

    @bjornhallberg intel is not the only way... for $50 there is the banana-pi ... I've moved from raspi to a cubie 2 in urgency, latest domoticz updates made it impossible to live on a raspi... with only rfxtrx and JSON updates... the cubie 2 is a bi-core A20 and my cpuload is 10% at worse... in raspi it was 100%... for a better community support the odroid is way faster and better supported (quad core, the samsung S3 ekynos processor just to name it) but is twice the price.


  • Hero Member

    In the quest for Domoticz full integration, I have been doing some prototyping in Python. Domoticz has very capable JSON support and virtual device types so we can do without "full integration" .
    My python script is built around a 'dictionary' based Database with a hardcoded MySensor-Domoticz translation. The script is running stable with 20+ sensor/actuators and limited cpu load on raspberry pi (15%).

    What is next:

    • dynamic sensor inclusion i.s.o. fixed nodes.
    • more sensor types and support for combined devices (e.g. Temp, Hum, Baro)
    • (sqlite i.s.o. python dictionary)

    dependencies: requests, json

    anybody interested?

    You can find the attempt at: Domoticz-MySensors
    all suggestions welcome..


  • Admin

    @AWI

    That would be awesome!



  • @AWI That would be pretty awesome!
    If I can help anyhow, just say so.

    Currently I'm running Domoticz with custom-built gateway on MEGA, but could probably start switching whole thing to MySensors as whole setup use nRF24L01 🙂

    How can I help? Or is it ready for tests?


  • Hero Member

    @andriej It is ready for test. Just edit the your setup in the header and adapt "Sensor_DB" to your setup. Nothing really fancy.



  • @AWI I'm after first test and that's what I get just after running the code:

    # python mysensors-dom.py
    2015-01-17 02:59:41 Start
    ('Wrong/No input from MySensors gateway', ValueError('No JSON object could be decoded',))
    ('Wrong/No input from MySensors gateway', ValueError('No JSON object could be decoded',))
    ('Wrong/No input from MySensors gateway', ValueError('No JSON object could be decoded',))
    0;0;3;0;14;Gateway startup complete.
    ('Wrong/No input from MySensors gateway', ValueError('No JSON object could be decoded',))
    

    Are these desired messages?
    What I'm supposed to do later on?



  • I've managed to get it to work.
    First issue - since always I've reported temperature and humidity altogether (from DHT sensors).
    Currently I can't specify one IDX for two values and I can't see in code where I could put two values to report in Domoticz at once.
    They use to be reported in one URL.


  • Hero Member

    Good to see you are taking the jump... What you see in the first test is are generic error messages which can be generated in many place. There is a "catch-all" exception handler on the main loop, I suggest you take out the word "ValueError". After that the script will come to a halt and indicate where it went wrong.

    I am 'almost' in the next major update. I hope to upload today .

    Good luck!


  • Hero Member

    @hek I am almost done with the python -Domoticz "full integration" but strugling with a few message types. The code for Vera is a good source for information but it is hard to determine the role of the controller in the construction/routing of the network. For now I assumed only node numbering and keeping track of the sensors. Is the controller supposed to do something with the relay nodes? what is the function of the I_CHILDREN message?


  • Admin

    Just skip it. It's deprecated and will be removed.


  • Hero Member

    @andriej I will be posting a new version tomorrow which adds maximum functionality for Domoticz (from my view): combined sensors (trick), node numbering, inclusion and an external database in JSON. I will keep it running tonight to test the stability. ...


  • Hero Member

    Major update (but still very beta...,) supports:

    • dynamic sensor inclusion i.s.o. fixed nodes.
    • more sensor types and support for combined domoticz devices (e.g. Temp, Hum, Baro)
    • external JSON database

    The python script is built around a 'dictionary' based Database with the MySensor-Domoticz translation. The script is running stable with 20+ sensor/actuators and limited cpu load on raspberry pi (15%).

    Known issues:

    • You need to edit the JSON database yourself if you need combined Domoticz devices eg. (Temp/Hum/Baro). Not difficult
    • Need to create Switch types yourself in Domoticz , then assign these in the database
    • Usage/power not supported yet (need a "multiple value" trick..)

    You can find the attempt at: Domoticz-MySensors with a small instruction in the first few lines

    all suggestions welcome..


  • Admin

    @AWI, great work!

    You should probably post something over at Domoticz forum as well.



  • Domoticz:

    Starting with a native implementation, thanks to Ad for providing the RF interfaces.

    Maybe best (for domoticz) to continue on the forum,
    i need serial logs of all possible combinations and meaning

    node-id;child-sensor-id;message-type;ack;sub-type;payload

    we developers probably have to do some special tricks to get some nice sensors

    for instance, it would be nice if there where subtypes for:

    • Temp+Hum
    • Temp+Hum+Baro
    • Kwh+Watt
    • Wind+Gust+Direction

    I can not watch this forum, if you want to contribute, plz use the domoticz forum


  • Admin

    @Rob-Peters

    Hi, great to see you here! I'll send you my contact details if you have any specific questions.
    @AWI seems to have implemented most of the logic necessary.



  • In latest release of Domoticz I can see first implementations of MySensors!
    Maybe it's worth a shot for someone to register on Domoticz forum and help their team out?


  • Hero Member

    @andriej Hi, GizMoCuz is working on it (2 reply's before) asked for serial log of all possible combinations. I am trying to help out, but some help and priority setting is more than welcome.


  • Hero Member

    Hello,

    I've answered to Rob sending some of my logs and a link to my interface, I guess seeing a link between values and JSON will help a bit ;-).

    @hek we've not settled about gas values, no ?


  • Admin

    @epierre
    Sort of... But I will probably not change anything in 1.4.



  • Posted a new beta of domoticz.
    Lots have been changed

    If anyone can supply me with serial log messages of:
    S_LIGHT_LEVEL
    S_WATT
    S_KWH

    That would be helpfull

    With regards,
    Rob


  • Admin

    @GizMoCuz

    Sent you an email...


  • Admin

    @AWI said:

    @hek I am almost done with the python -Domoticz "full integration" but strugling with a few message types. The code for Vera is a good source for information but it is hard to determine the role of the controller in the construction/routing of the network. For now I assumed only node numbering and keeping track of the sensors. Is the controller supposed to do something with the relay nodes? what is the function of the I_CHILDREN message?

    @hek said:

    Just skip it. It's deprecated and will be removed.

    @hek:
    The I_CHILDREN+"C" message is useful during development/implementation/repositioning of nodes with repeater functionality (changing node location may alter routing).

    From my experience, this function is helpful and should even be expanded to clearing the parent_node_id: i.e. I faced the situation where the parent node (not gw) was out of range and the node could not communicate back to the gateway. The only resolution is to clear the eeprom or sending the I_CHILDREN + "C" command



  • I have a question. If someone is using pulse power meter with new version of Domoticz please tell me if Domoticz is able to send last know value of kwh to node?



  • Has anyone tested the Domoticz's support of MySensors?
    Maybe it should be mentioned on the webpage somehow.
    It's still one of the most nice-looking systems out there...


  • Admin

    I will create a page on the main site. Just waiting for some texts from Rob.



  • @andriej I have managed to get a MySensor DHT11 sensor reporting consistently in Domoticz, via the Ethernet option. My next steps are to try a couple of other sensor types (eg distance, switches) and multiple sensors on one arduino node. After a first look at how the Serial and Ethernet options have been done in Domoticz, it looks to me like MQTT might also provide a third 'transport' option for integrating MySensors, with some development. I will be building my knowledge across MySensors and Domoticz over the coming week or two, so might be able to contribute to integration development in the future.



  • I've motion sensors, barometer, lux sensors 4 dallas sensors on 4 arduinos fully working on domoticz.
    It's al working fine, sensors don't always appear in the right tab, but that's no problem for now, new to mysensors, very happy with it!


  • Hero Member

    Status of native Domoticz MySensors support:: For the ones who are interested @GizMoCuz did a great job in building native MySensors support in Domoticz. As documentation is lagging behind 😉 I have examined the code and come up with a basic understanding of functionality.
    First of all: you need the beta version of Domoticz (can be enabled in setup->settings) for now to get MySensors support. By enabling the MySensors hardware (setup->hardware) you can enable MySensors USB/ LAN interface.

    The supported "V" types as of today for "SET" (read from the code):
    V_TEMP:, V_HUM, V_PRESSURE, V_VARx, V_TRIPPED, V_ARMED, V_LOCK_STATUS, V_LIGHT, V_DIMMER, V_DUST_LEVEL, V_WATT, V_KWH, V_DISTANCE, V_FLOW, V_VOLUME:, V_WIND, V_GUST, V_DIRECTION, V_LIGHT_LEVEL,:V_FORECAST,: V_VOLTAGE, V_UV, (so almost all )

    The list for 'REQ' is (and will be.?) limited to V_LIGHT, V_DIMMER and V_VAR types. If anyone needs more please address this on the Domticz forum as I am out of arguments.

    Be aware that the MySensor support is beta, but very promissing.



  • Is the Watt-sensor working ok for every of you?
    I've switched my installation to MySensors, but reports of current usage seems strange to me...

    I don't see how many watts my house is using that often as it's possible (so every 60 secs you could say how much pulses were counted...).
    I can't catch how often the value is refreshed.

    Second thing is - is it possible to enter 'current status' of the electrical counter?
    I can write down the value and I'd like to see new counts added to already measured value (to see after i.e. a month if the counts are counted same as by meter).

    Maybe it can be done by V_VAR? If yes, how to use it/push it to node?



  • @AWI I installed the latest BETA version and Enabled MySensor via the Serial/USB gateway. I have a simple network with one PIR Motion Sensor which sends a V_TRIPPED and a battery status message every time the motion detector goes off. I can see in the log that Domoticz communicates with the serial GW and that it gets a message every time the sensor goes of.
    HOWEVER the system identified the motion sensor as "Lighting 2" and doesn't convey the status of the PIR, but rather thinks it's a light bulb. The last seen date never changes after the initial startup of the sensor , however the battery percentage seems to read correctly,

    Where is the MySensor implementation coded ? Is it modifiable on the end system via scripts or is it compiled in?

    G


  • Hero Member

    @GaryStofer You should change the "Switch type" in the GUI (edit sensor -> switchtype -> motion sensor) to change between the different switch types. The naming of the sensors like "lighting 2" is a Domoticz thing coming from history. It is better to ignore this.
    I don't know yhy the "last seen" never changes if you see the changes in the log file. Better to address these things on the Domoticz forum.
    The implementation is compiled in the Domoticz code (although I am using my own script for now)



  • Yes, changing the "switch type" to Motion helped a great deal. I would never have thought of a motion detector to be considered a switch. I guess it works in a backwards kind of way. I get the source on my RPi next and have fun with that and trying to figure out why the simplest of Blockly events all fail to execute with error message. Have not found much deliberate documentation on their site, such is opens source I guess ..... Seems to be snappy though.

    How is your own script tying into the system?

    G


  • Hero Member

    @GaryStofer I suggest you put a screen dump on the Domoticz forum for the Blockly issue. Lot's of helping hands over there. My "own script" is a Python interface to Domoticz, It works well but has a separate "database" (.csv file ;)) to store all the sensor to domoticz bindings. It makes everything very flexible and complete but installation etc. is a bit of a pain... I still use it because of missing functionality to "read" values from Domoticz. If you want I can update the version on GitHub.



  • @AWI said:

    The supported "V" types as of today for "SET" (read from the code):
    V_TEMP:, V_HUM, V_PRESSURE, V_VARx, V_TRIPPED, V_ARMED, V_LOCK_STATUS, V_LIGHT, V_DIMMER, V_DUST_LEVEL, V_WATT, V_KWH, V_DISTANCE, V_FLOW, V_VOLUME:, V_WIND, V_GUST, V_DIRECTION, V_LIGHT_LEVEL,:V_FORECAST,: V_VOLTAGE, V_UV, (so almost all )

    The list for 'REQ' is (and will be.?) limited to V_LIGHT, V_DIMMER and V_VAR types. If anyone needs more please address this on the Domticz forum as I am out of arguments.

    Be aware that the MySensor support is beta, but very promissing.

    are the V_VARx types realy supported? because I can run domoticz with V_DISTANCE , V_TEMP:, V_HUM, V_PRESSURE etc but V_VARx types only showed on the log but not recognized on the devices list...


  • Hero Member

    @Mickey It is supposed to be supported. Have a look at the Domoticz code. I also remember seeing a discussion on the Domoticz forum.



  • maybe the V_VAR value sending node need to send some kind of values to be recognized beside the first recognition packets? because in the relay node there was a problem with the mysensors build section basic sketch that domoticz didnt recognize until I change the sketch and made a call to gateway with relay pin status for it to recognize the node...



  • Is there a fully functional domoticz integration now?



  • Almost.. some S_HVAC "enum" messages arent supported.



  • Are there any plans and is it possible at all to implement ota fw update through domoticz?


  • Plugin Developer

    What's the current state of integration? Are the data types supported now?



  • I think so ! 🙂
    Have a look here.

    QQ.


  • Mod

    If you install beta version of domoticz you can add both ethernet and mqtt gateways and lots of types are supported



  • V_HVAC_FLOW_MODE, V_HVAC_SPEED and V_HVAC_FLOW_STATE handling still missing.
    No smartSleep implementation yet.


Log in to reply
 

Suggested Topics

10
Online

11.4k
Users

11.1k
Topics

112.7k
Posts