Skip to content

Conversation

@RaynerCadrelo
Copy link
Owner

No description provided.

pass
class CompostDevice(DataDevice):
def __init__(self):
self._intervalRefresh=20
Copy link
Collaborator

Choose a reason for hiding this comment

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

En python se utiliza para nombre de las variables y métodos "snake_case" por lo que esta variable debe llamarse "_interval_refresh"
El nombre de las clases si es "UpperCamel", así como está está bien

class TurbineDevise(TurnOnOfDevise):
ON = "ON"
OFF = "OFF"
on = "ON"
Copy link
Collaborator

Choose a reason for hiding this comment

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

ON y OFF funcionan como constantes y las constantes se deben nombrar con mayúsculas para que sean fácilmente reconocidas y evitar que sean modificadas sin querer al fonfundirlas con variables.
Esto pasa porque en python no hay constantes

from .state_device import StateDevice


class TankDevice(StateDevice):
Copy link
Collaborator

Choose a reason for hiding this comment

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

¿Aquí deberías heredar de DataDevise?

self._data=""


def refresh(self,currentTime):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Aquí debes dejar un espacio, así

def refresh(self, currentTime):



def refresh(self,currentTime):
self._controller.sendReceiveData("high"+self._activationPin)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Aquí dejar espacio así

self._controller.sendReceiveData("high" + self._activationPin)

Pero queda mejor así

self._controller.sendReceiveData(f"high{self._activationPin}")

response = self._controller.sendReceiveData(self._analogPin)
self._controller.sendReceiveData("low"+self._activationPin)

if len(response.split())!=2:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Espacios!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants