Advertisement
Guest User

openHAB Issue Paste edit

a guest
Apr 20th, 2017
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1.  
  2. I have done the Following.
  3.  
  4. 1. Flashed the Sonoff itead Switch
  5. 2. Configured the Mosquitto broker
  6. 3. Configured the mqtt.cfg for openhab
  7.  
  8. Now I checked if everything is working.
  9. I can access the Sonoff Switch via. Firefox
  10. I check and configure the MQTT for the Sonoff Switch.
  11.  
  12. Sonoff Console Log
  13. ```csv
  14. 00:00:00 APP: Project sonoff Sonoff (Topic cmnd/sonoff-977686, Fallback DVES_977686, GroupTopic sonoffs) Version 4.0.8
  15. 00:00:00 Wifi: Connecting to AP1 wonderland in mode 11N as cmnd/sonoff-977686-5766...
  16. 00:00:05 Wifi: Connected
  17. 00:00:05 mDNS: Initialized
  18. 00:00:05 HTTP: Webserver active on cmnd/sonoff-977686-5766.local with IP address ***.***.***.***
  19. 11:01:51 MQTT: Attempting connection...
  20. 11:01:53 mDNS: Query done with 0 mqtt services found
  21. 11:01:53 MQTT: Connected
  22. 11:01:53 MQTT: tele/cmnd/sonoff-977686/LWT = Online (retained)
  23. 11:01:53 MQTT: cmnd/cmnd/sonoff-977686/POWER =
  24. 11:01:53 MQTT: tele/cmnd/sonoff-977686/INFO1 = {"Module":"Sonoff Basic", "Version":"4.0.8", "FallbackTopic":"DVES_977686", "GroupTopic":"sonoffs"}
  25. 11:01:53 MQTT: tele/cmnd/sonoff-977686/INFO2 = {"WebserverMode":"Admin", "Hostname":"cmnd/sonoff-977686-5766", "IPaddress":"***.***.***.***"}
  26. 11:01:53 MQTT: tele/cmnd/sonoff-977686/INFO3 = {"Started":"Software/System restart"}
  27. 11:01:54 MQTT: stat/cmnd/sonoff-977686/RESULT = {"POWER":"ON"}
  28. 11:01:54 MQTT: stat/cmnd/sonoff-977686/POWER = ON
  29. ```
  30. Switching from On to Off Mosquitto Log
  31.  
  32. ```csv
  33. 1492682688: Received PUBLISH from DVES_977686 (d0, q0, r0, m0, 'stat/cmnd/sonoff-977686/RESULT', ... (15 bytes))
  34. 1492682688: Received PUBLISH from DVES_977686 (d0, q0, r0, m0, 'stat/cmnd/sonoff-977686/POWER', ... (3 bytes))
  35. ```
  36. Feels good.
  37.  
  38. Now I tested an simple MQTT openHAB item.
  39.  
  40. ```csv
  41. Switch LivingRoom_Light "Living Room Light" <light> (ALL, Office_Workstation, Office_First_Floor) { mqtt=">[mosquitto:cmnd/sonoff-977686/POWER:command:*:default], <[mosquitto:stat/cmnd/sonoff-977686/POWER:state:default]" }
  42. ```
  43.  
  44. Verbose Mosquitto Log when saving the openHAB item
  45. ```csv
  46. 1492682948: Received PINGREQ from DVES_977686
  47. 1492682948: Sending PINGRESP to DVES_977686
  48. 1492682948: Received UNSUBSCRIBE from openhabian.1492677563242
  49. 1492682948: stat/cmnd/sonoff-977686/POWER
  50. 1492682948: openhabian.1492677563242 stat/cmnd/sonoff-977686/POWER
  51. 1492682948: Received SUBSCRIBE from openhabian.1492677563242
  52. 1492682948: stat/cmnd/sonoff-977686/POWER (QoS 1)
  53. 1492682948: openhabian.1492677563242 1 stat/cmnd/sonoff-977686/POWER
  54. 1492682948: Sending SUBACK to openhabian.1492677563242
  55. ```
  56. When I press the button on my sitemap Mosquitto Log
  57. ```csv
  58. 1492683090: Received PUBLISH from openhabian.1492677563242 (d0, q1, r1, m25, 'cmnd/sonoff-977686/POWER', ... (2 bytes))
  59. 1492683090: Sending PUBACK to openhabian.1492677563242 (Mid: 25)
  60. 1492683090: Sending PUBLISH to mosqsub/26728-openHABia (d0, q0, r0, m0, 'cmnd/sonoff-977686/POWER', ... (2 bytes))
  61. ```
  62. This did not switch the Sonoff switch so I thought hm okay I should start with a MQTT state read item so I did.
  63.  
  64. ```csv
  65. Switch LivingRoom_Light_State "Give me this state" (All, Office_Workstation, Office_First_Floor) { mqtt="<[mosquitto:stat/cmnd/sonoff-977686/POWER:state:default]" }
  66. ```
  67. Was really good the Item on the Sitemap displayed me if the Sonoff itead is on/off.
  68.  
  69. But how the DUCK can I switch the Sonoff Switch via openHAB?
  70. My first Item should do that or not?
  71. ```csv
  72. Switch LivingRoom_Light "Living Room Light" <light> (ALL, Office_Workstation, Office_First_Floor) { mqtt=">[mosquitto:cmnd/sonoff-977686/POWER:command:*:default], <[mosquitto:stat/cmnd/sonoff-977686/POWER:state:default]" }
  73. ```
  74. Am I missing something?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement