Worked OK in Factorio 1.1
I looked in control.lua and I don't know how to fix it.
Found this in Factorio 2.0.7 changes:
-- Removed LuaEntity::neighbours support for electric poles and power switches.
-- Removed LuaEntity::connect_neighbour and LuaEntity::disconnect_neighbour.
Added post to this thread:
https://forums.factorio.com/viewtopic.php?f=6&t=91100