Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Search the Community

Showing results for tags 'nodered'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • FIBARO Community
    • FIBARO Portal and Forum policy
    • FIBARO
    • Say hello!
    • Off-topics
  • FIBARO Update
    • FIBARO System Update
    • FIBARO Mobile Update
  • FIBARO Community Support
    • Scenes and Interface
    • FIBARO Products
    • FIBARO Mobile
    • FIBARO HomeKit
    • FIBARO Assistant Integrations
    • Other Devices / Third-party devices
    • Tutorials and Guides
    • Home Automation
    • Suggestions
  • FIBARO Społeczność
    • FIBARO
    • Przywitaj się!
    • Off-topic
  • FIBARO Aktualizacja
    • FIBARO System Aktualizacja
    • FIBARO Mobile Aktualizacja
  • FIBARO Wsparcie Społeczności

Categories

  • Scenes
  • Virtual Devices
  • Quick Apps
  • Icons

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Facebook


Google+


Skype


Website URL


WhatsApp


Country


Gateway/s


Interests

Found 4 results

  1. Can someone help me with Node-Red? I need to tell node-Red to change a global value in HC2. Thanks for the Help
  2. Hello. Totaly new and I have start using nodred now. think it looks good and there ae some good tings to try with the dashbord. Is it possible to use the heating panel i Nodered. If yes, can you explain how to do it. Hve include the light from Hc2 to Nodered and it is working . Also got the "who is home " up and running.
  3. Hello! I have made a small video guide showing a way to announce Fibaro Smart Home events (like someone ringing a doorbell) on Google Home by using Node-Red in between. Might be useful to people who are looking for things like this. Video Link: https://youtu.be/SOx9QfJgwCQ
  4. The genesis of this post was a desire to try and simplify the third party programs (mainly sonos http api, HA bridge & NUT UPS monitor) that I have running on a few Raspberry PI devices. The Goal - Get them all onto one Pi device, move from SD to USB booting and overall make it easier to manage, especially in the case of a crash (ie have a spare usb stick) I currently don't use NodeRed or MQTT but decided to include them as well to see if I could get them all working on a Pi3 I ended up with the following running on a Pi3 from a Sandisk 16gb Cruzer USB memory stick sonos-http-api - https://github.com/jishi/node-sonos-http-api HA bridge - https://github.com/bwssytems/ha-bridge NUT UPS Server - https://networkupstools.org/ NodeRed - https://nodered.org/ Mosquitto MQTT (broker and client) - https://mosquitto.org/ The results can be accessed at Sonos API - http://192.168.1.240:5005/Livingroom/state HA Bridge - http://192.168.1.240/#!/ NodeRed - http://192.168.1.240:1880/ MQTT pub and sub available at 192.168.1.240 NUT UPS service listener at 192.168.1.240:3493 Preface: The following steps worked for me and I referenced some of web pages I used but not all. I use Windows and I don't know the MAC equivalents. My purpose for posting is to document what I did and hopefully this may help some users get started. It is not meant to be a foolproof guide that will work for all. You may come across some issues I never encountered and your best friend is google for resolving those ...af ===== Installing Raspbian Buster Download the zip from https://www.raspberrypi.org/downloads/ Use an application such as Win32DiskImager and a card reader to burn image onto SD Card (or Flash drive) Before removing the SD card from the Card Reader use File explorer to view the content of the SD Card Place a file called SSH (no file extension) into the root folder of the SD Card. This will allow you SSH into the Pi and use it headless Place SD Card into Pi, connect Ethenet and apply power Use Advanced Port Scanner (PC) or Fing (mobile) to find the IP address of the PI Use Putty to SSH into the PI (enter IP address and port 22) Login into Pi Username - pi password - raspberry You can change the password if you like Booting from SD card and then from the USB Flash Drive If you have a Pi3 you can get your Pi to boot from a Flash Drive/Memory Stick. It is documented below but in summary thisisi what you do Initially burn a standard raspbian image on an SD card. You then boot up the Pi using the SD card and run some commands over SSH. This tells the Pi to boot from USB first the next time Burn a standard raspbian image onto a Flash Drive. Remove the SD card and insert the Flash Drive and power on. It can take 20-30 second to boot and get a SSH connection so be patient. Don't forget to add the SH file (no extension) in the root of both the SD Card and Flash Drive/Memory as described above to enable SSH access from each to the Pi Boot up the PI with the SD card and a standard Raspbian Buster Image SSH in the Pi Enter the following commands (one per line) sudo apt-get update && sudo apt-get upgrade echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt vcgencmd otp_dump | grep 17: The last command should give a result like 17:3020000a If not then repeat the above steps Power off pi Remove the SD Card and insert the Flash Drive/Memory Stick into one USB port Add power and ethernet and let it boot (It can take up to 30 seconds to boot up) SSH in as normal and confirm you can log in Use an application like WnSCP if you want to get file access to the card/flash drive while it is running on the Pi References: htps://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md ====== Install NODE.JS & NPM I use Node.js v8 here as there appears to be a conflict between v10 and npm where npm doesn't work correctly. Npm is included in the Node v8 release below Clone/Copy the zip the Pi wget https://nodejs.org/dist/latest-v8.x/node-v8.16.1-linux-armv7l.tar.gz Extract & Install tar -xzf node-v8.16.1-linux-armv7l.tar.gz reboot Pi using sudo reboot Use following commands to verify install node -v npm -v ====== Sonos http api Install Clone http api files to PI sudo git clone https://github.com/jishi/node-sonos-http-api.git List folder contents and change to http-api folder and install the api (enter each one seperately) ls cd node-sonos-http-api sudo npm install --production Start the API Service sudo npm start You should see references to sonos rooms, etc Now open a browser and assuming your sonos zone/room name is Kitchen you can confirm that the api is working by entering the following http://IP of Pi:5005/kitchen/state For me it is http://192.168.1.240:5005/kitchen/state You should see something like {"volume":13,"mute":false,"equalizer":{"bass":7,"treble":9,"loudness":true},"currentTrack":{"artist":"Cork's 96fm","title":"x-sonosapi-stream:s15078?sid=254","albumArtUri":"/getaa?s=1&u=x-sonosapi-stream%3as15078%3fsid%3d254","duration":0,"uri":"x-sonosapi-stream:s15078?sid=254","trackUri":"x-sonosapi-stream:s15078?sid=254","type":"radio","stationName":"Cork's 96fm","absoluteAlbumArtUri":"http://192.168.1.63:1400/getaa?s=1&u=x-sonosapi-stream%3as15078%3fsid%3d254"},"nextTrack":{"artist":"","title":"","album":"","albumArtUri":"","duration":0,"uri":""},"trackNo":1,"elapsedTime":25197,"elapsedTimeFormatted":"06:59:57","playbackState":"PLAYING","playMode":{"repeat":"none","shuffle":false,"crossfade":false}} Get API service to start automatically when Pi powers up INSTALL PM2 Reboot Pi (sudo reboot) and enter each command separately when it boots npm install -g pm2 pm2 startup raspberry or pm2 startup (if error encountered) sudo env PATH=$PATH:/usr/local/bin pm2 startup raspberry -u pi cd node-sonos-http-api sudo pm2 start server.js -x --name "http-api" pm2 dump Reboot Pi (sudo reboot ) and confirm service starts automatically by using browser commands above FOR TextToSpeech function of the Sonos API Change folder cd node-sonos-http-api Edit the settings.json file sudo nano settings.json Amend as you need - I use AWS Polly and these are my settings { "aws": { "credentials": { "region": "eu-west-1", "accessKeyId": "XXXXXXXXXXXXXXXXXXXXX", "secretAccessKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" }, "name": "Emma" } } Reboot Pi (sudo reboot) and confirm with the SAY command to one of your zones Ref: https://github.com/jishi/node-sonos-http-api ====== HA Bridge Install Install Java8 sudo apt install openjdk-8-jdk openjdk-8-jre Let finish and verify using following command to display version java -version Install HA Bridge sw (enter each command separately) mkdir ha-bridge cd ha-bridge wget https://github.com/bwssytems/ha-bridge/releases/download/v5.3.0/ha-bridge-5.3.0.jar Create the service file Change directory and edit/create the ha-bridge.service file cd /etc/systemd/system sudo nano ha-bridge.service Copy the following into the ha-bridge.service file [Unit] Description=HA Bridge Wants=network.target After=network.target [Service] Type=simple WorkingDirectory=/home/pi/ha-bridge ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/ha-bridge/data/habridge.config /home/pi/ha-bridge/ha-bridge-5.3.0.jar [Install] WantedBy=multi-user.target Save the file in the editor by hitting CTL-X and then saying Y to update and save. Reload the system control config: sudo systemctl daemon-reload To start the bridge: sudo systemctl start ha-bridge.service To start the service at boot, use the enable command: sudo systemctl enable ha-bridge.service Open browser and access HA Bridge GUI at http://Ip of Pi/ Configure as required Note: If you have an instance running and want to migrate you will need to copy the habridge.config and device.db files to the new Pi There are some guidelines here for that but I haven't tried them - https://github.com/bwssytems/ha-bridge/issues/353 Ref: https://github.com/bwssytems/ha-bridge & others ====== Network Utility Tools Install For UPS devices connected over USB Update some pi network references sudo nano /etc/dhcpcd.conf Scroll to bottom and add this text (Change the static address to be that of your Pi) interface eth0 static ip_address=192.168.1.240/24 static routers=192.168.1.1 static domain_name_servers=192.168.1.1 Save the file in the editor by hitting CTL-X and then saying Y to update and save. Now hook up the UPS to the RPi using the USB cable and reboot the RPi. (sudo reboot) Install NUT sudo apt install nut Confirm any questions with Y reboot (sudo reboot) Display USB interfaces to ensure that UPS is visible lsusb you should see something similar to this Bus 001 Device 005: ID 0781:5567 SanDisk Corp. Cruzer Blade Bus 001 Device 004: ID 0463:ffff MGE UPS Systems UPS Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Note: You can see both the USB Drive (Cruzer) and the UPS System (MGE Systems) Configure NUT sudo nano /etc/nut/ups.conf Add this to the bottom of the file [ups] driver = usbhid-ups port = auto desc = "UPS model or description" remove the MaxRetry = 3 entry Review https://networkupstools.org/stable-hcl.html to change usbhid-ups above if required to match your UPS driver Save the file in the editor by hitting CTL-X and then saying Y to update and save. Test the UPS driver by running: sudo upsdrvctl start You may see something similar to the following Network UPS Tools - UPS driver controller 2.7.4 Network UPS Tools - Generic HID driver 0.41 (2.7.4) USB communication driver 0.33 No matching HID UPS found Driver failed to start (exit status=1) Network UPS Tools - Generic HID driver 0.41 (2.7.4) USB communication driver 0.33 No matching HID UPS found Driver failed to start (exit status=1) Network UPS Tools - Generic HID driver 0.41 (2.7.4) USB communication driver 0.33 Using subdriver: MGE HID 1.39 Configure Upsmon and upsd Edit the upsd.conf file sudo nano /etc/nut/upsd.conf Scroll down to the LISTEN part and uncomment the LISTEN directive for localhost (127.0.0.1) and add another LISTEN directive for the static IP we assigned to the RPi earlier. You should end up with LISTEN 127.0.0.1 3493 LISTEN 192.168.0.13 3493 Edit the upsd.users file sudo nano /etc/nut/upsd.users Add the following to the bottom [admin] password = passwd2 actions = SET instcmds = ALL [upsmon_local] password = passwd2 upsmon master [upsmon_remote] password = passwd2 upsmon slave Edit /etc/nut/upsmon.conf and add the UPS to be monitored and user credentials for upsd in the MONITOR section: sudo nano /etc/nut/upsmon.conf Add the following to the MONITOR section MONITOR [email protected] 1 upsmon_local passwd2 master Edit /etc/nut/nut.conf and set the value for MODE equal to 'netserver' without any spaces before and after the = sign: sudo nano /etc/nut/nut.conf Add the following to the bottom of the file MODE=netserver save and close file. Reboot Pi (sudo reboot) I then created a service as the service doesn't always start by itself. The issue is referenced here - https://github.com/networkupstools/nut/issues/277 I used a py script and there are other ways. Edit/Create the py script file from the home directory) sudo nano ups.py Add the following to the file import os os.system('sleep 30 ; sudo /etc/init.d/nut-server stop ; sleep 5 ; sudo /etc/init.d/nut-server start') Use systemd to run at start up by creating a service Create/edit the service file sudo nano /etc/systemd/system/ups.service Add the following to the file [Unit] Description=My service After=network.target [Service] ExecStart=python /home/pi/ups.py StandardOutput=inherit StandardError=inherit User=pi [Install] WantedBy=multi-user.target CTRL-X and Y to exit Change to systemd Directory cd /etc/systemd/system Reload the services sudo systemctl daemon-reload Start service by .. sudo systemctl start ups.service Enable to run at boot sudo systemctl enable ups.service Ref : https://www.reddit.com/r/homelab/comments/5ssb5h/ups_server_on_raspberry_pi/ ====== Install Mosquitto MQTT Broker and Client Retrieve and add the key (enter each command separately) wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key sudo apt-key add mosquitto-repo.gpg.key Then make the repository available to apt Change folder cd /etc/apt/sources.list.d/ Enter the following to get the list for raspbian buster sudo wget http://repo.mosquitto.org/debian/mosquitto-buster.list Update the source list sudo apt-get update This installs the mosquitto broker sudo apt-get install mosquitto This installs mqtt mosquitto client sudo apt-get install mosquitto-clients Testing MQTT Open tow SSH sessions to the Pi (call one putty1 and the second putty2). Log into both In putty1 session type the command with the topic name armtronix_mqtt (just used for testing) mosquitto_sub -d -t armtronix_mqtt This will subscribe Pi to MQTT broker(which is runs on Pi) handling MQTT armtronix_mqtt. In putty2 session type the following command with the same topic i.e armtronix_mqtt mosquitto_pub -d -t armtronix_mqtt -m “Hello” Now come to the window putty1, image 1 here you will be able to see the message "Hello" Ref: https://www.instructables.com/id/Installing-MQTT-BrokerMosquitto-on-Raspberry-Pi/ ====== Install Node RED I'm installing just NodeRed and not NodeJs/NPM as I don't want NodeJs version to be upgraded to the latest v10 Install Nodered sudo npm install -g --unsafe -perm node-red test by starting start with node-red-pi --max-old-space-size=256 Now we need to create a service to get it to start on reboot Create/Edit file sudo nano /etc/systemd/system/nodered.service Add the following to the service file [Unit] Description=My service After=network.target [Service] ExecStart=/usr/bin/env node-red-pi --max-old-space-size=128 -v StandardOutput=inherit StandardError=inherit User=pi [Install] WantedBy=multi-user.target CTRL-X and Y to exit Ensure that the service runs at boot up using systemd Change folder cd /etc/systemd/system reload the services sudo systemctl daemon-reload Start service by .. sudo systemctl start nodered.service Enable to run at boot sudo systemctl enable nodered.service Access NodeRed UI at http://ip of Pi:1880/ Ref http://pdacontrolen.com/installation-node-red-platfor/ & https://nodered.org/docs/getting-started/raspberrypi ====== Optional ... Save the Flash Drive image to your PC to reburn later or create copies for fast swap out if you need to Use something like Win23DiskImager to do this. ... Enjoy !!
×
×
  • Create New...