Closed sweebee closed 9 years ago
sure will try it.but, if you can help me it would be great
I tried to get it working, but the problem is that I don't know much about coffee script. @icesory told me that you could use the dimmer device from homeduino and adjust it to mysensors. Maybe @icesory can help?
This is the code from homeduino:
class HomeduinoRFDimmer extends env.devices.DimmerActuator
_lastdimlevel: null
constructor: (@config, lastState, @board, @_pluginConfig) ->
@id = config.id
@name = config.name
@_dimlevel = lastState?.dimlevel?.value or 0
@_lastdimlevel = lastState?.lastdimlevel?.value or 100
@_state = lastState?.state?.value or off
for p in config.protocols
_protocol = Board.getRfProtocol(p.name)
unless _protocol?
throw new Error("Could not find a protocol with the name \"#{p.name}\".")
unless _protocol.type is "dimmer" or "switch"
throw new Error("\"#{p.name}\" is not a dimmer or a switch protocol.")
@board.on('rf', (event) =>
for p in @config.protocols
unless p.receive is false
match = doesProtocolMatch(event, p)
if match
if event.values.state?
if event.values.state is false
unless @_dimlevel is 0
@_lastdimlevel = @_dimlevel
@_setDimlevel(0)
else
@_setDimlevel(@_lastdimlevel)
else
_protocol = Board.getRfProtocol(p.name)
if _protocol.values.dimlevel?
min = _protocol.values.dimlevel.min
max = _protocol.values.dimlevel.max
dimlevel = Math.round(event.values.dimlevel * ((100.0 / (max - min))+min))
@_setDimlevel(dimlevel)
)
super()
_sendLevelToDimmers: sendToDimmersMixin
turnOn: -> @changeDimlevelTo(@_lastdimlevel)
changeDimlevelTo: (level) ->
unless @config.forceSend
if @_dimlevel is level then return Promise.resolve true
if level is 0
state = false
unless @_dimlevel is 0
@_lastdimlevel = @_dimlevel
@_sendLevelToDimmers(@config.protocols, state, level).then( =>
@_setDimlevel(level)
)
Managed to add the dimmer, its working for me. But there could be some bugs. https://github.com/DheerajKhajuria/pimatic-mysensors/pull/9
closing the issue, assuming dimmer is working for you . Again raise the issue if problem comes again.
It works with all the default dimmer sketches from MySensors :)
Could you add the V_DIMMER?