I’ve taken the good work of others who created the Insteon device type, and modified it to support X10 devices connected over insteon.
Currently I’ve implemented X10 switch and X10 Dimmer. See https://github.com/pshotton/insteon-x10-smartthings/
Feel free to comment - this is my first ST device type code.
Insteon requires (at least) two HTTP requests to control an X10 device, one to set the address and the other to send the command. However if these are less than about 1/2 second apart then the hub ignores them! I’m returning two HubAction objects from the command, and it seems that the delay that ST puts between them is just enough…
Dimming is a bit of a mare. There are 22 levels in X10, and you change levels by repeatedly sending DIM or BRIGHT commands. So to go from level 0 to level 100 takes 23 HubAction (1 for the address and 22 bright). Switching on or off doesn’t change the brightness (which is nice) but if ST and the device get out of step, there’s no way to change the level.
As X10 is one-way (mostly) there’s no way to check the current dim level, so if you change it outside of ST you’ll have trouble!
Still to do: Tidy up the UI, particularly for editing preferences. Try and improve reliability.