Coder Social home page Coder Social logo

Comments (11)

alanfischer avatar alanfischer commented on September 23, 2024

@grantclem I do not have a Fibaro KeyFob to test this with, but if you are willing to get some data for me, I could attempt a fix.

I'd need you to visit these 2 urls on your vera and send the result:
http://your_vera_url:3480/data_request?id=sdata
http://your_vera_url:3480/data_request?id=status

Thanks

from pyvera.

grantclem avatar grantclem commented on September 23, 2024

from pyvera.

alanfischer avatar alanfischer commented on September 23, 2024

It looks like the files didn't attach.

from pyvera.

grantclem avatar grantclem commented on September 23, 2024

from pyvera.

grantclem avatar grantclem commented on September 23, 2024

from pyvera.

alanfischer avatar alanfischer commented on September 23, 2024

Not seeing it. Please email them to [email protected]

from pyvera.

alanfischer avatar alanfischer commented on September 23, 2024

Ok, getting closer. If you could email me http://your_vera_url:3480/data_request?id=status with you pressing 1 button on one of the remotes, and then press a different button on the same remote and send http://your_vera_url:3480/data_request?id=status again I might be able to figure it out.

from pyvera.

alanfischer avatar alanfischer commented on September 23, 2024

Ok, I have an experimental branch that may support remotes. Are you comfortable with git & python enough to run some commands I could give you to test it?

from pyvera.

grantclem avatar grantclem commented on September 23, 2024

from pyvera.

alanfischer avatar alanfischer commented on September 23, 2024

Fix merged in

from pyvera.

grantclem avatar grantclem commented on September 23, 2024

Hi all,
Alan was working on this issue mid last year and the fix provided was working fine up until the "Great Migration" of Home Assistant. It was never merged in the end as Alan was busy with other things and as a workround I simply used the modified sensor.py file as a Custom Component. I am not quite sure why it has stopped working as was wondering if it could actually be merged if resolved and not use it as CC anymore. Code attached

"""
Support for Vera sensors.

For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.vera/
"""
import logging
from datetime import timedelta

from homeassistant.const import (
    TEMP_CELSIUS, TEMP_FAHRENHEIT)
from homeassistant.helpers.entity import Entity
from homeassistant.components.sensor import ENTITY_ID_FORMAT
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.util import convert
from homeassistant.components.vera import (
    VERA_CONTROLLER, VERA_DEVICES, VeraDevice)

DEPENDENCIES = ['vera']

_LOGGER = logging.getLogger(__name__)

SCAN_INTERVAL = timedelta(seconds=5)

EVENT_VERA_REMOTE = "vera_remote"

ATTR_BUTTON = "button"


def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Vera controller devices."""
    add_entities(
        [VeraSensor(device, hass.data[VERA_CONTROLLER])
         for device in hass.data[VERA_DEVICES]['sensor']], True)


class VeraSensor(VeraDevice, Entity):
    """Representation of a Vera Sensor."""

    def __init__(self, vera_device, controller):
        """Initialize the sensor."""
        self.current_value = None
        self._temperature_units = None
        self.last_changed_time = None
        VeraDevice.__init__(self, vera_device, controller)
        self.entity_id = ENTITY_ID_FORMAT.format(self.vera_id)

    @property
    def state(self):
        """Return the name of the sensor."""
        return self.current_value

    @property
    def unit_of_measurement(self):
        """Return the unit of measurement of this entity, if any."""
        import pyvera as veraApi
        if self.vera_device.category == veraApi.CATEGORY_TEMPERATURE_SENSOR:
            return self._temperature_units
        if self.vera_device.category == veraApi.CATEGORY_LIGHT_SENSOR:
            return 'lx'
        if self.vera_device.category == veraApi.CATEGORY_UV_SENSOR:
            return 'level'
        if self.vera_device.category == veraApi.CATEGORY_HUMIDITY_SENSOR:
            return '%'
        if self.vera_device.category == veraApi.CATEGORY_POWER_METER:
            return 'watts'

    def update(self):
        """Update the state."""
        import pyvera as veraApi
        if self.vera_device.category == veraApi.CATEGORY_TEMPERATURE_SENSOR:
            self.current_value = self.vera_device.temperature

            vera_temp_units = (
                self.vera_device.vera_controller.temperature_units)

            if vera_temp_units == 'F':
                self._temperature_units = TEMP_FAHRENHEIT
            else:
                self._temperature_units = TEMP_CELSIUS

        elif self.vera_device.category == veraApi.CATEGORY_LIGHT_SENSOR:
            self.current_value = self.vera_device.light
        elif self.vera_device.category == veraApi.CATEGORY_UV_SENSOR:
            self.current_value = self.vera_device.light
        elif self.vera_device.category == veraApi.CATEGORY_HUMIDITY_SENSOR:
            self.current_value = self.vera_device.humidity
        elif (self.vera_device.category == veraApi.CATEGORY_SCENE_CONTROLLER or
              self.vera_device.category == veraApi.CATEGORY_REMOTE):
            value = self.vera_device.get_last_scene_id(True)
            time = self.vera_device.get_last_scene_time(True)

            if time is not None and time == self.last_changed_time:
                self.current_value = None
            else:
                self.current_value = value

                self.hass.bus.fire(EVENT_VERA_REMOTE, {
                    ATTR_ENTITY_ID: self.entity_id,
                    ATTR_BUTTON: self.current_value
                })

            self.last_changed_time = time
        elif self.vera_device.category == veraApi.CATEGORY_POWER_METER:
            power = convert(self.vera_device.power, float, 0)
            self.current_value = int(round(power, 0))
        elif self.vera_device.is_trippable:
            tripped = self.vera_device.is_tripped
            self.current_value = 'Tripped' if tripped else 'Not Tripped'
        else:
            self.current_value = 'Unknown'


from pyvera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.