Hubitat Plugin Beta

Posted on
Thu Jan 20, 2022 4:13 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Hubitat Plugin Beta

autolog wrote:
CliveS wrote:
... but I am sure a simple python script in Indigo that knows the delay between off and on and number of flashes required would be the answer.

As this functionality (easy scripting) is already available in Indigo, I think this would be the way to go as well. :)


You over estimate my coding ability. :D

Posted on
Fri Jan 21, 2022 5:15 am
CliveS offline
Posts: 761
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: Hubitat Plugin Beta

siclark wrote:
autolog wrote:
CliveS wrote:
... but I am sure a simple python script in Indigo that knows the delay between off and on and number of flashes required would be the answer.

As this functionality (easy scripting) is already available in Indigo, I think this would be the way to go as well. :)


You over estimate my coding ability. :D


Well you can see my "attempt" below as I have just brushed up on 'Python for Dummies' ;)

Code: Select all

# Run this as an External Script.
#
# 'indigo.server.log' lines can be removed
#
# flashDuration check as less than 1 second can miss toggle
# but .5 second is possible but may miss 1 (or 2) toggle events
# light will always exit with lightState ensuring entry state = exit state 
#
# flashNumber check to stop less than 1 or more than 10 flashes (can be increased)


devID = indigo.devices[970414872] # "HE Bedroom 3 Light"

flashNumber     = 999
flashDuration = 999
lightState     = 0       # 0 = off, 1 = on

import time

if flashNumber < 1 or flashNumber > 10:
   flashNumber = 5

if flashDuration < .5 or flashDuration > 10:
   flashDuration = 1

if devID.onState:
   lightState = 1
   indigo.server.log("\n")
   indigo.server.log("Initial Bedroom 3 Light is On")
   indigo.server.log("=============================\n")
else:
   indigo.server.log("\n")
   indigo.server.log("Initial Bedroom 3 Light is Off")
   indigo.server.log("==============================\n")
   
for x in range(flashNumber):
   indigo.server.log("\n")
   indigo.server.log("Flash " + str(x+1))
   indigo.device.toggle(devID)
   time.sleep(flashDuration)

if lightState == 0:
   indigo.device.turnOff(devID)
   indigo.server.log("\n")
   indigo.server.log("Exit Bedroom 3 Light is Off")
   indigo.server.log("===========================\n")

else:
   indigo.device.turnOn(devID)   
   indigo.server.log("\n")
   indigo.server.log("Exit Bedroom 3 Light is On")
   indigo.server.log("==========================\n")


That will give a log of

Code: Select all
21 Jan 2022 at 10:54:40
   Action Group                    Flash Bedroom 3 Light
   Script                         

   Script                          Initial Bedroom 3 Light is Off
   Script                          ==============================

   Script                         

   Script                          Flash 1
   Hubitat Bridge                  sending "toggle on" to "HE Bedroom 3 Light"
   Hubitat Bridge                  received "HE Bedroom 3 Light"  "on" event
   Script                         

   Script                          Flash 2
   Hubitat Bridge                  sending "toggle off" to "HE Bedroom 3 Light"
   Hubitat Bridge                  received "HE Bedroom 3 Light"  "off" event
   Script                         

   Script                          Flash 3
   Hubitat Bridge                  sending "toggle on" to "HE Bedroom 3 Light"
   Hubitat Bridge                  received "HE Bedroom 3 Light"  "on" event
   Script                         

   Script                          Flash 4
   Hubitat Bridge                  sending "toggle off" to "HE Bedroom 3 Light"
   Hubitat Bridge                  received "HE Bedroom 3 Light"  "off" event
   Script                         

   Script                          Flash 5
   Hubitat Bridge                  sending "toggle on" to "HE Bedroom 3 Light"
   Hubitat Bridge                  received "HE Bedroom 3 Light"  "on" event
   Script                         

   Script                          Exit Bedroom 3 Light is Off
   Script                          ===========================

   Hubitat Bridge                  sending "turn off" to "HE Bedroom 3 Light"
   Hubitat Bridge                  received "HE Bedroom 3 Light"  "off" event


Code without the log lines

Code: Select all
devID = indigo.devices[970414872] # "HE Bedroom 3 Light"

flashNumber     = 999
flashDuration = 999
lightState     = 0       # 0 = off, 1 = on

import time

if flashNumber < 1 or flashNumber > 10:
   flashNumber = 5

