ioBroker / AdapterRequests

This Place is used to track the status of new Adapter-Requests.
248 stars 36 forks source link

Convert rules from pimatic to ioBroker / Create rules similar to pimatic in ioBroker #663

Open thrusty66 opened 2 years ago

thrusty66 commented 2 years ago

I would like to know if it is possible to develop an adapter to export rules from pimatic (https://pimatic.org/) and use them in ioBrocker. Optimal would be a RuleEngine like the one used in pimatic. According to the principle: when- then, where the possibilities are always displayed in a dropdown. I have no idea about programming and also not if such a thing could be possible at all. But to create this kind of rules is quite simple and would certainly make it easier for many users to fill the SmartHome with life with their own rules.

Ich würde gern wissen ob es möglich ist einen Adapter zu entwickeln, mit dem es möglich ist Rules aus pimatic (https://pimatic.org/) zu exportieren und in ioBrocker zu verwenden. Optimal wäre eine RuleEngine wie sie in pimatic verwendet wird. Nach dem Prinzip: when- then, wobei immer gleich die Möglichkeiten in einem Dropdown angezeigt werden. Ich habe keine Ahnung vom programmieren und auch nicht ob so etwas überhaupt möglich sein könnte. Aber diese Art Rules zu erstellen ist recht einfach und würde es sicher vielen Usern erleichtern mit eigenen Rules das SmartHome mit Leben zu füllen.

Apollon77 commented 2 years ago

Are the JavaScript adater "Rules" based not the same? Yes the interface is different, bit functionality wise?

thrusty66 commented 2 years ago

The JavaScript adaters based on "rules" are unfortunately not the same. The functionality is also completely different. I don't know how to explain this. Probably you have to try it and see. I've pasted a small snippet of my Rules here. What is behind a $ is a variable. Either self created or one from the system. the system creates at least one variable from each device. Actually similar to ioBroker, where everything becomes a datapoint.

{
      "id": "iphone",
      "name": "iPhone",
      "rule": "when iPhone.fritz.box is absent then set $iphone to 1 after 2 hours",
      "active": true,
      "logging": true
    },
    {
      "id": "iphone-licht",
      "name": "iPhone Licht",
      "rule": "when iPhone.fritz.box is present and $wettersensor.BH1750.Illuminance <= 5 and if $iphone = 1 then set $iphone to 0 and dim Wandlampe to 10 and turn Eingang 4LED on",
      "active": true,
      "logging": true
    },
    {
      "id": "rolladen-variable-andern-vorwarts",
      "name": "Rolladen-Variable-ändern-vorwärts",
      "rule": "when $raspbee_60a423fffef25c76.switch = \"5002\" and if $rolladen-variable < 5 then set $rolladen-variable to $rolladen-variable + 1",
      "active": true,
      "logging": true
    },
    {
      "id": "rolladen-variable-andern-ruckwarts",
      "name": "Rolladen-Variable-ändern-rückwärts",
      "rule": "when $raspbee_60a423fffef25c76.switch = \"4002\" and if $rolladen-variable > 1 then set $rolladen-variable to $rolladen-variable - 1",
      "active": true,
      "logging": true
    },
    {
      "id": "rolladendisplay_wohnzimmer",
      "name": "RolladenDisplay Wohnzimmer",
      "rule": "when $rolladen-variable gets updated and if $rolladen-variable = 1 then publish mqtt message \"[zOs2c1l1f0Ci2]Rolladen 1[s2c1l3f0Ci3]Wohnzimmer[s2c1l5f0Ci10]\" on topic \"cmnd/ssd1351/Displaytext\" on broker 192.168.178.31",
      "active": false,
      "logging": true
    },
    {
      "id": "rolladendisplay_schlafzimmer",
      "name": "RolladenDisplay Schlafzimmer",
      "rule": "when $rolladen-variable gets updated and if $rolladen-variable = 2 then publish mqtt message \"[zOs2c1l1f0Ci2]Rolladen 2[s2c1l3f0Ci3]Schlaf-[s2c1l5f0Ci10]zimmer\" on topic \"cmnd/ssd1351/Displaytext\" on broker 192.168.178.31",
      "active": true,
      "logging": true
    },
    {
      "id": "rolladendisplay_lennarts_zimmer",
      "name": "RolladenDisplay Lennarts Zimmer",
      "rule": "when $rolladen-variable gets updated and if $rolladen-variable = 3 then publish mqtt message \"[zOs2c1l1f0Ci2]Rolladen 3[s2c1l3f0Ci3]Lennarts[s2c1l5f0Ci10]Zimmer\" on topic \"cmnd/ssd1351/Displaytext\" on broker 192.168.178.31",
      "active": true,
      "logging": true
    },
    {
      "id": "rolladendisplay_kueche_west",
      "name": "RolladenDisplay Kueche West kleines Fenster",
      "rule": "when $rolladen-variable gets updated and if $rolladen-variable = 4 then publish mqtt message \"[zOs2c1l1f0Ci2]Rolladen 4[s2c1l3f0Ci3]Kueche West[s2c1l5f0Ci10]kl. Fenster\" on topic \"cmnd/ssd1351/Displaytext\" on broker 192.168.178.31",
      "active": true,
      "logging": true
    },
    {
      "id": "rolladendisplay_kueche_nord",
      "name": "RolladenDisplay Kueche Nord großes Fenster",
      "rule": "when $rolladen-variable gets updated and if $rolladen-variable = 5 then publish mqtt message \"[zOs2c1l1f0Ci2]Rolladen 5[s2c1l3f0Ci3]Kueche Nord[s2c1l5f0Ci10]gr. Fenster\" on topic \"cmnd/ssd1351/Displaytext\" on broker 192.168.178.31",
      "active": true,
      "logging": true
    },
foxriver76 commented 2 years ago

hard to spot the difference on a json only example, maybe a screenshot would help.

UncleSamSwiss commented 2 years ago

From what I can tell (in the now formatted JSON), it is about writing rules in natural language. This is in fact an interesting idea, but it would mean to have a fourth way of writing scripts (after JS/TS, Blockly and Rules).

thrusty66 commented 2 years ago

The whole thing then looks visually like this.

Bild für die README hochladen

And when I edit it, I always get a selection dropdown with what is currently possible.

Upload

thrusty66 commented 2 years ago

And the same in text mode and with another selection.

upload 2

And a new rule start with this: new rule or with only text.. Bildschirmfoto 2021-09-08 um 20 19 06

thrusty66 commented 1 year ago

@UncleSamSwiss

Some time ago I asked here if there is a possibility to implement a rule engine similar to the one used by Pimatic in ioBroker. "https://github.com/ioBroker/AdapterRequests/issues/663" I think with this kind of rules you could win a lot of users, even users who have no idea about programming. You don't seem to be averse to the idea. Are there any efforts to integrate something like this into ioBroker?

Apollon77 commented 1 year ago

In fact we have Blockly, and also the new "Rulez" system ... so the question is what exactly is missing here that is available in the pimatic rules engine compared to these systems and options ... if you like to implement it ... go ahead and deliver a PR or adapter :-)