Page 2 of 5

Re: Domoticz plugin

Posted: Fri Oct 07, 2016 12:00 am
by WoLpH
I've just created a new release. Version 0.2 should function with most dimmers as well. Additionally, there is now a debug setting to make debugging a bit easier :)

https://github.com/WoLpH/eventghost-dom ... es/tag/0.2


krambriw wrote:Hello,
So I made a first testing version following the json structure you provided. It has a dependency that the word 'domoticz' must be found in the msg.topic in messages from domoticz
__init__.py
Typically you will receive the following events for Domoticz where now only the values are kept

Code: Select all

09:17:08   MQTT./1wire/domoticz/Light/Switch [255, 12, 'Light/Switch', '00001201', 195, 'licht bureaus', 2, 'Switch', '68', 'Dimmer', 1]
09:17:08   MQTT./1wire/domoticz/General [255, 12, 'General', '00000701', 78, 'kWh pc media', 0, 'kWh', '226.200', '654594.750', 1]
Based on this you could create a macro structure and extract whatever values from the list in the payload using simple python scripts
Skärmklipp.JPG
If you think we need a more specific event suffix to be able to directly trigger individual actions on state changes without using python scripts it can easily be made. Like for instance

MQTT./1wire/domoticz/Light/Switch/On/Off/57/0
and
MQTT./1wire/domoticz/Light/Switch/On/Off/57/1

BR Walter
Thanks, that already works fairly well. But you're right that the event suffix needs to be a bit more advanced to be usable. At the very least it should include the idx but probably the value as well. I'll think a bit about clean solution. Your plugin is definitely very useful, great work!

Re: Domoticz plugin

Posted: Fri Oct 07, 2016 5:44 am
by krambriw
But you're right that the event suffix needs to be a bit more advanced to be usable
For other device events & plugins, I have only included the state change in the suffix for on/off devices but not for events that can provide many values. Like dim levels, power meters etc. because this make no sense if you want to trigger specific actions. In this case you need to extract the value from payload with a python script to make some use of it.

Regarding the the json structures provided by Domoticz, what is the difference between a svalue and nvalue?

Re: Domoticz plugin

Posted: Fri Oct 07, 2016 6:09 am
by krambriw
Based on the above, here is a new version that provides the state in the suffix for on/off switches
__init__.py
(35.6 KiB) Downloaded 219 times

Re: Domoticz plugin

Posted: Fri Oct 07, 2016 12:58 pm
by WoLpH
krambriw wrote:
But you're right that the event suffix needs to be a bit more advanced to be usable
For other device events & plugins, I have only included the state change in the suffix for on/off devices but not for events that can provide many values. Like dim levels, power meters etc. because this make no sense if you want to trigger specific actions. In this case you need to extract the value from payload with a python script to make some use of it.
That's why I was hoping wx wouldn't make it too hard.

I'm thinking about an interface where it shows you all values that were sent where you can select which values should be filtered on and whether it is a equals, not equals, greater than or less than type of operator. If I'll have time I'll whip up an example of what I mean :)
Regarding the the json structures provided by Domoticz, what is the difference between a svalue and nvalue?
I honestly don't know. It's not documented that well: https://www.domoticz.com/wiki/Domoticz_API/JSON_URL's
It just says to look at either the database or the cpp code which is less than useful.

As far as I can gather, the nvalue is a command type value and the svalue is the actual data being sent. Which is only relevant for sensors and dimmers but not for simple switches.

krambriw wrote:Based on the above, here is a new version that provides the state in the suffix for on/off switches
__init__.py
Great, that seems to work quite well already. It's probably as much as we can do without some advanced filtering interface.

Re: Domoticz plugin

Posted: Sat Oct 08, 2016 8:32 am
by kalinkamaen
I've just created a new release. Version 0.2 should function with most dimmers as well. Additionally, there is now a debug setting to make debugging a bit easier :)
Great. I will test you new version asap. To busy at work at the moment! :)

Re: Domoticz plugin

Posted: Sun Oct 09, 2016 2:11 pm
by kgschlosser
I have wanted to provide a simple means for EG to be able to run a macro based on what an event is for something like this. something easy for the user to do without getting into scripting. because if you have something like a dim level and the user doesn't know python some for of a point and click operator expression based on what the suffix is would be great. and it would only look at the last "event breakpoint" if you will.


so something like this.


it will check the event if everything matches up to the last "." it will start the processing. but it will read the info after the last dot and do the simple > < >= <= == != kind of operator comparison. but be a point and click thing for the user. but this would have to be something that is a second kind of trigger event. and in that dialog there would be an option on how to deal with any errors caused by this like print error to log, show dialog with error, trigger event for error and ignore error. and you could also have a selection box to have the user select what kind of data to compare if it's going to be a number, or text. I have also wanted to provide a means to "record" the events that take place and provide a list to select from if you want to add an event. and it would break them down by the plugin that generated the event, and then seperate the event by the "midfix" and "suffix" and if there are more then 2 "."'s then everything between the first and last is considered the "midfix"


but what I have done in my Vera plugin which is very similar to the Domoticz is the event would be this.
each of these are a "." item

event prefix - usually the name of the lighting controller
controller name - because the Vera allows for multiple controllers in a single network
room name - what room the event took place in
device name - the name the user has given to the device
device type - eg. Dimmer Switch, Binary Switch, Alarm Sensor ect....
device event - and this would be the event type. so a dimmer would be "Level", a switch would be "State"
device Value - and the actual device state or the value of what has happened. Switch would be On/Off, Dimmer would be a str, float of the level



so it would look like this

MicasaVerdeVera.Controller1.LivingRoom.OverheadLight.Dimmer.Level.25.5
or

MicasaVerdeVera.Controller1.Hallway.Thermostat.Heat.SetPoint.72.5
MicasaVerdeVera.Controller1.Hallway.Thermostat.Fan.Mode.ContinuousOn


just about everything i have thrown as this event scheme seems to fir in and is pretty easy to use. because all the data from the controller should be separated in this fashion. in the form of variable names or service names

I know there is a horrible amount of "."'s but with the new EG doing wild carded events. (another thing i would like to have a dialog for using) that makes it nice vecause you have greater options on triggering an event for something.

Re: Domoticz plugin

Posted: Mon Oct 10, 2016 9:27 am
by kalinkamaen
With this mqtt plugin, do I need to do something in domoticz? I am using this port number:
Remote Shared Port (For Remote Domoticz clients): is it correct? You find it i domoticz/settings

Re: Domoticz plugin

Posted: Mon Oct 10, 2016 10:06 am
by WoLpH
Oops... looks like I forgot a step in the process.

Within domoticz you need to enable the mqtt hardware device
Screen Shot 2016-10-10 at 12.05.46.png

Re: Domoticz plugin

Posted: Mon Oct 10, 2016 1:25 pm
by kalinkamaen
Still problems with connection.

Code: Select all

Retrying to re-connect
MQTT Client: Trying to reconnect with...domoticz/out 192.168.xx.xxx
Domoticz error
16-10-10 15:37:34.660 MQTT: Connecting to xxx.x.x.x:xxx
2016-10-10 15:37:35.664 Error: MQTT: Failed to start, return code: 14 (Check IP/Port)

Re: Domoticz plugin

Posted: Mon Oct 10, 2016 2:06 pm
by WoLpH
In that case mosquitto is not running. With the raspberry pi version of domoticz that's enabled by default as far as I know. If not you'll have to install and start it.

The official domoticz wiki has some info: https://www.domoticz.com/wiki/MQTT#Installing_Mosquitto

Re: Domoticz plugin

Posted: Mon Oct 10, 2016 6:54 pm
by kalinkamaen
Oki :( I have tried to install Mosquitto but i cant get it to work on windows.

Re: Domoticz plugin

Posted: Mon Oct 10, 2016 7:00 pm
by WoLpH
Which version have you tried? I'm not sure how nice it really works but they have Windows builds: https://mosquitto.org/download/
Specifically: http://www.eclipse.org/downloads/downlo ... -win32.exe

Re: Domoticz plugin

Posted: Mon Oct 10, 2016 7:11 pm
by kalinkamaen
I have tried Mosquitto, but its not plug and play. You have to install allot of DLL files i can not find!

https://sivatechworld.wordpress.com/201 ... windows-7/

Re: Domoticz plugin

Posted: Mon Oct 10, 2016 7:25 pm
by WoLpH
Wow... That is seriously not plug and play
And I see no alternatives either :(

One alternative could be polling domoticz but that will be either heavy or slow.

Re: Domoticz plugin

Posted: Mon Oct 10, 2016 7:31 pm
by kalinkamaen
:( to bad. Not easy to be a windows user :)