if flashDuration < .5 or flashDuration >= 10:
   flashDuration = 1

if devID.onState:
   lightState = 1
   
for x in range(flashNumber):
   indigo.device.toggle(devID)
   time.sleep(flashDuration)

if lightState == 0:
   indigo.device.turnOff(devID)
else:
   indigo.device.turnOn(devID)   


Hope that helps

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Fri Jan 21, 2022 7:39 am
cesarvog offline
User avatar
Posts: 155
Joined: Aug 13, 2016
Location: Brazil

Re: Hubitat Plugin Beta

Hi Jon,

I got the "from HE device to Indigo" part working, after a few hiccups, but now that I want to try the other way around "from Indigo device to HE", it seems my two working neurons are not enough...

I suppose it's something I have done wrong (or failed altogether to do) in HE MQTT app and it's not really something related to your plugin or Indigo, but I was hoping you could point me to an article or post somewhere, because I searched and found the HE MQTT app and driver documentation lacking and confusing (must be my two working neurons...).

The third image below shows how I configured the HE MQTT app > HE and the contents of the topic in MQTT Explorer. I can't seem to make the dropdowns in the "MQTT Discovery Protocols > HE" to be populated with device data.

UPDATE: On second thoughts, maybe IT IS something I have to do in Indigo. Do I have to change the MQTT Publishing Template in Joe's (aka FlyingDiver) Indigo MQTT Connector Plugin Broker to match the way HE MQTT app/driver publishes HE originated devices, so that it follows some obscure standard? I mean, do I have to follow some particular schema? If so, where can I find a description?

Please see second attachment below for and example of how one of my HE originated devices (fibaro smart implant) was published and you'll notice that it is completely different from the way Joe's standard MQTT Publishing Template in the MQTT Connector Broker (first attachment) does the same thing. Am I on the right track?

UPDATE2: I think I may have found it. Starting to read https://homieiot.github.io/ NOW!!!
Attachments
Screen Shot 2022-01-21 at 11.11.59.png
MQTT Connector Broker Publishing Template
Screen Shot 2022-01-21 at 11.11.59.png (28.79 KiB) Viewed 1570 times
Screen Shot 2022-01-21 at 10.59.44.png
HE originated device as published, viewed in MQTT Explorer
Screen Shot 2022-01-21 at 10.59.44.png (21.38 KiB) Viewed 1570 times
Screen Shot 2022-01-21 at 10.51.12.png
Indigo originated device as published by the standard MQTT Connector Publishing Template, viewed in MQTT Explorer
Screen Shot 2022-01-21 at 10.51.12.png (241.4 KiB) Viewed 1570 times

Posted on
Fri Jan 21, 2022 10:29 am
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Hubitat Plugin Beta

cesarvog wrote:
Hi Jon,

I got the "from HE device to Indigo" part working, after a few hiccups, but now that I want to try the other way around "from Indigo device to HE", it seems my two working neurons are not enough...

I suppose it's something I have done wrong (or failed altogether to do) in HE MQTT app and it's not really something related to your plugin or Indigo, but I was hoping you could point me to an article or post somewhere, because I searched and found the HE MQTT app and driver documentation lacking and confusing (must be my two working neurons...).

The third image below shows how I configured the HE MQTT app > HE and the contents of the topic in MQTT Explorer. I can't seem to make the dropdowns in the "MQTT Discovery Protocols > HE" to be populated with device data.

UPDATE: On second thoughts, maybe IT IS something I have to do in Indigo. Do I have to change the MQTT Publishing Template in Joe's (aka FlyingDiver) Indigo MQTT Connector Plugin Broker to match the way HE MQTT app/driver publishes HE originated devices, so that it follows some obscure standard? I mean, do I have to follow some particular schema? If so, where can I find a description?

Please see second attachment below for and example of how one of my HE originated devices (fibaro smart implant) was published and you'll notice that it is completely different from the way Joe's standard MQTT Publishing Template in the MQTT Connector Broker (first attachment) does the same thing. Am I on the right track?

UPDATE2: I think I may have found it. Starting to read https://homieiot.github.io/ NOW!!!


Hopefully before you disappear too far down the MQTT rabbit hole, you dont need the MQTT plugin at all for the Hubitat plugin. The plugin gives you 2 way communication out of the box once you create the device with the HE plugin, however you do need the HE MQTT plugin set up correctly, but as its publishing then you look like you should be good.

