Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MQTT gateway for MySensors #2960

Merged
merged 2 commits into from
Aug 26, 2016

Conversation

MartinHjelmare
Copy link
Member

@MartinHjelmare MartinHjelmare commented Aug 24, 2016

Description:

  • Use mqtt component to enable a MySensors MQTT gateway.
  • Setup the MQTT gateway if mysensors config has mqtt as a value for
    the key device in the list of gateways.
  • Simplify two lines in the mqtt component.

I will add voluptuous config validation in a separate PR, after this is merged.

Pull request in home-assistant.io with documentation (if applicable):
home-assistant/home-assistant.io#841

Example entry for configuration.yaml (if applicable):

mqtt:
  client_id: home-assistant-1
  keepalive: 60

mysensors:
  gateways:
    - device: mqtt
      persistence_file: '~/.homeassistant/mysensors.json'
      topic_in_prefix: 'mygateway1-out'
      topic_out_prefix: 'mygateway1-in'
  debug: true
  persistence: false
  version: 2.0
  optimistic: false
  retain: true

Checklist:

If user exposed functionality or configuration variables are added/changed:

If code communicates with devices, web services, or a:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass

* Use mqtt component to enable a MySensors MQTT gateway.
* Setup the MQTT gateway if mysensors config has mqtt as a value for
	the key	device in the list of gateways.
* Simplify two lines in the mqtt component.
@omgapuppy
Copy link
Contributor

@MartinHjelmare out of interest, does this include support for the MySensors API 2.0 i.e the new / deprecated variables as per their dev doc?

if device in 'mqtt':
if not setup_component(hass, 'mqtt', config):
return
mqtt = get_component('mqtt')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use constant for 'mqtt' ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually the more appropriate way as it allows people to overwrite the built-in mqtt component

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @turbokongen means that I should extract mqtt into a constant, ie

MQTT_COMPONENT = 'mqtt'

I think that doesn't hurt right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MartinHjelmare you got it right 👍

@MartinHjelmare
Copy link
Member Author

@omgapuppy No, we need to add the new S and V_TYPES to the appropriate sensor platforms in home assistant. That's another PR. All new types are already supported in the pymysensors library. So it's just a matter of sorting them into the correct platform, that makes sense. Help is welcome.

@Landrash
Copy link
Contributor

@MartinHjelmare I'll give it a try today to map the new types to the appropriate platform. Ok if I work against your fork of HA?

@MartinHjelmare
Copy link
Member Author

@Landrash That would be awesome! Yes, you can work against my fork. Should I create a new branch there, so you can do a PR to that?

@Landrash
Copy link
Contributor

@MartinHjelmare Yes, sounds like a plan!

@MartinHjelmare
Copy link
Member Author

I've pushed a new branch to my fork based off dev branch:
https://github.com/MartinHjelmare/home-assistant/tree/mysensors-add-new-types

Let me know if you want me to do something else.

@MartinHjelmare
Copy link
Member Author

MartinHjelmare commented Aug 25, 2016

This should be good for merging now.

@MartinHjelmare MartinHjelmare merged commit 877dc9c into home-assistant:dev Aug 26, 2016
@MartinHjelmare MartinHjelmare deleted the mysensors-mqtt branch September 16, 2016 16:46
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants