Node-RED nodes for hubitat

Nice, you found another dataType :slight_smile:
This issue is what I describe in the first post (Feedback about Maker API -> third point)

Explanation: you have value: "{"title":"Voyager","artist":"The Alan Parsons Project ..." when you receive an event (the value is a string)
On your device initialization, if you request your device state you'll probably get: value: {title":"Voyager","artist":"The Alan Parsons Project... (the value is key/value object) (be careful of the double quote before curly bracket)

Just to be sure about the initialized value, I will ask you to send me the attributes result of this url:

http://<hubitat-ip>/apps/api/<app-id>/devices/<device-id>?access_token=<token>

There are still other values that are not handled correctly according the Hubitat documentation. But since I don't have any device that return these kind of dataType, I cannot know the object format :sweat:

  • DYNAMIC_ENUM
  • DATE

EDIT: Oh I have made a mistake on the message format. I will need you to send me the event output (connect a debug node to your device node)

So I need:

  • the result of the URL query from above
  • the event sent by your device node when the attribute is triggered by your physical device
1 Like

If i want to have lighting turn on based on motion and lux, is this the correct spot? or should it go before the Active/Inactive node?
Or something else completely?

Wish Node-RED had more/better dashboard widget options (without going nuclear and using VueJS).

Thermostat is one example. I saw a few "nest" look-alike ones, but I hate Nest so that's no good for me.

Here is the best I've come up with. Anyone else do thermostats on NR dashboards?

1 Like

What you have looks great! I'd love to have that on my setup

1 Like

Here is what I was able to get:

Payload:

