UNPKG

vistamare-smarthome

Version:

service to manage actions via REST

73 lines (59 loc) 2.8 kB
about vistamare-smarthome THX, based on https://willschenk.com/articles/2019/controlling_ikea_tradfri_with_node/ with node-tradfri-client (npm pkg) and samsung-remote (npm pkg) i wanted to create a central REST-service it received commands via POST ```mermaid graph TD; POST[HTTP Get/Post] ---> NS([node Server]); NS ===> IKEA[IKEA Tradfri Gateway]; NS ===> TV[Samsung TV]; NS ===> scale[scalable ...ZigBee etc. ] NS -.-> |feedback| POST; IKEA ---> LIGHT(Light or another SmartHome Device); TV ---> CTR(TV Set Control Command); ``` -> e.g. { "system":"TV","ID":"65537", "action":"KEY_POWEROFF","value":"0"} or { "system":"IKEA","ID":"65537", "action":"toggle","value":"0"} or { "system":"TUYA","ID":"----device-id----", "IP":"----device IP-adr.-----","key":"------localKEY-(encr)----","action":"toggle","value":"0"} to manage all the different smart-devices in my CASA. At the end i use a normal Android-Phone to put a command via Icon on the screen für every action. Therefore i use the APP HTTP-shortcuts (its one of the greatest app for me). ARguments: 1. input the IKEA-Gateway IP-Adress (lets find out e.g. with fing-app) 2. input your Samsung-TV IP-Adress (lets find out e.g. with fing-app) 3. input your IKEA-Gateway-KEY (backside of the device) into ../util/connection.js 4. username for handshake (you can define by yourself) 5. password for handshake (you can define by yourself) -> e.g run.> node server.js 192.168.0.1 192.168.0.15 123456ABCDEF user password Lets start: - run with: node server.js arg1 arg2 arg3 arg4 arg5 - test with a simple Get: https://192.168.x.x:3000/status?id=all (adapt your server-address) - you must implement your own certificate or accept the testing selfsigned-cert (./security) into your browser - the response from ...?id=all give you the possible devices-IDs; with ...?id=12345 you can ask the curStatus of a device Feature: - get status of one IKEA-device ../status?id=12345 - get info of all available IKEA-Commands - you see in the json-response (e.g.brightness) - get status of all exists IKEA-devices with there ID ../status?id=all - get info of all available TV-Keys (Samsung) ../status?id=tvkeys Possible Device Structure (Smartphone as a Server and Control-Station) ```mermaid classDiagram Smartphone <|--|> IKEA Smartphone <|--|> TV Smartphone: - Shortcut APP [with Widgets] Smartphone: - Termux Linux APP Smartphone: nodejs on Termux() Smartphone: vistamare-smartphone on nodejs() class IKEA{ GATEWAY toggle() } class TV{ Remote Controlled KEY_POWEROFF() } ```