Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template 3 #90

Open
alekslyse opened this issue Sep 3, 2018 · 13 comments
Open

Template 3 #90

alekslyse opened this issue Sep 3, 2018 · 13 comments
Assignees

Comments

@alekslyse
Copy link

Do you have any ETA on template 3, or might starting to release it into beta state officially in the package?

Seem like you have implemented some nice things like device creation etc, that has to be done manually today and would speed up development a lot

@alexdresko
Copy link
Owner

I'm afraid that's not going to be done in the near future. You've inspired me to dive back into it sooner than later, though. We'll see what happens. I'll keep this issue open for tracking template 3.

@alexdresko alexdresko self-assigned this Sep 3, 2018
@alekslyse
Copy link
Author

alekslyse commented Sep 3, 2018 via email

@alexdresko
Copy link
Owner

Interesting. Where's your info on HS4? I kinda thought the HS devs have just been on vacation for the past couple of years.

Happy to accept any utility classes you might have.

@alekslyse
Copy link
Author

Its been all over their forum. I got some official replies on the forum HS4 will keep the current API, and just be cosmetic changes (even official im not sure if its that official), but we can assume it wont be that much changes as HS2->HS3.

As you can see they are pushing a new phone app and upgraded their forum so I think something is happening.

Im not that steady in C# to be honest - the development is ok, but im not used to work with visual studio and such. My goal is just to make a class named Utilities that I can just reference from HSPI.cs with for example Utilities.ListDevices() or Utilities.CreateDevice(x, level) - is it any best practises how to implement a class like that and still keep your script in context (so I can access HS etc in that sub class).

Would like it as its own file so its easy for people to just add it to HSPI and create, list, delete and update devices with a single line of code.

@alexdresko
Copy link
Owner

I've got another project I'm working on that aims to make c# scripting easier. There are two parts:

  • A new tool called HsMetal that spits out a type-safe representation of every HS device and event in the system.
  • Support for HS scripting via VSCode. The combination should make it really simple for developers to write HS scripts against their existing devices using VSCode.

Pretty excited about it, as I actually need that more than I need this HSPI project in the short term. But, ultimately, HS plugins are more powerful, and HsMetal could still be utilized with HSPI for more power.

@alekslyse
Copy link
Author

The main thing missing for HSPI is documentation - I know its boring, but should be done. I think its good to know what your plugins really can do without having to check the code. For example are you just passing functions through the classes to make the naming convention easier, or do you have functional classes?

I did take a look on your template 3 branch, and I think you are focusing more on functional classes there?

Is HSMetal something that is currently in release or a private project?

When I just get started I would happily donate for keeping this project running - Im doing this development for making plugins to support cancer and teenager projects - not a penny to my pocket so hopefully I can get my mind wrapped around the code properly so I can start pushing out some plugins.

@alexdresko
Copy link
Owner

Agreed about the example documentation. I also really need to go through all of the latest commits and make sure I've documented all of the changes I've made. And then make it a habit to not merge anything without including documentation. :)

I did make some changes recently that will enable me to write documentation easier. Namely, with the right plugins installed, it's pretty easy writing documentation in VSCode now.

We'll get there.

Solid goals on your part, also. Keep doing what you're doing. You'll go far.

@alekslyse
Copy link
Author

To make things easier, and you have the knowledge, could you add an Utility.cs class that has access to hs and can be fully accessed from HSPI - Im not sure about the best practise. If you could just make a class with one function like GetDeviceEnumerator() I will fill it up with useful functions and send a pull request as I will add all functions I will be using to this class.

@alekslyse
Copy link
Author

alekslyse commented Sep 3, 2018

For example if I make a method in HSPI with the following code

Scheduler.Classes.clsDeviceEnumeration en = (Scheduler.Classes.clsDeviceEnumeration)HS.GetDeviceEnumerator();

Scheduler.Classes.DeviceClass dv;

while (!en.Finished)
{
    dv = en.GetNext();
    Console.WriteLine(dv.get_Name(HS));
}

Its working well, but not in sub classes. Not sure why though

@oesolberg
Copy link
Contributor

oesolberg commented Sep 4, 2018

Maybe something like this (I do it like this to get all my plugins devices):

private List<DeviceClass> GetHomeseerDevices()
{
	var deviceList = new List<Scheduler.Classes.DeviceClass>();
	var deviceEnumerator = (clsDeviceEnumeration)_hs.GetDeviceEnumerator();
	while (!deviceEnumerator.Finished)
	{
		var foundDevice = deviceEnumerator.GetNext();
		deviceList.Add(foundDevice);
	}
	return deviceList.Where(x => x.get_Interface(_hs) == Utility.PluginName).ToList();
}

@zimmer62
Copy link

zimmer62 commented Sep 5, 2018

This is exciting! I'm glad to see some wind again in the sails. I'm working on a Ryobi Garage Door opener plugin now, so I just jumped back in.

@simplextech
Copy link

I've forked this and started to follow. I'm excited to see movement towards some good documentation around using C# with HS and gives me some hope to port plugins to C#.

@alekslyse
Copy link
Author

alekslyse commented Sep 11, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants