Development of a Gladys v4 module, how to do it?

Hello everyone,

Everything is in the title: I have equipment that is not yet supported under v4, and I therefore want to develop suitable modules (connected outlets « LIDL », without known alternative firmware, but controllable via HTTP, which is currently the case in my home mini-application). How to proceed and where to start (to have the basics and respect the standards)?

Thanks in advance,
Looking forward to your replies,
Jean

Hello!

The best for you is to get inspired by the existing modules!

The link above is the list of « back » modules.

For the front end: Gladys/front/src/routes/integration/all at master · GladysAssistant/Gladys · GitHub

Don’t hesitate to make a PR so that someone can help you if needed.

You have a service that is an example, you can get inspired by it and it seems to me that it uses HTTP requests. So exactly what you need :slight_smile:

Indeed, the best approach is to read the code of existing services :slight_smile:

There is also a tutorial in the documentation:

The links point to
https://github.com/GladysAssistant/gladys-4-playground/. I think this needs to be updated.

I created an issue →

https://github.com/GladysAssistant/gladys-4-docs/issues/14

If anyone wants to make a PR :slight_smile:

Good evening. Not having had the time, nor taken the time to develop a module for Gladys, I am now wondering about it from another angle. Indeed, I am playing with Tasmota and the integration is frankly very simple, via MQTT. I therefore wonder if it would not be simpler to rewrite my Python code that interfaces a home API to make it support MQTT, since what is controlled is an automatic watering system (homemade based on a Raspberry PI Zero W …), so totally adaptable … Currently, the watering circuit is controlled via an HTTP request: http://watering/{set,get}/{pump}/{on,off}.

What do you think?

Thanks in advance for your comments which will be precious for me.

Looking forward to hearing from you,
Jean

You can do even better: no coding at all :smiley:

Code-free method

Since Gladys v4.0.3, you can make an HTTP request in scenes (see doc → Faire des requêtes HTTP dans une scène | Gladys Assistant)

You can therefore use this action to call the API of your automatic watering system.

If you want to have a device in Gladys to manually control your device, you can create a « virtual » device in the MQTT integration, and then in the scenes, when the device goes to 1, send an HTTP request to turn on the watering, and when it goes to 0, send an HTTP request to turn off the watering.

Method via MQTT

Otherwise, you can indeed make an MQTT script that will allow you to turn your watering system on/off.

We have MQTT API documentation on the site:

I also made a video on the subject recently:

(In the second part of the video, I take the example of an on/off, so like what you want to do)

Good evening @pierre-gilles,

The scenes are created, but… I think we can do better, as I have two scenes per solenoid valve to control (one scene turns on, the other turns off), as the URL contains the ID of the solenoid valve in question and the expected state (ON/1 or OFF/0). I read that it is possible to play with variables, so we can imagine creating a virtual MQTT device (I am actually very interested in knowing how to do this…) that calls a scene with two variables: the ID and the state? Is this possible?

Looking forward to hearing from you,
Thanks,
Jean

The term « virtual » is misleading, you just create an MQTT device, everything is in the documentation.

The notion of « virtual » does not exist in gladys.

Good evening @VonOx,

Thank you for your response, but I’ve spent time looking, without really finding any documentation that would allow me to create the MQTT device in question, and then use it in the dashboard… If it were possible to guide me, that would be really nice (I think I’m not the only one who will appreciate your help…).

Thank you :slight_smile: