Jump to content

Recommended Posts

Hi to you all!

 

Maybe you know that I'm a critical HC2 user since 2013. In short, as I mention here I was feeling the Fibaro was holding me back in possibilities, privacy and security. So I started to investigate to get more control over what I think was important to me. I said I would abandon the HC2.

 

The good news, I will not (for now). After extensive testing and trying to find a proper configuration, I found a way to implement the HC2, demanding my needs and wishes concerning:

  1. Security
  2. Privacy
  3. Possibilities
  4. Time to spend (re-configuring 200+ devices, 50 scenes and 30 Virtual Devices)

The solution I'm implementing is a Raspberry Pi 3 with Node-Red for all communications from the HC2. In short, this means using the HC2 solely as a Z-wave controller and automation gateway.

 

Setup:

- The Node-Red will receive commands from the HC2 by an encrypted (https) and password protected connection. At this point it's still one way by sending from the HC2 to Node-Red. 

- The HC2 is (will be) blocked from internet access. Internet access to the HC2 will be done by VPN.

- All other domotica devices are on a separate subnet (VLAN).

- All messages (email/push/Telegram) is processed by Node-Red. (disabling all Fibaro 'services').

 

Example:

An alarm is breached:

- HC2 will send a message by https to Node-Red.

- Node-Red sends IP-Camera snapshots to own email-server, push-account or private Telegram-bot.

- Node-Red will check my Ubiquiti manage-switch to check if someone is at home (Mobile phone present in LAN) at will send result to push or Telegram.

 

For sending data to Node-Red a scene is used with content of 5 Global Variable, triggered by one:

  • SC_Nred_VarName (Name variable to send. used as trigger, must be written as last)
  • SC_Nred_VarVal (Value to send)
  • SC_Nred_VarType (not used yet, could be used for sending the type of value, like string, date, time etc.)
  • SC_Nred_VarLog (data for storing data in Node-Red logfiles)
  • SC_Nred_VarPath (path to the Node-Red http-receive-node, default /hc2)

 

The scene code (Beta code 20170526):

--[[
%% properties
%% events
%% globals
SC_Nred_VarName
--]]
--
-- Initialisation of user settings (change if necessary)
--
	-- Global variables (has to be added manually in HC2 variables panel)
local globVarName = 'SC_Nred_VarName'; -- Name of global variable to send (trigger!)
local globVarValue = 'SC_Nred_VarVal'; -- Value of global variable to send
local globVarType = 'SC_Nred_VarType'; -- Type of global variable to send
local globVarLog = 'SC_Nred_VarLog'; -- Logmessage to send
local globVarPath = 'SC_Nred_VarPath'; -- Node-Red http-node path to interact with
	-- Node-Red server connections credentials
local nredIp = '192.168.x.x'; -- Node-RED server IP-address
local nredPort = 1880; -- Node-Red server port number
local nredUser = 'HC2'; -- Node-Red user used to change variables
local nredPass = 'XXXXXXXXXXXXXXXX'; -- Node-Red password of used user
	-- Node-Red server credentials options: true = Enable, false = Disable
local nredUseLogin = false; -- TODO!! Option to use user/password login (default = false)
local nredUseSecure = true; -- Option to use secure https connections (default = true)
	-- Node-Red http-node settings
local nredPathDefault = 'hc2'; -- Default Node-Red http-node path to interact with
local nredVarName = 'name'; -- Node-Red http-node option for variable name
local nredVarValue = 'value'; -- Node-Red http-node option for variable value
local nredVarType = 'type'; -- Node-Red http-node option for variable type
local nredVarLog = 'log'; -- Node-Red http-node option for variable log
	-- Debug options: true = Enable (default), false = Disable
local debug = true;
--
-- Funtions (do not change)
--
	-- Debug and Log
local function log(str) if debug then fibaro:debug('<font color="yellow">'..str..'</font>'); end; end
local function errorlog(str) fibaro:debug('<font color="red">'..str..'</font>'); end   
--
-- Code (do not change)
--
	-- Prevents the scene from running when command is 0
if (tonumber(fibaro:getGlobalValue(globVarName)) == 0) then
  fibaro:abort();
end
	-- Get variable content from global variable and convert to usable values	
		-- Name value content
local nredName = fibaro:getGlobalValue(globVarName);
local nredName = string.gsub(nredName,'%s','%%20'); -- Replace <space> with %20
local nredName = string.gsub((nredName),'?','%%3F'); -- Replace ? with %3F
--local nredName = string.gsub((nredName),'%','%%25'); -- TODO! Replace % with %25
		-- Value content
local nredValue = fibaro:getGlobalValue(globVarValue);
local nredValue = string.gsub((nredValue), '%s', '%%20'); -- Replace <space> with %20
local nredValue = string.gsub((nredValue),'?','%%3F'); -- Replace ? with %3F
--local nredValue = string.gsub((nredValue),'%','%%25'); -- TODO! Replace % with %25
		-- Type value content
local nredType = fibaro:getGlobalValue(globVarType);
local nredType = string.gsub((nredType), '%s', '%%20'); -- Replace <space> with %20
local nredType = string.gsub((nredType),'?','%%3F'); -- Replace ? with %3F
--local nredType = string.gsub((nredType),'%','%%25'); -- TODO! Replace % with %25
		-- Log value content
local nredLog = fibaro:getGlobalValue(globVarLog);
local nredLogIsChanged = '';
if nredLog == '' or nredLog == nil then
  nredLogIsChanged = ' is changed to';
  nredLog = os.date("%d/%m/%Y %X ")..': '..nredName..' --> '..nredValue;
  end
if debug then fibaro:debug('Logcontent'..nredLogIsChanged..': '..nredLog) end;
local nredLog = string.gsub((nredLog), '%s', '%%20'); -- Replace <space> with %20
local nredLog = string.gsub((nredLog),'?','%%3F'); -- Replace ? with %3F
		-- Node-Red http-node path value
local nredPath = fibaro:getGlobalValue(globVarPath);
if debug then fibaro:debug('Node-RED Path: '..nredPath) end;
if nredPath == '' or nredPath == nil then
  nredPath = nredPathDefault;
  end
local nredPath = string.gsub((nredPath), '%s', '%%20'); -- Replace <space> with %20
local nredPath = string.gsub((nredPath),'?','%%3F'); -- Replace ? with %3F
-- Construct API URL
if nredUseSecure then
  urlPre = 'https';
  else
  urlPre = 'http';
  end
local apiURL = urlPre..'://'..nredIp..':'..nredPort..'/'..tostring(nredPath)..'?'..tostring(nredVarName)..'='..tostring(nredName)..'&'..tostring(nredVarValue)..'='..tostring(nredValue)..'&'..tostring(nredVarType)..'='..tostring(nredType)..'&'..tostring(nredVarLog)..'='..tostring(nredLog);

if debug then log(apiURL) end;
	-- Initialisation of communication to Node-Red
local selfHttp = net.HTTPClient();
	-- Sending HTTP apiURL
selfHttp:request(apiURL, {
  options={
    headers = selfHttp.controlHeaders,
    data = requestBody,
    method = 'GET',
    timeout = 5000
  },
  success = function(status)
    local result = json.decode(status.data);
    if result.status == 'OK' then
    if debug then log('<font color="green">Respond is OK</font>') end;
    else
      errorlog('failed');
      if debug then log(status.data) end;
    end
  end,
  error = function(error)
    errorlog("ERROR");
    if debug then log(error) end;
  end
})
-- Reset the global command variable to 0 and empty all other global variables
fibaro:setGlobal(globVarValue, '');
fibaro:setGlobal(globVarType, '');
fibaro:setGlobal(globVarLog, '');
fibaro:setGlobal(globVarPath, '');
fibaro:setGlobal(globVarName, '0'); -- Trigger variable, write as last

 

To actually send data, a Virtual Device can be used with buttons to write values to the proper global variables.

For example (when balcony security is breached, VD report-label name = RedNodeAlarmLabel):

--
-- Initialisation of user settings (change if necessary)
--
	-- Global variables (has to be present in HC2 variables panel)
local globVarName = 'SC_Nred_VarName'; -- Global variable used for Node-RED variable name
local globVarValue = 'SC_Nred_VarVal'; -- Global variable used for Node-Red variable value
local globVarType = 'SC_Nred_VarType'; -- Global variable used for Node-Red variable type
local globVarLog = 'SC_Nred_VarLog'; -- Global variable used for Node-Red variable Log (String)
local globVarPath = 'SC_Nred_VarPath'; -- Node-Red http-node path to interact with
	-- Symbol and text table
local symbolTable = {		-- Symbols to show in this VD
  buttonIcon	=	'Balcony',	-- Symbol representing activating this button (for VD Label)
  buttonText	=	'Alarm', -- Text representing activating this button (for external log)
  timeLastRun	= 	'Time: '		-- Symbol representing time of last run
  }
	-- Node-Red http-node values to send
local sendName = 'HC2_Alarm_Balcony'; -- Node-Red variable name to use
local sendValue = 'Balcony'; -- Node-Red variable value to use
local sendType = '2'; -- Node-Red variable type to use
-- Types:	  0 = Integer, e.g. -1, 1, 0, 2, 10 
--            1 = Float, e.g. -1.1, 1.2, 3.1
--            2 = String
--            3 = Date in format DD/MM/YYYY
--            4 = Time in 24 hr format HH:MM
--            5 = DateTime (but the format is not checked)
local sendLog = tostring(symbolTable.buttonText.. os.date(" %d/%m/%Y %X ")..symbolTable.buttonText..' --> '..sendValue);
local sendPath = 'hc2_alarm';
-- Debug options
local debug = true; -- Enable (default, true) or disable (false) general debug output
local debugCommands = true; -- Enable (true) or disable (false, default) debug output of command sending to Homey
-- ------------------------------------------------------------------------------------------
-- Initialisation of code (do not change unless you know what you are doing!)
-- ------------------------------------------------------------------------------------------
local selfId = fibaro:getSelfId(); local selfLabel = 'RedNodeAlarmLabel';
local function debugLog(_logString, _logStringColor, _logValue, _logValueColor)
  fibaro:debug('<span style="color:'.._logStringColor..'"> '..tostring(_logString)..' </span><span style="color:'.._logValueColor..'"> '..tostring(_logValue)..'</span>');
  end
-- ------------------------------------------------------------------------------------------
-- Code (do not change)
-- ------------------------------------------------------------------------------------------
	-- store values (store scene-trigger as the last)
fibaro:setGlobal(globVarValue, sendValue);
fibaro:setGlobal(globVarType, sendType);
fibaro:setGlobal(globVarLog, sendLog);
fibaro:setGlobal(globVarPath, sendPath);
fibaro:setGlobal(globVarName, sendName); -- Scene-trigger
fibaro:call(selfId, "setProperty", "ui."..selfLabel..".value", symbolTable.buttonIcon..' '..symbolTable.timeLastRun.. os.date(" %d/%m/%Y %X "));
fibaro:log(symbolTable.buttonIcon);
  if debugCommands then debugLog(symbolTable.buttonIcon..' '..symbolTable.timeLastRun.. os.date(" %d/%m/%Y %X. "), 'orange', 'Variable name: '..sendName..', type: '..sendType..', value: '..sendValue, 'yellow') end;

 

Node-Red Nodes examples:

Receiving data and respond with 'OK'

Screenshot_20170526_Node-Red-Receive.thumb.png.79315d2ae4b2099894dc8a29c5e2915b.png

Processing content of received values:

Screenshot_20170526-Node-Red-Value-Handling.thumb.png.1630db8fbbf37dc34ea443903d54881f.png

Example Commandfilter code with 5 outputs:

var input = { payload: msg.payload }; // Output 1 (msg.payload)
var hc2AlarmAlgemeen; // Output 2 (HC2_Alarm_Generic)
var hc2AlarmGarage; // Output 3 (HC2_Alarm_Garage) 
var hc2AlarmBalkon; // Output 4 (HC2_Alarm_Balcony)
var add2Log; // Output 5 (add2Log)
// --> Output 1 (msg.payload)
// Content of payload:
// Name: msg.payload.name
// Value: msg.payload.value
// Type: msg.payload.type
// Log: msg.payload.log
// --> Output 2 (HC2_Alarm Generic)
if (msg.payload.name === "HC2_Alarm_Generic") {
    hc2AlarmAlgemeen = { payload: msg.payload.value };
    add2Log = { payload: msg.payload.log };
 }
// --> Output 3 (HC2_Alarm Garage) 
if (msg.payload.name === "HC2_Alarm_Garage") {
    hc2AlarmGarage = { payload: msg.payload.value };
    add2Log = { payload: msg.payload.log };
 }
 // --> Output 4 (HC2_Alarm Balcony) 
if (msg.payload.name === "HC2_Alarm_Balcony") {
    hc2AlarmBalkon = { payload: msg.payload.value };
    add2Log = { payload: msg.payload.log };
 }
// Set to proper outputs
return [ input, hc2AlarmGeneric, hc2AlarmGarage, hc2AlarmBalcony, add2Log ];

How to get snapshots from IP-camera and send to Telegram:

https://github.com/guidone/node-red-contrib-chatbot/wiki/Examples

 

Updates, changes and additional info:

20170527 Setup Raspberry Pi with Node-Red Short Guide

20171017 Setup Raspberry Pi with MQTT (Mosquitto) Short Guide

 

Beware, this is not out-of-a-box solution. Just want to share this example because the possibilities are huge!

 

Greetings,

Lambik

node-red-hexagon.png

Edited by Lambik
Added short guide for Raspberry Pi and Node-Red Installation
Link to post
Share on other sites
7 minutes ago, petergebruers said:

Thanks for sharing this... in a very elaborate way!

You're welcome! ;D

Link to post
Share on other sites

Hi @Lambik,

 

Nice one. We have something similar. Instead of Node-Red we using Control4. We using HCL as a Z-Wave gateway.

Edited by jakub.jezek
Link to post
Share on other sites

Thank you @Bodyart @jakub.jezek @Guest.

If you have any questions (or remarks) when setting up your own, please ask.

 

Some additional info to get you started (steps to take/short guide):

Node-Red is pre-installed on the Raspberry Pi image Jessie with Pixel:

(1) Raspbian Jessie with Pixel download: https://downloads.raspberrypi.org/raspbian_latest

(2) Write image to SD card: https://www.raspberrypi.org/documentation/installation/installing-images/README.md

Remarks: ssh is disabled by default. Enabling by putting a new (empty) file named ssh on the boot partition.

Default user: pi

Default password: raspberry

Command to change default password: passwd

Command to change Raspberry Pi config: sudo raspi-config

Enable VNC (Remote Desktop): raspi-config menu 5 Interface Options --> P3 VNC

Download and install VNCViewer for Remote Desktop access to Rapberry Pi on Laptop/desktop: https://www.realvnc.com/download/viewer/

(3) Introduction to Node-Red (with Node-JS, npm and Mosquitto server setup): https://www.youtube.com/watch?v=WxUTYzxIDns

(4) Securing Node-Red:

https://www.youtube.com/watch?v=_cpqvUoR044

https://www.hardill.me.uk/wordpress/2015/05/11/securing-node-red/

(5) Command to install RedBot (Telegram/Facebook Messenger/Slack/Smooch nodes): npm install node-red-contrib-chatbot

(6) Setup HC --> Node-Red communication (see fist posting)

(7) Use your imagination skills.... ;)

 

