Connect to FHEM from own software?

Begonnen von kennybl, 27 September 2020, 18:15:53

Vorheriges Thema - Nächstes Thema

kennybl

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?

Otto123

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
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

Prof. Dr. Peter Henning

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

kennybl

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).

Sörn

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.
64 Relais + 8xULN2803 + 4x MCP23017 im Schaltschrank für ALLES
Custom Prokoll über RS485 für Taster, Temperatur und Feuchtesensoren

Prof. Dr. Peter Henning

Always nice to get recommendations from FHEM newbies...

pah