FHEM Forum

FHEM => English Corner => Thema gestartet von: kennybl am 27 September 2020, 18:15:53

Titel: Connect to FHEM from own software?
Beitrag von: kennybl am 27 September 2020, 18:15:53
Hello,

Is it possible to connect to FHEM on the same server (raspberry pi) using my own software?
Maybe via PHP, python, javascript etc?

I would like to be able to set desired temperatures to my MAX! radiator thermostats and if possible read the temperatures as accurate (and quickly) as possible?
Do i need telnet or is there a better way to achieve this?
Titel: Antw:Connect to FHEM from own software?
Beitrag von: Otto123 am 27 September 2020, 18:59:33
Hi,

you could achieve this via telnet, but it could be also done over http. I wrote a small set of scripts to be care about the csrf token.
https://github.com/heinz-otto/fhemcl
You could use any FHEM commandline syntax like set, get or {perl} commands and you will get the response.

For some programming languages there will be also a kind of API libs available.

Otto
Titel: Antw:Connect to FHEM from own software?
Beitrag von: Prof. Dr. Peter Henning am 09 Oktober 2020, 05:11:47
Yes. Apart from the REST API (which is not very well documented, but some good ideas are given here: https://forum.fhem.de/index.php?topic=14491.0)
there is also a Python connector to FHEM.

https://pypi.org/project/fhem/

Regards

pah
Titel: Antw:Connect to FHEM from own software?
Beitrag von: kennybl am 09 Oktober 2020, 19:40:36
Thank you, I will look after that, now I first have to solve some other problems  :o (https://forum.fhem.de/index.php/topic,114896.0.html).
Titel: Antw:Connect to FHEM from own software?
Beitrag von: Sörn am 08 Dezember 2020, 21:16:23
I'd recommend using mqtt for communication among FHEM and other applications. Standardized, simple, supported by fhem and you've got large variety of libs to choose from in your $favourite language ;)


I'm running a custom serial protocol (over RS485) for my switches in my house and using a custom piece of software attached to the serial interfaces translates commands coming from the switches to mqtt.
Titel: Antw:Connect to FHEM from own software?
Beitrag von: Prof. Dr. Peter Henning am 09 Dezember 2020, 18:29:48
Always nice to get recommendations from FHEM newbies...

pah