22 hours ago, Bodyart said:

Hi @Lambik,

 

great solution you've found there!

Perhaps i'll follow that idea.

FYI, I see you have an Athom Homey. You can use the HTTP request flow card or MQTT Client App to interact with Node-Red.

 

I use this to let Homey say several state-changes. (Like coming home --> Node-Red checks mobile phones connected to LAN --> Homey speaks: Welcome home <names> with Led glowing in several happy colors :) )

Edited by Lambik
Link to post
Share on other sites

@Lambik,

i'm using Homey as a speech machine for Fibaro throu HTTP request flow cards and ofcourse for controlling the RF devices (433MHz).

Link to post
Share on other sites
  • 5 months later...

Setting up a Raspberry MQTT (Mosquitto) Server, to interact with other IoT devices, for use in Node-Red.

 

Install Mosquitto on a Raspberry Pi:

source: https://www.youtube.com/watch?v=WxUTYzxIDns

(at 29:29)

sudo wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key
sudo apt-key add mosquitto-repo.gpg.key
sudo rm mosquitto-repo.gpg.key
cd /etc/apt/sources.list.d/
sudo wget http://repo.mosquitto.org/debian/mosquitto-wheezy.list
sudo apt-get update
sudo apt-get install mosquitto mosquitto-clients python-mosquitto

Test and start Mosquitto:

(at 30:38)

sudo /etc/init.d/mosquitto start

Open 2 consoles on the Raspberry Pi:

Console 1 (Host-testing):

mosquitto_sub -d -t hello/world

Console 2 (Client-testing):

mosquitto_pub -d -t hello/world -m "Hello from Terminal window2"

Subscribe from any IP address:

mosquitto_sub -h <IP ADDRESS RPI> -t hello/world

 

Link to post
Share on other sites

Thank you @Guest! I also experimented and got a working setup for MQTT inside a LAN using a self signed certificate, authorised by a self made CA with use of username/passwords.

 

If anyone is interested I could post a short how-to guide.

 

 

  • Like 1
Link to post
Share on other sites
  • 5 months later...

Thank you @Lambik for sharing your effort! I like to ask if there is a ability to build a universal NodeRED bridge so to be connected with UHAS. I used your MQTT sense for pushing TTS mesages on chromecast/google home devices, pop-up notifications on LG TV (webOS). IMHO is great for everyone if you join forces and build a bridge between these systems (I suppose it just require NodeRED bridge to "understand" what UHAS pushes).

Thank you again for your time.

 

Link to post
Share on other sites

Hi @korniza, nice to hear you like my idea to interact, in an easy way, to NodeRED.

 

Art the moment I only use the HC2 as a pure Z-Wave controller with some automation task. The most is done by NodeRED.

 

It would be very interesting to get a HC2 option/app/whatever to interact with MQTT, because this protocol is very easy to setup/maintain with communication with other IoT platforms and NodeRED.

 

So, if anyone has a (briljant) idea how to get that working, I would be happy to join in.

Link to post
Share on other sites

@Lambik I have a very basic knowledge of everything but not so good to build it by my own. My idea is to have a unique SC_Nred_VarPath and change only the SC_Nred_VarName. After that, a function block will separate the flows according to SC_Nred_VarName and perform an action.

In addition, if we add an extra variable to hold the type of interface we need to send from fibaro to NodeRed, it could be more complicate scenario.

Performing a basic categorize of the messages that could be send from fibaro could be:

 

  • Notifications (sms, tts )
  • Fibaro Device status (send status of a z-wave device on NodeRED)
  • 3rd party devices that can be exist as VD on Fibaro (for example Wemo Devices)
  • Custom (user can send a custom sequence for R&D)

I suppose there are more categories, so everyone is invited to add in the list. After categorize of these messages (a protocol is established) next is to share the protocol with UHAS. I like to help!

 

 

 

Link to post
Share on other sites

The scene mentioned in the first posting is already capable of using different (NodeRed) http-paths. If no path is specified the default path will be used. In short, if you write values to the global variables:

  • SC_Nred_VarVal (Value to send)
  • SC_Nred_VarType (not used yet, could be used for sending the type of value, like string, date, time etc.)
  • SC_Nred_VarLog (data for storing data in Node-Red logfiles)
  • SC_Nred_VarPath (path to the Node-Red http-receive-node, default /hc2)

And trigger the scene by write a value to SC_Nred_VarName it will construct a http(s) command:

<urlPre>://<nredIp>:<nredPort>/<PATH>?name=<NAME>&value=<VALUE>&type=<TYPE>&log=<LOG>

 

where the local configurable variables in the scene are:

<urlPre> = http or https

<nredIp> =  IP-address of your Raspberry Pi NodeRed server

<nredPort> = Used port of your NodeRED

 

So, in your NodeRED server you can receive the commands (http in node, method: get, url: <PATH>) and you can recognise/split them and send them to a separate output by using a funtion node. For example:
 

// Variables
var input = { payload: msg.payload }; // Output 1 (msg.payload)
var bewonersStat; // Output 2 (HC2_Bewonersstatus)
var bewegingsMeld; // Output 3 (HC2_Beweging)
var WOL; // output 4 (WOL)
var add2Log; // Output 5 (add2Log)
// --> Output 1 (msg.payload)
// Content of payload:
// Name: msg.payload.name
// Value: msg.payload.value
// Type: msg.payload.type
// Log: msg.payload.log
// --> Output 2 (HC2_Bewonersstatus)
if (msg.payload.name === "HC2_Bewonersstatus") {
    bewonersStat = { payload: msg.payload.value };
    add2Log = { payload: msg.payload.log };
 }
// --> Output 3 (HC2_Beweging)
if (msg.payload.name === "HC2_Beweging") {
    bewegingsMeld = { payload: msg.payload.value };
    add2Log = { payload: msg.payload.log };
 }
 // --> Output 4 (HC2_WOL)
 if (msg.payload.name === "HC2_WOL") {
    WOL = { payload: msg.payload.value };
    add2Log = { payload: msg.payload.log };
 }
// Set to proper outputs
return [ input, bewonersStat, bewegingsMeld, WOL, add2Log ];

In this example the received (Dutch named) names are recognised (compared) and the values are directed to the different funtion outputs for further handling.

 

For example,  if a msg.payload.name is received with a content HC2_Bewonersstatus, the msg.payload.value will be directed to the second function node output. This will be redirected/stored in msg.payload for further handling.

The 5th output is used to store the log value, when one of the names is recognised.

 

In short, you can construct any path you want, with any name and value you want. My advise is to send data from the HC2 to NodeRED as simple as possible, and let NoderRED do the handling. You can easily direct values to MQTT and even send messages to Telegram. I don't use the HC2 Telegram scene  anymore, but just send the text to NodeRED and let NodeRED send the messages to Telegram using the node-red-contrib-chatbot pallet. These special Telegram nodes can be installed by using the 'Manage pallet' in the NodeRED menu.

 

The only things to do is to make code to receive from NodeRED to the the HC2. I know this is possible by using the HC2-REST-API but this can only be done unencrypted, so far as I know of, which I find, personally, unacceptable.

 

I hope my explanation is clear enough for you to get you started.... ;)

Link to post
Share on other sites
  • 2 weeks later...
  • 2 months later...

hey guys there is a new node in node-red called

node-red-contrib-fibaro-hc2

 

install it trough node-red

  • Like 1
  • Thanks 1
Link to post
Share on other sites
12 hours ago, ctyd said:

 

install it trough node-red

Welcome! I am always open to discussion and new ideas!

 

thank you!

simple example:

axFkzYC6O3.png

 

y8lzXUNe7d.png

 

 

flow source: 

 

[{"id":"cd8688a4.3405f8","type":"subflow","name":"hc2-send-command","info":"","in":[{"x":400,"y":160,"wires":[{"id":"23a05577.fdc63a"}]}],"out":[]},{"id":"a6e21238.c9091","type":"mqtt out","z":"cd8688a4.3405f8","name":"HC2","topic":"","qos":"","retain":"","broker":"1ef1d9e1.8791d6","x":710,"y":160,"wires":[]},{"id":"23a05577.fdc63a","type":"function","z":"cd8688a4.3405f8","name":"to command","func":"var topic = msg.topic\nvar paths = topic.split(\"/\")\nvar value = msg.payload\nmsg.topic=paths[0] + \"/\" + \"command\"+ \"/\" + paths[2]\n\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":160,"wires":[["a6e21238.c9091"]]},{"id":"1ef1d9e1.8791d6","type":"mqtt-broker","z":"","name":"nas","broker":"192.168.1.29","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"9707a2e2.c1629","type":"ui_switch","z":"e46aea38.4a0048","name":"","label":"Torchere","group":"5f40ac0f.019554","order":1,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"home/status/cabinet_torchere","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":700,"y":120,"wires":[["7f84d852.ca87f8"]]},{"id":"f2706cde.8288","type":"ui_switch","z":"e46aea38.4a0048","name":"","label":"Fan","group":"5f40ac0f.019554","order":2,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"home/status/cabinet_fan","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":690,"y":200,"wires":[["7f84d852.ca87f8"]]},{"id":"f28a2327.a5a38","type":"json","z":"e46aea38.4a0048","name":"","property":"payload","action":"","pretty":false,"x":510,"y":120,"wires":[["9707a2e2.c1629"]]},{"id":"b34d9d55.9a6c4","type":"json","z":"e46aea38.4a0048","name":"","property":"payload","action":"","pretty":false,"x":510,"y":200,"wires":[["f2706cde.8288"]]},{"id":"7f84d852.ca87f8","type":"subflow:cd8688a4.3405f8","z":"e46aea38.4a0048","name":"","x":960,"y":180,"wires":[]},{"id":"b7b6aa2.f4d1058","type":"ui_slider","z":"e46aea38.4a0048","name":"","label":"LED strip","group":"5f40ac0f.019554","order":3,"width":0,"height":0,"passthru":true,"topic":"home/command/cabinet_led_strip","min":0,"max":"100","step":1,"x":700,"y":280,"wires":[["7f84d852.ca87f8"]]},{"id":"59ef5168.5509c","type":"json","z":"e46aea38.4a0048","name":"","property":"payload","action":"","pretty":false,"x":510,"y":280,"wires":[["b7b6aa2.f4d1058"]]},{"id":"7003ad76.dcddc4","type":"ui_gauge","z":"e46aea38.4a0048","name":"Temperature","group":"9255b911.d1b6c8","order":7,"width":0,"height":0,"gtype":"gage","title":"Temperature","label":"°С","format":"{{value}}","min":"-10","max":"40","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":710,"y":460,"wires":[]},{"id":"f7ec851a.14eb38","type":"ui_gauge","z":"e46aea38.4a0048","name":"Humidity","group":"9255b911.d1b6c8","order":6,"width":0,"height":0,"gtype":"gage","title":"Humidity","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":700,"y":540,"wires":[]},{"id":"41199998.a422e8","type":"debug","z":"e46aea38.4a0048","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":710,"y":380,"wires":[]},{"id":"1cabd614.dce82a","type":"json","z":"e46aea38.4a0048","name":"","property":"payload","action":"","pretty":false,"x":550,"y":460,"wires":[["7003ad76.dcddc4","7174fc6c.898724"]]},{"id":"a7723498.831668","type":"json","z":"e46aea38.4a0048","name":"","property":"payload","action":"","pretty":false,"x":530,"y":540,"wires":[["f7ec851a.14eb38"]]},{"id":"ee0408c0.3181b8","type":"ui_colour_picker","z":"e46aea38.4a0048","name":"","label":"","group":"5f40ac0f.019554","format":"hex","outformat":"string","showSwatch":true,"showPicker":false,"showValue":true,"showHue":false,"showAlpha":false,"showLightness":true,"dynOutput":"false","order":4,"width":0,"height":0,"passthru":true,"topic":"home/command/cabinet_led_strip","x":710,"y":340,"wires":[["7f84d852.ca87f8"]]},{"id":"4eebc0b6.c7b57","type":"function","z":"e46aea38.4a0048","name":"rgb2hex","func":"function rgb2hex(red, green, blue) {\n    var rgb = blue | (green << 8) | (red << 16);\n    return '#' + (0x1000000 + rgb).toString(16).slice(1)\n}\n  \nvar rgb = msg.payload.split(',');\nmsg.payload = rgb2hex(parseInt(rgb[0]), parseInt(rgb[1]), parseInt(rgb[2]));\nreturn msg;","outputs":1,"noerr":0,"x":540,"y":340,"wires":[["ee0408c0.3181b8","41199998.a422e8"]]},{"id":"7174fc6c.898724","type":"ui_chart","z":"e46aea38.4a0048","name":"","group":"9255b911.d1b6c8","order":5,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":690,"y":500,"wires":[[],[]]},{"id":"5eb339f5.3dbac8","type":"hc2-device","z":"e46aea38.4a0048","name":"Cabinet Temperature","deviceID":"cabinet_temperature/value","x":360,"y":460,"wires":[["1cabd614.dce82a"]]},{"id":"f3435057.97469","type":"hc2-device","z":"e46aea38.4a0048","name":"Cabinet Humidity","deviceID":"cabinet_humidity/value","x":350,"y":540,"wires":[["a7723498.831668"]]},{"id":"bc257676.ce8058","type":"hc2-device","z":"e46aea38.4a0048","name":"cabinet_torchere","deviceID":"cabinet_torchere/value","x":350,"y":120,"wires":[["f28a2327.a5a38"]]},{"id":"b20894a4.ff3f08","type":"hc2-device","z":"e46aea38.4a0048","name":"cabinet_fan","deviceID":"cabinet_fan/value","x":330,"y":200,"wires":[["b34d9d55.9a6c4"]]},{"id":"2fd1a652.f9f39a","type":"hc2-device","z":"e46aea38.4a0048","name":"cabinet_led_strip","deviceID":"cabinet_led_strip/value","x":350,"y":280,"wires":[["59ef5168.5509c"]]},{"id":"bf753627.fbf818","type":"hc2-device","z":"e46aea38.4a0048","name":"cabinet_led_strip color","deviceID":"cabinet_led_strip/color","x":360,"y":340,"wires":[["4eebc0b6.c7b57"]]},{"id":"93f099ce.380fe8","type":"mqtt in","z":"e46aea38.4a0048","name":"","topic":"home/status/#","qos":"2","broker":"1ef1d9e1.8791d6","x":90,"y":60,"wires":[["f3435057.97469","5eb339f5.3dbac8","bf753627.fbf818","2fd1a652.f9f39a","b20894a4.ff3f08","bc257676.ce8058"]]},{"id":"5f40ac0f.019554","type":"ui_group","z":"","name":"Control","tab":"a538abb1.727718","disp":true,"width":"6","collapse":false},{"id":"9255b911.d1b6c8","type":"ui_group","z":"","name":"Sensors","tab":"a538abb1.727718","order":2,"disp":true,"width":"6","collapse":false},{"id":"a538abb1.727718","type":"ui_tab","z":"","name":"Cabinet","icon":"dashboard","order":2}]

 

Edited by 10der
  • Thanks 1
Link to post
Share on other sites

I'm trying to understand when to use Node-Red with HC2.

 

Are you using Node-Red for inter-device communication? Or also for light scene/wallplug switching?

For example, at night the Fibaro eye detects motion and sets the light dimmed at 10%, now I programmed this in a scene. Do you program this with Node-Red? Or are you using it for third party inter-device communication only?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...