{"name":"audioTrackData","currentValue":"{"title":"It Doesn't Matter","artist":"Alison Krauss & Union Station","albumArtUrl":"https://is3-ssl.mzstatic.com/image/thumb/Music113/v4/79/30/df/7930dfe5-f3c3-7afa-cc35-24c4085a73d7/10CMGIM00770.rgb.jpg/500x500bb.jpeg\",\"mediaSource\":\"Apple Music"}","dataType":"JSON_OBJECT","value":"{"title":"It Doesn't Matter","artist":"Alison Krauss & Union Station","albumArtUrl":"https://is3-ssl.mzstatic.com/image/thumb/Music113/v4/79/30/df/7930dfe5-f3c3-7afa-cc35-24c4085a73d7/10CMGIM00770.rgb.jpg/500x500bb.jpeg\",\"mediaSource\":\"Apple Music"}","deviceId":"321"}

Full MSG:

{"payload":{"name":"audioTrackData","currentValue":"{"title":"It Doesn't Matter","artist":"Alison Krauss & Union Station","albumArtUrl":"https://is3-ssl.mzstatic.com/image/thumb/Music113/v4/79/30/df/7930dfe5-f3c3-7afa-cc35-24c4085a73d7/10CMGIM00770.rgb.jpg/500x500bb.jpeg\",\"mediaSource\":\"Apple Music"}","dataType":"JSON_OBJECT","value":"{"title":"It Doesn't Matter","artist":"Alison Krauss & Union Station","albumArtUrl":"https://is3-ssl.mzstatic.com/image/thumb/Music113/v4/79/30/df/7930dfe5-f3c3-7afa-cc35-24c4085a73d7/10CMGIM00770.rgb.jpg/500x500bb.jpeg\",\"mediaSource\":\"Apple Music"}","deviceId":"321"},"topic":"Audio Track Data","_msgid":"324619a2.d97006"}

Results of the URL:

{"id":"321","name":"Echo Speaks Device","label":"Echo - Office","attributes":[{"name":"alarmVolume","currentValue":50,"dataType":"NUMBER"},{"name":"alexaNotifications","currentValue":"","dataType":"JSON_OBJECT"},{"name":"alexaPlaylists","currentValue":"{Upgraded Audio=[{entryList=null, playlistId=22334d14-4c01-4b2e-8e78-09fca7638526, title=Upgraded Audio, trackCount=34, version=37}]}","dataType":"JSON_OBJECT"},{"name":"alexaWakeWord","currentValue":"ALEXA","dataType":"STRING"},{"name":"audioTrackData","currentValue":"{"title":"It Doesn't Matter","artist":"Alison Krauss & Union Station","albumArtUrl":"https://is3-ssl.mzstatic.com/image/thumb/Music113/v4/79/30/df/7930dfe5-f3c3-7afa-cc35-24c4085a73d7/10CMGIM00770.rgb.jpg/500x500bb.jpeg\",\"mediaSource\":\"Apple Music"}","dataType":"JSON_OBJECT"},{"name":"btDeviceConnected","currentValue":"iPhone7+","dataType":"STRING"},{"name":"btDevicesPaired","currentValue":"iPhone7+","dataType":"JSON_OBJECT"},{"name":"currentAlbum","currentValue":"Alison Krauss & Union Station","dataType":"STRING"},{"name":"currentStation","currentValue":"Apple Music","dataType":"STRING"},{"name":"deviceFamily","currentValue":"ECHO","dataType":"STRING"},{"name":"deviceStatus","currentValue":"stopped_echo_dot_gen3","dataType":"STRING"},{"name":"deviceStyle","currentValue":"Echo Dot (Gen3)","dataType":"STRING"},{"name":"deviceType","currentValue":"A32DOYMUN6DTXA","dataType":"STRING"},{"name":"doNotDisturb","currentValue":"false","dataType":"STRING"},{"name":"firmwareVer","currentValue":"3658075524","dataType":"STRING"},{"name":"followUpMode","currentValue":"false","dataType":"STRING"},{"name":"lastCmdSentDt","currentValue":"Fri Feb 21 14:02:59 CST 2020","dataType":"STRING"},{"name":"lastSpeakCmd","currentValue":"Excel timer is done.","dataType":"STRING"},{"name":"lastSpokenToTime","currentValue":1585496371785,"dataType":"NUMBER"},{"name":"lastUpdated","currentValue":"Mar 29, 2020 - 10:46:02 AM","dataType":"STRING"},{"name":"lastVoiceActivity","currentValue":"alexa play music","dataType":"STRING"},{"name":"level","currentValue":30,"dataType":"NUMBER"},{"name":"mediaSource","currentValue":"Apple Music","dataType":"STRING"},{"name":"mute","currentValue":"unmuted","dataType":"ENUM","values":["unmuted","muted"]},{"name":"mute","currentValue":"unmuted","dataType":"ENUM","values":["unmuted","muted"]},{"name":"onlineStatus","currentValue":"online","dataType":"STRING"},{"name":"permissions","currentValue":"[reminders, flashBriefing, followUpMode, volumeControl, tuneInRadio, amazonMusic, spotify, alarms, bluetoothControl, announce, iHeartRadio, pandoraRadio, guardSupported, TTS, mediaPlayer, doNotDisturb, isMultiroomMember, wakeWord, microphone, isEchoDevice, appleMusic]","dataType":"STRING"},{"name":"status","currentValue":"stopped","dataType":"STRING"},{"name":"supportedMusic","currentValue":"Amazon Music, Apple Music, My Library, TuneIn, iHeartRadio","dataType":"STRING"},{"name":"trackData","currentValue":null,"dataType":"JSON_OBJECT"},{"name":"trackDescription","currentValue":"It Doesn't Matter","dataType":"STRING"},{"name":"trackImage","currentValue":"https://is3-ssl.mzstatic.com/image/thumb/Music113/v4/79/30/df/7930dfe5-f3c3-7afa-cc35-24c4085a73d7/10CMGIM00770.rgb.jpg/500x500bb.jpeg","dataType":"STRING"},{"name":"trackImageHtml","currentValue":"<img src="https://is3-ssl.mzstatic.com/image/thumb/Music113/v4/79/30/df/7930dfe5-f3c3-7afa-cc35-24c4085a73d7/10CMGIM00770.rgb.jpg/500x500bb.jpeg\"/>","dataType":"STRING"},{"name":"volume","currentValue":30,"dataType":"NUMBER"},{"name":"volume","currentValue":30,"dataType":"NUMBER"},{"name":"wakeWords","currentValue":"ALEXA,ECHO,COMPUTER,AMAZON","dataType":"ENUM"},{"name":"wasLastSpokenToDevice","currentValue":"true","dataType":"STRING"},{"name":"wifiNetwork","currentValue":null,"dataType":"STRING"}],"capabilities":["Refresh","MusicPlayer",{"attributes":[{"name":"status","dataType":null},{"name":"level","dataType":null},{"name":"trackDescription","dataType":null},{"name":"trackData","dataType":null},{"name":"mute","dataType":null}]},"Sensor","SpeechSynthesis","Notification","AudioNotification","AudioVolume",{"attributes":[{"name":"volume","dataType":null},{"name":"mute","dataType":null}]}],"commands":["connectBluetooth","createAlarm","createReminder","deviceNotification","disconnectBluetooth","doNotDisturbOff","doNotDisturbOn","executeRoutineId","executeSequenceCommand","getBluetoothDevices","getDeviceActivity","mute","mute","nextTrack","pause","play","playAnnouncement","playAnnouncement","playAnnouncementAll","playCalendarNext","playCalendarToday","playCalendarTomorrow","playFlashBrief","playFunFact","playJoke","playSingASong","playSoundByName","playTellStory","playText","playText","playText","playTextAndRestore","playTextAndRestore","playTextAndResume","playTextAndResume","playTrack","playTrack","playTrackAndRestore","playTrackAndRestore","playTrackAndResume","playTrackAndResume","playTraffic","playWeather","previousTrack","refresh","removeBluetooth","removeNotification","renameDevice","replayText","resetQueue","restoreLastVolume","restoreTrack","resumeTrack","sayBirthday","sayCompliment","sayGoodMorning","sayGoodNight","sayGoodbye","sayWelcomeHome","searchAmazonMusic","searchAppleMusic","searchIheart","searchMusic","searchPandora","searchSiriusXm","searchSpotify","searchTuneIn","sendAlexaAppNotification","sendAnnouncementToDevices","sendTestAnnouncement","sendTestAnnouncementAll","setAlarmVolume","setLevel","setTrack","setVolume","setVolumeAndSpeak","setVolumeSpeakAndRestore","setWakeWord","speak","speechTest","stop","stopAllDevices","storeCurrentVolume","togglePlayback","unmute","unmute","volumeDown","volumeDown","volumeUp","volumeUp"]}

It works, but is clunky when changing setpoints with the buttons. For the UP/DOWN buttons you have to click once and wait for the thermostat to report back before you can click again. Kind of slow if you want to change setpoint by 3-4 degrees. I was going to just use the numeric input node, as it has nice up/down arrows built in, but it is just too small for my touchscreens and I can't figure out how to make it larger via CSS without screwing it all up. I need to think on that some more later - other projects to attend to.

The temperature graph does change between red/blue/grey depending on HVAC mode, though, that is kind of nice.
image

Also kind of annoying that specifying labels/values to "center" doesn't really center them - like the "Cool" and number below it... But oh well.

I also have another version with colored buttons:
image

Thank you :+1:
Finally the event for JSON_OBJECT is already correct. You can safely ignore the warning. I will remove it for this dataType in the next release

1 Like

Several weeks ago, I mentioned that context variables are wiped out when NR restarts. I found in the documentation where you can change the context storage from memory to file system. Now when I restart NR, the context variables are kept. See this page:
https://nodered.org/docs/user-guide/context

5 Likes

Yup! It is a little bit of a pain to remember to store/fetch from the right context, but it is handy to have them live through reboots!

new version 0.0.28 :smiley:

Changes

  • add new mode-setter node to set mode (thank you all for your feedbacks)
  • add support for VECTOR3 and JSON_OBJECT dataType (thank you @bdydrp and @tmichael)
  • fix disabled input argument when device has duplicate commands available (with and without argument) (thank you @aaiyar for report)

Ongoing

hsm nodes should be available soon (probably next week). We just need to split the node into two nodes to use same logic as mode/mode-setter nodes :wink:

3 Likes

For the love off God please enable the tip jar feature on your GitHub account or give us some way to pass along a little something to you... I wanted to send $$ along for a case of Labatt Blue for cying out loud ! :slight_smile:

4 Likes

Yay. 4 more RM rules moved over to Node-RED.

The only ones left are the ones that need physical vs digital event type info. Hopefully when 2.2.0 comes out it won't be hard to add to these nodes. :crossed_fingers:

In case you want to get a jump on it @fblackburn ... Here is what the new field looks like in the events in Hubitat 2.2.0 and later. Typically it will be "physical", "digital", or empty/null. But technically it can be any string if the driver author did something non-standard.

Really looking forward to having this last piece of data in the events!!!

Haha thank you it's really really appreciated, but all of you helping others it's somehow my reward :smile:

3 Likes

Haha yeah I know you want this feature :stuck_out_tongue:
But from what you said, it should be easy :wink:
I don't know what amount of events sent by the "physical" type, if it's huge, maybe it would be interesting to add a checkbox/dropdown to filter these events in the node setting ... we will see when it will be released :slight_smile:

1 Like

I bet it won't be a lot, but I guess that is dependent on how often people physically push buttons on their remotes or wall switches.

I would expect the relative order of event types is physical < digital <= null/blank. Anything initiated by the hub SHOULD make a digital event type, but even the in-box virtual drivers often make events with a type of blank/null (instead of "digital" like they should be)... lol.

So if drivers were all perfect it would be blank/null << physical << digital.

I find that button controllers, outlets, and light switches/dimmers tend to populate the event type pretty consistently. Things like thermostats, presence sensors, leak sensors, locks, temp/humidity sensors are a lot less consistent in this.

Even my own GoControl thermostat driver doesn't populate event type... lol... I guess I should fix that sometime). I did it in all my GE/Jasco light switch drivers, but guess I forgot on my GoControl thermostat.

1 Like

Unrelated to the new update, since @JasonJoel is sharing dashboard creations, here is one I am working on. It's just a proof of concept right now. I plan to add Stop, Play, Pause, Next Track, etc. buttons and then create one for each of the Echos in the house.

The only disappointing thing is that Alexa is slow to update the song info. It can take up to 30-45 seconds. I need to find a way to get that info faster.

The flows are easy with the Hubitat Nodes. I did have to add some attributes to the HubConnect speaker driver to get artist. The hardest thing was getting album art. This is something I always wanted to do in HE but I couldn't figure out a way to do a dynamic image for album art.

4 Likes

I like it! I wish Google was easier to integrate stuff into. Can do some, but not as much or as easily as Alexa.

This is my dashboard at present. Still a work in progress. I removed my unused Rule Machine rules yesterday, and my HE backup size dropped from 35 mb to 20 mb

4 Likes

Nice!

I have been playing with the node-red-contrib-amazon-echo palette. I have been able to work out simple actions like turning a lamp on and off (see below). This is about as far as I have gotten though. I would really like to use this to get full control over devices. For example, I would like to have not only on/off control of the light but dimming and color section control also. I know how to parse out the message to set level to a certain set point or set a particular color, but I would like to be able to say "Alexa, set lamp to [some percentage]" or "Alexa, set lamp to [some color] and have the node red flow handle the logic. Anyone have any luck with this? If so, would you be wiling to help me figure it out?