with Hass.io try warping the commands in a python script see
(long post look for local scripts)
Had real problems running shell scripts in Hass.io, may help