If you’re like me, you’d like a way to write automations without YAML and Home Assistant Restarts, however, the GUI of Node Red is not ideal for the way you work.
Introducing hass-scripts (http://github.com/dlashua/hass-scripts/).
This is the fork of the great mqtt-scripts (http://github.com/hobbyquaker/mqtt-scripts/) with Home Assistant support shoved in.
It’s not elegant, feature complete, stable, or well tested. But I always feel like code is better shared ASAP, so that more people can benefit and contribute. PRs WELCOME!
Right now, once configured and running, the Syntax looks like this:
hass.on('state:input_boolean.test1', (state) => {
log.info(state);
var service;
if(state.new_state.state == 'off') {
service = 'turn_off';
} else {
service = 'turn_on';
}
hass.call({
domain: 'input_boolean',
service: service,
service_data: {
entity_id: 'input_boolean.test2',
},
});
});