Skip to content

Conversation

@matthewgodding
Copy link

This new applet switches https://www.home-assistant.io/ entities such as lights. I personally have found this useful to quickly switch my hue play monitor light on and off. I plan to expand with more features however I've been using it for a few weeks and have found no issues so wish to publish to a larger audience.


// Request helper: use curl via GLib.spawn_command_line_sync and return
// callback(err, parsedResponseOrBody)
_request: function(method, path, body, callback) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a library called Soup in gi that can handle requests. Should be examples in other applets that use imports.gi.Soup, might save rolling your own implementation.

@Centurix
Copy link
Contributor

I like this idea. Tested it and it works. Nice!

My 2 cents on this as I'd like to see it working and in mainline:

  • Support more than one entity ID
  • Config moved into a settings-schema.json configuration window rather than editing metadata.json
  • Move config out of metadata.json because the data will be wiped when the applet is updated.

this._state = null;

// Network session removed: use curl fallback only (works reliably
// across environments). Any libsoup-specific code was removed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libsoup is a dependency of Cinnamon, shouldn't be any concern here

@matthewgodding
Copy link
Author

I like this idea. Tested it and it works. Nice!

My 2 cents on this as I'd like to see it working and in mainline:

  • Support more than one entity ID
  • Config moved into a settings-schema.json configuration window rather than editing metadata.json
  • Move config out of metadata.json because the data will be wiped when the applet is updated.

Thanks!

Yes, agree with these points.

Will need to think about the best approach for multiple entities, would it be multiple buttons, a list to select from etc? From a home assistant perspective you could use a scene or automation to switch multiple things.

It would also be nice in the future to give the Home Assistant URL and token then pull back a list of devices and entities to select from.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants