Hi guys, slowly moving all my devices off Vera.. but there are going to be some that aren't ready yet. All I want to do is issue command to my Vera (gets back reading form my Netatmo weather system)
I'v looked at Rule machine and Momentary Switch and can't see any reference on how you get data back. It's probable something really simple but I can't see it.
Note that this works in a driver. In rule machine I do not know. You can also try using the Maker API and just place your command therein. (I am not a Maker API user.)
Thanks guys... it can't be that hard surely... I'm out of my comfort zone but will eventually get there.
I managed to install a driver - having little idea what I am doing
2019-09-04 15:31:26.850 errorgroovy.lang.MissingMethodException: No signature of method: user_driver_Mick2_Mick2_449.refresh() is applicable for argument types: () values: [] Possible solutions: every(), every(groovy.lang.Closure), grep() (refresh)
In Vera this is easy! Going to need some more clues. Maker API looks to be about external devices issuing gets to the HA.. I'm going the other way.. Maybe a walk will help...
Sorry but you're basically asking "How do I write a driver?" and that's not a quick or easy question to answer. My suggestion would be to find some other way to do it. Maybe using the maker API to send the data to HE rather than HE polling for it.
in this specific case, the capability Refresh requires a method refresh.
def refresh() ( sendSyncCommand() }
You also need to change:
private sendSyncCmd(commandx){
to
private sendSyncCmd(){
Look at some available drivers to see how a driver is formulated. Try this link (it is one of mine and more complex than you need, but you can get the flow).
To import into the editor (easier to read), go to a new driver, press the Import button and paste the above code into the field. OR you can copy the code from the gitHub editor and paste it into a new window.
Right.. now the issue is how to get this value so that I can do something with it in the rule machine.. Seems I can't just set it to a global value so how?
If you are creating this as a driver, make a "sendEvent" that provides the name of the attribute and the value. You will need to put the value from the response into a specific field. From your sample that means it might look like:
Thanks for your help. I have it working now with values being updated in the UI. This means I can proceed with the final transit of my remaining devices, Eventually I'll tidy up this driver and make it more generic. It will be a useful training exercise for me. So much to learn..but it's fun...
I have one last thing to do so I can move off Vera. So in Vera I have a working curl command but for the life of me I can't get curl to do anything in this driver code. So some dumb questions:
Is curl actually available in a driver? Do I need to load some libraries into the driver code first?
Curl isnβt available but I would assume your curl command is doing an HTTP get or post which can be done in a driver. Post your curl command and we can try to help.
I had to code a driver so I could create a date yyyymmdd and a time of hh:mm just so that I could use it the post above. Surely that's a little over the top. Has someone an easier method? I'm learning all the time.
Anyway I have now sucessfully migrated everything from Vera.... thanks for the all the help from forum members... yipee