Posted on
Fri Jan 21, 2022 10:31 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Hubitat Plugin Beta

Hi Cesar,

You shouldn't need to do anything with MQTT EXplorer or Joe's MQTT plugin.

Just turning the Indigo device on and off should work.

I presume it doesn't?

What sort of device have you defined it as in the Indigo Hubitat plugin?

Posted on
Fri Jan 21, 2022 11:25 am
cesarvog offline
User avatar
Posts: 155
Joined: Aug 13, 2016
Location: Brazil

Re: Hubitat Plugin Beta

autolog wrote:
You shouldn't need to do anything with MQTT EXplorer or Joe's MQTT plugin.


I was also hoping that would be true, but nothing appears on the dropdowns of HE MQTT app for me to select devices "learnt" from Indigo, which seems strange.


autolog wrote:
Just turning the Indigo device on and off should work.

I presume it doesn't?


No it doesn't.

autolog wrote:
What sort of device have you defined it as in the Indigo Hubitat plugin?

I'm not sure I follow, I thought I only need to define devices in the Indigo Hubitat Plugin for those devices "learnt' from HE into Indigo. Not the other way around, which is what I'm trying to accomplish now, so I can use zwave devices from my current z-wave mesh in Indigo. I think the terminology here is playing a part in our conversation, because it's all MQTT here, MQTT there, plugin here, app there, driver there. Please excuse me if it's not clear. English is also not my 1st language.

Posted on
Fri Jan 21, 2022 11:27 am
cesarvog offline
User avatar
Posts: 155
Joined: Aug 13, 2016
Location: Brazil

Re: Hubitat Plugin Beta

siclark wrote:

Hopefully before you disappear too far down the MQTT rabbit hole, you dont need the MQTT plugin at all for the Hubitat plugin. The plugin gives you 2 way communication out of the box once you create the device with the HE plugin, however you do need the HE MQTT plugin set up correctly, but as its publishing then you look like you should be good.


Tks for chiming in. I also originally thought so, but I'm having a hard time having the from Indigo INTO Hubitat comm working... Then I remembered about Joe's plugin and MQTT explorer and thought I would give it a try.

UPDATE: re-reading your post, I thought I would ask if by 2 way communication out of the box you mean:

a) learning devices originally defined in HE and publishing them from HE into Indigo (which is working) , as well as, learning devices originally defined only in Indigo and learning them into HE (which is what I'm trying to accomplish now).

OR

b) switching devices originally defined in Hubitat Elevation in either Indigo or HE on and off and having those change status in the other platform. (THIS IS WORKING as we speak).

Posted on
Fri Jan 21, 2022 12:08 pm
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Hubitat Plugin Beta

OK - I didn't fully understand what you meant and think I do now. :)

If I understand correctly, you are
... as well as, learning devices originally defined only in Indigo and learning them into HE (which is what I'm trying to accomplish now).


The Hubitat plugin isn't designed to support this i.e it is really only for being able to control Hubitat Devices via Indigo. That is Indigo can read Hubitat devices states and control them e.g. turn on and off.

If you want to do it the other way round, you would have to most likely use Joe's MQTT plugin to send commands to HE. The only way I think this will work is to define Virtiual Devices in the MQTT App on HE and then expose theses virtual devices as you do a normal non-virtual device. This would then be seen in MQTT EXplorer and you can then use Joe's plugin.

Does that make sense to you and have I understood you correctly?

Posted on
Fri Jan 21, 2022 12:36 pm
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Hubitat Plugin Beta

Hi Cesar,

As a follow-up and no promises but I may be able to extend the plugin to work the other way, but I need to think it through. :)

Do you need to map an existing Indigo device to an existing HE device or a virtual HE device. What are you trying to achieve on the HE side?

Maybe you could explain exactly what you are trying to achieve i.e. type of Indigo device, HE device control etc.

Posted on
Fri Jan 21, 2022 4:06 pm
cesarvog offline
User avatar
Posts: 155
Joined: Aug 13, 2016
Location: Brazil

Re: Hubitat Plugin Beta

Wow, Jon, thanks for being so helpful. I never meant for my crazy idea to become additional work to you.
If you do think this would improve your already great plugin, then by all means I will be willing to help any way I can.

Sorry for the long post. I'm trying to explain as best as possible the current scenario.


What I'm willing to do:
================

- I've been using Indigo for several years now. My home automation is comprised of 60+ z-wave devices, all of which were added to the z-wave mesh by using either Homeseer (long before I found Indigo) or Indigo itself. The z-wave adapter is a z-net clone I built from scratch from a Raspberry Pi 3+ sporting a z-way Razberry 2 GPIO interface.

Not relevant to what I'm trying to do now, but for the sake of completeness:
Originally, the z-wave mesh was indeed controlled by z-net interface in Homeseer. But I wanted to use a better interface (for longer range)... So, I backed the z-wave network in Homeseer and restored it's data into the Razberry using two or three tools that allowed me to convert the homeseer created backup format into a binary file that would then be restorable into the Razberry 2 by using PC Controller (or something else I don't really quite recall now).
Anyway, It's been documented somewhere here as well in Homeseer's forum, so anyone else willing to do the same would eventually find my instructions from a google search.

- Now that I bought a new Hubitat C-7 hub, there is no way in hell that I will be willing to reset my 60+ z-wave devices and go through the burden of re-adding them into a new z-wave mesh, this time managed by the Hubitat C-7 Hub. It's not only too much trouble, but it's also risky. You see, I've been reading that the C-7 z-wave range is not all that good, meaning I may end up with a z-wave mesh that is substantially worst than my current z-wave mesh, which works flawlessly by the way.

- So, I came up with this idea of using the HE MQTT app and driver to "learn" the z-wave devices already existing in my Indigo managed z-wave mesh INTO the C-7, so I could, eventually use the HE Dashboard to provide a better looking interface for my family. I know that Jay and Matt are currently working a new incarnation of Indigo Touch, but... who knows when that will be ready?


What I have done so far:
==================

- Installed both the MQTT app and driver into my C-7 by using the import button on Apps Code in Hubitat web administration page.
- Configured the MQTT app so that it connects to my Mosquitto broker running from the same Raspberry Pi 3B+ where the Razberry 2 GPIO card lives.
- In the C-7, added a Fibaro FGS-222 Smart Implant (z-wave device) that provides TWO instances of out relays and configured it so that I could turn those relays on and off individually, by using the Hubitat Dashboard feature. Tested and both work as expected from the Dashboard in my computer, as well as from the Hubitat iPhone App. No delay whatsoever in turning those on and off.
- In Indigo 2021.2, installed your plugin into Indigo and created a MQTT Bridge of model Hubitat Elevation Hub (MQTT client) device, pointing to the same Mosquitto instance mentioned above.
- In Indigo 2021.2, created two MQTT Bridge devices of type Outlet (socket), pointing to the Fibaro Smart Implant FGS-222 above, which magically appeared as available devices once I selected the Hubitat Hub Bridge from the device creation Indigo interface.
- Tested switching on/off both Indigo devices created above from the Indigo devices list, by pressing the Turn On and Turn Off buttons. The devices responded immediately and the correspondent devices in Hubitat Dashboard turned yellow when ON and black when OFF. Tested switching the same devices from Hubitat's Dashboard and found out that the devices in Indigo where also switched, instantly. So I thought the whole setup was working as expected. So far, so good!

At this point I posted my Thank you message to you in this forum as I was happy with the results so far, I then went to bed, planning to try "the other way around" the next morning.

That's where I am now. Your solution works perfectly for HE devices to appear and be controlled by Indigo. I'm willing to also find a way to do the opposite: control Indigo devices from HE Dashboard. I don't know what type of device I will have to define in HE, but I've read somewhere that it supports virtual devices. Hope this clarifies.

My best guess is that, in order for me to be able to define devices in HE that somehow point to Indigo devices, the following section of Hubitat's MQTT app interface will have to somehow populate the series of dropdowns shown in this image:
Attachments
Screen Shot 2022-01-21 at 19.16.18.png
Screen Shot 2022-01-21 at 19.16.18.png (110.98 KiB) Viewed 1520 times
Last edited by cesarvog on Fri Jan 21, 2022 4:29 pm, edited 6 times in total.

Posted on
Fri Jan 21, 2022 4:09 pm
cesarvog offline
User avatar
Posts: 155
Joined: Aug 13, 2016
Location: Brazil

Re: Hubitat Plugin Beta

autolog wrote:
Hi Cesar,
Do you need to map an existing Indigo device to an existing HE device or a virtual HE device. What are you trying to achieve on the HE side?

Maybe you could explain exactly what you are trying to achieve i.e. type of Indigo device, HE device control etc.


