Hauptmenü

Fhem rest api for node js

Begonnen von imranm, 21 September 2017, 13:56:19

Vorheriges Thema - Nächstes Thema

imranm

I am new to Fhem. I like to know that how can I access Fhem api using node js. I am  creating my application for home automation on node js with front end in angular. I will host my application over Orange Pi. I want to communicate with Fhem in my node application and I do not know how to do that.
I am looking for Fhem api that i can hit from my node application and perform my relevant action. For example setting new devices in Fhem through node.Teach them. Get all list of devices available. Turn on/off switches, lights.

I want to be able to add EnOcean based devices
I want to be able to add multiple floors to a building
I want to be able to add multiple rooms to a floor
I want to be able to add multiple products to a room
I want to be able to change (add, delete, move) a product from one room to the other

The main question is how to connect Fhem with node and perform this action. Is there any api exposed from Fhem to do these action

amenomade

You can always control Fhem either with http(s)/curl or with telnet or nc. You will have to cope with authentication and csrfToken, but it should be no problem for you.

Some hints here:

https://wiki.fhem.de/wiki/FHEMWEB#apiWeb_Instanz
https://wiki.fhem.de/wiki/CsrfToken-HowTo
Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

justme1968

there is a nose module to do than somewhere on the forum or on github.

if you want to do it yourself you can also look at alexa-fhem and the homebridge-fhem modules. they are both for node.js
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

amenomade

Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

justme1968

that is one of them. there is also a rest api patch for fhemweb somewhere in the forum.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

imranm

Thanks a lot for the reply. It was great help. Moreover I have few more questions If you guys can help up.

Is there any OrangePi simulator I can use before acutally purchasing a OrangePI device. I searched but was unable to find one.

Secondly, In my application there will be a learning phase. in which the actuators of the software are connected to the end device (e.g. a heater) for the very first time and where the software sets up a connection to the product that needs to be managed. Is there any way to manage new connection by our self. Not by Fhem?

What i have understood so far ever device need to configured first in Fhem.

imranm

I Like to know few basic thing for connection of my angular front End with Fhem. I have read The control of the devices is a simple HTTP call to FHEM.An code example will be real help I donnot know how to do that. Any blog or recent post can great help/

How did you create the connection to FHEM?
What call will I make to know list of devices, In what format it will be? and What it will return to me.What format the result will be in?
Mainly I want to know how to communicate with fhem from a simple node application. What will get and post URL to hit fhem to retirve information.what will be its format.


MadMax-FHEM

FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

imranm


Amenophis86

#9
Please do not double post for the same theme. If you are not satisfied with the answer in the other Posts, ask for more help or specifie you question.

The Topics have been merged.
Aktuell dabei unser neues Haus mit KNX am einrichten. Im nächsten Schritt dann KNX mit FHEM verbinden. Allein zwei Dinge sind dabei selten: Zeit und Geld...