I believe it will need to be a virtual HE device (which I have no experience with as I only got my C-7 last Wed...) I mean, if that would allow me to control the virtual devices from HE and have it somehow be reflected in turning on/off/dimming/setting lamp color, from Indigo, that is what I'm willing to achieve.

Posted on
Sat Jan 22, 2022 5:34 am
CliveS offline
Posts: 761
Joined: Jan 10, 2016
Location: Medomsley, County Durham, UK

Re: Hubitat Plugin Beta

autolog wrote:
Hi Cesar,

As a follow-up and no promises but I may be able to extend the plugin to work the other way, but I need to think it through. :)

Do you need to map an existing Indigo device to an existing HE device or a virtual HE device. What are you trying to achieve on the HE side?

Maybe you could explain exactly what you are trying to achieve i.e. type of Indigo device, HE device control etc.


I must admit I originally did not see the reason for putting Indigo devices into Hubitat then Cesar mentioned HE Dashboard, I looked into this last night and wow Cesar what a great idea!

I watched a couple of YouTube videos of a dashboard called Sharptools (others are available) and will be trying it out and it has apps for IOS, Android, MacOS and PC.

So if it is possible Jon you have a willing alpha/beta tester :)

CliveS

Indigo 2023.2.0 : macOS Ventura 13.6.3 : Mac Mini M2 : 8‑core CPU and 10‑core GPU : 8 GB : 256GB SSD
----------------------------------------------------------------------------------
The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer

Posted on
Sat Jan 22, 2022 5:44 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Hubitat Plugin Beta

CliveS wrote:
... So if it is possible Jon you have a willing alpha/beta tester :)


I am doing some initial feasibility coding at the moment :D

My initial thoughts are that you would have to define a virtual device in HE (via the MQTT App - this is important, don't define a native HE virtual device otherwise it won't work).

Then publish this virtual device to MQTT.

So now Indigo (my Hubitat Plugin) will be able to see it.

I think then there will be a new Hubitat device type e.g. Virtual Devices. This will then be configured via the Edit Device settings dialogue to associate a list of Indigo devices to the virtual Hubitat devices (on a one for one basis). Thereafter, any relevant change to an associated Indigo device will be published to update the HE virtual device.

I think that will work; we will see. :)

Posted on
Sat Jan 22, 2022 6:11 am
cesarvog offline
User avatar
Posts: 155
Joined: Aug 13, 2016
Location: Brazil

Re: Hubitat Plugin Beta

Hello Jon and CliveS,

Jon, not willing to derail your plans, but... have you seen sections d) and e) of the following link?

https://github.com/xAPPO/MQTT

In there the author of the xAPPO/MQTT App and Driver for Hubitat Elevation provides some info on **automatic** discovery of devices (therefore, not needing virtual devices) in his App.

Like I said before, I found some of the documentation available for the MQTT App and Driver kind of lacking/confusing, but I thought I should give you this pointer, as my understanding is that there are two methods for automatic discovery of "foreign" devices into HE:

a) one is to import devices from Homie and/or OpenHAB, by using something called the Homie3 protocol.
b) the other is to import devices from HomeAssistant, by using another thing called the statestream protocol.

I had no idea neither of those existed before I first learnt about the xAPPO/MQTT App and driver.

What I'm trying to do using Joe's MQTT Connector is using triggers that add MQTT data that tries to follow the Homie schema, so the automatic discovery already built on xAPPO/MQTT App will go on and populate the dropdowns existing on the section of MQTT App depicted on my previous screen grab. From there, I figure I should choose the devices I want the App to create. At least this is what I figure is possible. If I can't make it work using the Homie schema until tomorrow, starting Monday I will try the same thing using the HomeAssistant schema.

So, if you still have not seen section d) and e) from above linked github, maybe you could and see if your understanding is the same as mine.
Your last post here seem to indicate you are thinking of doing something more in line with what is explained in section f) of the above linked github.

Best regards and many, many thanks for all your help.
Last edited by cesarvog on Sat Jan 22, 2022 6:22 am, edited 2 times in total.

Posted on
Sat Jan 22, 2022 6:20 am
autolog offline
Posts: 3988
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Hubitat Plugin Beta

Interesting, I think you are correct and that would avoid setting up a virtual device in HE. :idea:

Have you managed to get Homie or Home Assistant discovery to work?

Page 6 of 12 1 ... 3, 4, 5, 6, 7, 8, 9 ... 12

Who is online

Users browsing this forum: No registered users and 1 guest